author | Claus Gittinger <cg@exept.de> |
Tue, 11 Nov 2003 10:51:15 +0100 | |
changeset 5335 | c676d4fdd3f5 |
parent 5330 | db3c33306631 |
child 5442 | 4e025f6f8ed7 |
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. |
|
42 |
" |
|
43 |
! ! |
|
44 |
||
45 |
!AbstractDirectoryBrowser methodsFor:'accessing'! |
|
46 |
||
47 |
updateToExternFileHolderLock |
|
48 |
"return the value of the instance variable 'updateToExternFileHolder' (automatically generated)" |
|
49 |
||
50 |
updateToExternFileHolderLock isNil ifTrue:[ |
|
51 |
updateToExternFileHolderLock := self class newLock. |
|
52 |
]. |
|
53 |
^ updateToExternFileHolderLock |
|
54 |
! ! |
|
55 |
||
56 |
!AbstractDirectoryBrowser methodsFor:'drag & drop'! |
|
57 |
||
58 |
canDrop:aContext |
|
59 |
||
60 |
^ inDropMode and:[canDropItem] |
|
61 |
! |
|
62 |
||
4745 | 63 |
doDrop:aContext |
64 |
|col destinationPath receiver didDrop| |
|
65 |
||
4754
e8ff80bb18ea
oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents:
4745
diff
changeset
|
66 |
destinationPath := self dropDestinationPath. |
e8ff80bb18ea
oops - dropLeave has a side effect.
Claus Gittinger <cg@exept.de>
parents:
4745
diff
changeset
|
67 |
|
4745 | 68 |
self dropLeave:aContext. |
69 |
||
70 |
destinationPath ifNil:[^ self]. |
|
71 |
||
72 |
aContext dropSource argument == #archivApplication ifTrue:[ |
|
73 |
receiver := aContext dropSource receiver. |
|
74 |
receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true. |
|
75 |
^ self |
|
76 |
]. |
|
77 |
||
78 |
col := aContext dropObjects collect:[:obj | obj theObject]. |
|
79 |
didDrop := self copyOrMoveFiles:col to:destinationPath. |
|
80 |
didDrop ifFalse:[ |
|
4770 | 81 |
aContext clearHasDroppedFlagToSuppressFeedBack |
82 |
]. |
|
4745 | 83 |
! |
84 |
||
5335 | 85 |
dropDestinationPath |
86 |
self subclassResponsibility |
|
87 |
! |
|
88 |
||
4712 | 89 |
dropEnter:aContext |
90 |
||
91 |
|dropedObjects| |
|
92 |
||
93 |
self dropTargetItemChangedTo:nil in:aContext. |
|
94 |
inDropMode := false. |
|
95 |
||
96 |
"/ self directory isNil ifTrue:[^ self]. |
|
97 |
dropedObjects := aContext dropObjects. |
|
98 |
||
99 |
dropedObjects do:[:aObject| |
|
100 |
|checkObject checkObjectString| |
|
101 |
||
102 |
aObject isFileObject ifFalse:[^ self]. |
|
103 |
||
104 |
checkObject := aObject theObject. |
|
105 |
checkObject isFilename not ifTrue:[^ self]. |
|
106 |
((aContext dropSource argument == #archivApplication) not) ifTrue:[ |
|
107 |
checkObject isSpecialFile ifTrue:[^ self]. |
|
108 |
checkObject isReadable ifFalse:[^ self]. |
|
109 |
]. |
|
110 |
]. |
|
111 |
inDropMode := true. |
|
112 |
! |
|
113 |
||
114 |
dropLeave:aDropContext |
|
115 |
"send the last time, when leaving the widget |
|
116 |
" |
|
117 |
inDropMode ifFalse:[ ^ self ]. |
|
118 |
||
119 |
self dropTargetItemChangedTo:nil in:aDropContext. |
|
120 |
self removeExpandItemTimedBlock. |
|
121 |
inDropMode := false. |
|
122 |
! |
|
123 |
||
5330 | 124 |
dropTargetItemChangedTo:anItem in:aContext |
125 |
||
126 |
self subclassResponsibility |
|
127 |
! |
|
128 |
||
4712 | 129 |
getDropObjects:anArgument |
130 |
||
131 |
^ self selectedFiles collect:[:file| DropObject newFile:file]. |
|
132 |
! |
|
133 |
||
134 |
getLineNumberFor:aDropContext |
|
135 |
| yVisible| |
|
136 |
||
137 |
yVisible := (aDropContext targetPoint y). |
|
138 |
^ browser yVisibleToRowNr:yVisible. |
|
139 |
! |
|
140 |
||
4802 | 141 |
pushUserEvent:selector withArgument:argument |
142 |
self window sensor |
|
143 |
pushUserEvent:selector |
|
144 |
for:self |
|
145 |
withArgument:argument |
|
4712 | 146 |
! ! |
147 |
||
148 |
!AbstractDirectoryBrowser methodsFor:'file actions'! |
|
149 |
||
150 |
doCopy |
|
151 |
"copy current selected files/directories |
|
152 |
" |
|
153 |
||
154 |
self copyFilesToClipBoard:(self selectedFiles). |
|
155 |
! |
|
156 |
||
157 |
doCut |
|
158 |
"cut current selected files/directories" |
|
159 |
||
160 |
self cutFilesToClipBoard:(self selectedFiles). |
|
161 |
! |
|
162 |
||
163 |
doDelete |
|
164 |
"delete current selected files/directories |
|
165 |
" |
|
4742
972a9d30ec47
enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents:
4712
diff
changeset
|
166 |
self deleteFiles:(self selectedFiles copy). |
4712 | 167 |
! ! |
168 |
||
169 |
!AbstractDirectoryBrowser methodsFor:'selection'! |
|
170 |
||
171 |
selectedFiles |
|
172 |
||
173 |
^ self selectedItems collect:[:item| item fileName]. |
|
174 |
! ! |
|
175 |
||
176 |
!AbstractDirectoryBrowser methodsFor:'startup & release'! |
|
177 |
||
178 |
initialize |
|
179 |
||
180 |
inDropMode := false. |
|
181 |
^ super initialize. |
|
182 |
! |
|
183 |
||
184 |
postOpenAsSubcanvasWith:aBuilder |
|
185 |
||
186 |
super postOpenAsSubcanvasWith:aBuilder. |
|
187 |
self postOpen. |
|
188 |
! |
|
189 |
||
190 |
postOpenWith:aBuilder |
|
191 |
"only invoked if the application not started from a master" |
|
192 |
||
193 |
super postOpenWith:aBuilder. |
|
194 |
self postOpen. |
|
195 |
! |
|
196 |
||
197 |
preBuildWith:aBuilder |
|
198 |
||
199 |
self masterApplication isNil ifTrue:[ |
|
200 |
self masterApplication:nil. |
|
201 |
]. |
|
202 |
^ super preBuildWith:aBuilder. |
|
203 |
! ! |
|
204 |
||
205 |
!AbstractDirectoryBrowser class methodsFor:'documentation'! |
|
206 |
||
207 |
version |
|
5335 | 208 |
^ '$Header: /cvs/stx/stx/libtool/AbstractDirectoryBrowser.st,v 1.9 2003-11-11 09:50:51 cg Exp $' |
4712 | 209 |
! ! |