author | Claus Gittinger <cg@exept.de> |
Wed, 04 Aug 2004 20:00:18 +0200 | |
changeset 5967 | ff5e8356fcb7 |
parent 5903 | 0c2fdcd6babf |
child 6250 | 5b0673ccff1c |
permissions | -rw-r--r-- |
5139 | 1 |
" |
2 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
4712 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
15 |
AbstractFileBrowser subclass:#AbstractDirectoryBrowser |
|
16 |
instanceVariableNames:'inDropMode canDropItem browser updateToExternFileHolderLock' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Tools-File' |
|
20 |
! |
|
21 |
||
22 |
!AbstractDirectoryBrowser class methodsFor:'documentation'! |
|
23 |
||
5139 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
4712 | 38 |
documentation |
39 |
" |
|
40 |
Abstract class containing the common code from DirectoryTreeBrowser and |
|
41 |
DirectoryContentsBrowser applications. |
|
5967 | 42 |
|
43 |
[Author:] |
|
44 |
Christian Penk |
|
4712 | 45 |
" |
46 |
! ! |
|
47 |
||
48 |
!AbstractDirectoryBrowser methodsFor:'accessing'! |
|
49 |
||
50 |
updateToExternFileHolderLock |
|
51 |
"return the value of the instance variable 'updateToExternFileHolder' (automatically generated)" |
|
52 |
||
53 |
updateToExternFileHolderLock isNil ifTrue:[ |
|
54 |
updateToExternFileHolderLock := self class newLock. |
|
55 |
]. |
|
56 |
^ updateToExternFileHolderLock |
|
57 |
! ! |
|
58 |
||
59 |
!AbstractDirectoryBrowser methodsFor:'drag & drop'! |
|
60 |
||
61 |
canDrop:aContext |
|
62 |
||
63 |
^ inDropMode and:[canDropItem] |
|
64 |
! |
|
65 |
||
4745 | 66 |
doDrop:aContext |
67 |
|col destinationPath receiver didDrop| |
|
68 |
||
4754
e8ff80bb18ea
oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents:
4745
diff
changeset
|
69 |
destinationPath := self dropDestinationPath. |
e8ff80bb18ea
oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents:
4745
diff
changeset
|
70 |
|
4745 | 71 |
self dropLeave:aContext. |
72 |
||
73 |
destinationPath ifNil:[^ self]. |
|
74 |
||
75 |
aContext dropSource argument == #archivApplication ifTrue:[ |
|
76 |
receiver := aContext dropSource receiver. |
|
77 |
receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true. |
|
78 |
^ self |
|
79 |
]. |
|
80 |
||
81 |
col := aContext dropObjects collect:[:obj | obj theObject]. |
|
82 |
didDrop := self copyOrMoveFiles:col to:destinationPath. |
|
83 |
didDrop ifFalse:[ |
|
4770 | 84 |
aContext clearHasDroppedFlagToSuppressFeedBack |
85 |
]. |
|
4745 | 86 |
! |
87 |
||
5335 | 88 |
dropDestinationPath |
89 |
self subclassResponsibility |
|
90 |
! |
|
91 |
||
4712 | 92 |
dropEnter:aContext |
93 |
||
94 |
|dropedObjects| |
|
95 |
||
96 |
self dropTargetItemChangedTo:nil in:aContext. |
|
97 |
inDropMode := false. |
|
98 |
||
99 |
"/ self directory isNil ifTrue:[^ self]. |
|
100 |
dropedObjects := aContext dropObjects. |
|
101 |
||
102 |
dropedObjects do:[:aObject| |
|
103 |
|checkObject checkObjectString| |
|
104 |
||
105 |
aObject isFileObject ifFalse:[^ self]. |
|
106 |
||
107 |
checkObject := aObject theObject. |
|
108 |
checkObject isFilename not ifTrue:[^ self]. |
|
109 |
((aContext dropSource argument == #archivApplication) not) ifTrue:[ |
|
110 |
checkObject isSpecialFile ifTrue:[^ self]. |
|
111 |
checkObject isReadable ifFalse:[^ self]. |
|
112 |
]. |
|
113 |
]. |
|
114 |
inDropMode := true. |
|
115 |
! |
|
116 |
||
117 |
dropLeave:aDropContext |
|
118 |
"send the last time, when leaving the widget |
|
119 |
" |
|
120 |
inDropMode ifFalse:[ ^ self ]. |
|
121 |
||
122 |
self dropTargetItemChangedTo:nil in:aDropContext. |
|
123 |
self removeExpandItemTimedBlock. |
|
124 |
inDropMode := false. |
|
125 |
! |
|
126 |
||
5330 | 127 |
dropTargetItemChangedTo:anItem in:aContext |
128 |
||
129 |
self subclassResponsibility |
|
130 |
! |
|
131 |
||
4712 | 132 |
getDropObjects:anArgument |
133 |
||
134 |
^ self selectedFiles collect:[:file| DropObject newFile:file]. |
|
135 |
! |
|
136 |
||
137 |
getLineNumberFor:aDropContext |
|
138 |
| yVisible| |
|
139 |
||
140 |
yVisible := (aDropContext targetPoint y). |
|
141 |
^ browser yVisibleToRowNr:yVisible. |
|
142 |
! |
|
143 |
||
4802 | 144 |
pushUserEvent:selector withArgument:argument |
145 |
self window sensor |
|
146 |
pushUserEvent:selector |
|
147 |
for:self |
|
148 |
withArgument:argument |
|
5796 | 149 |
! |
150 |
||
151 |
removeExpandItemTimedBlock |
|
152 |
"left blank" |
|
4712 | 153 |
! ! |
154 |
||
155 |
!AbstractDirectoryBrowser methodsFor:'file actions'! |
|
156 |
||
157 |
doCopy |
|
158 |
"copy current selected files/directories |
|
159 |
" |
|
160 |
||
161 |
self copyFilesToClipBoard:(self selectedFiles). |
|
162 |
! |
|
163 |
||
164 |
doCut |
|
165 |
"cut current selected files/directories" |
|
166 |
||
167 |
self cutFilesToClipBoard:(self selectedFiles). |
|
168 |
! |
|
169 |
||
170 |
doDelete |
|
171 |
"delete current selected files/directories |
|
172 |
" |
|
5967 | 173 |
|
4742
972a9d30ec47
enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents:
4712
diff
changeset
|
174 |
self deleteFiles:(self selectedFiles copy). |
4712 | 175 |
! ! |
176 |
||
177 |
!AbstractDirectoryBrowser methodsFor:'selection'! |
|
178 |
||
179 |
selectedFiles |
|
180 |
||
181 |
^ self selectedItems collect:[:item| item fileName]. |
|
182 |
! ! |
|
183 |
||
184 |
!AbstractDirectoryBrowser methodsFor:'startup & release'! |
|
185 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
186 |
commonPostOpen |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
187 |
self postOpenFromMaster:true. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
188 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
189 |
|
4712 | 190 |
initialize |
191 |
||
192 |
inDropMode := false. |
|
193 |
^ super initialize. |
|
194 |
! |
|
195 |
||
5444 | 196 |
postOpenFromMaster:fromMaster |
5442 | 197 |
self subclassResponsibility |
4712 | 198 |
! |
199 |
||
200 |
preBuildWith:aBuilder |
|
201 |
||
202 |
self masterApplication isNil ifTrue:[ |
|
203 |
self masterApplication:nil. |
|
204 |
]. |
|
205 |
^ super preBuildWith:aBuilder. |
|
206 |
! ! |
|
207 |
||
208 |
!AbstractDirectoryBrowser class methodsFor:'documentation'! |
|
209 |
||
210 |
version |
|
5967 | 211 |
^ '$Header: /cvs/stx/stx/libtool/AbstractDirectoryBrowser.st,v 1.14 2004-08-04 18:00:18 cg Exp $' |
4712 | 212 |
! ! |