author | penk |
Thu, 30 Oct 2003 14:36:10 +0100 | |
changeset 5330 | db3c33306631 |
parent 5139 | 4cef12eebbb7 |
child 5335 | c676d4fdd3f5 |
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 |
||
4712 | 85 |
dropEnter:aContext |
86 |
||
87 |
|dropedObjects| |
|
88 |
||
89 |
self dropTargetItemChangedTo:nil in:aContext. |
|
90 |
inDropMode := false. |
|
91 |
||
92 |
"/ self directory isNil ifTrue:[^ self]. |
|
93 |
dropedObjects := aContext dropObjects. |
|
94 |
||
95 |
dropedObjects do:[:aObject| |
|
96 |
|checkObject checkObjectString| |
|
97 |
||
98 |
aObject isFileObject ifFalse:[^ self]. |
|
99 |
||
100 |
checkObject := aObject theObject. |
|
101 |
checkObject isFilename not ifTrue:[^ self]. |
|
102 |
((aContext dropSource argument == #archivApplication) not) ifTrue:[ |
|
103 |
checkObject isSpecialFile ifTrue:[^ self]. |
|
104 |
checkObject isReadable ifFalse:[^ self]. |
|
105 |
]. |
|
106 |
]. |
|
107 |
inDropMode := true. |
|
108 |
! |
|
109 |
||
110 |
dropLeave:aDropContext |
|
111 |
"send the last time, when leaving the widget |
|
112 |
" |
|
113 |
inDropMode ifFalse:[ ^ self ]. |
|
114 |
||
115 |
self dropTargetItemChangedTo:nil in:aDropContext. |
|
116 |
self removeExpandItemTimedBlock. |
|
117 |
inDropMode := false. |
|
118 |
! |
|
119 |
||
5330 | 120 |
dropTargetItemChangedTo:anItem in:aContext |
121 |
||
122 |
self subclassResponsibility |
|
123 |
! |
|
124 |
||
4712 | 125 |
getDropObjects:anArgument |
126 |
||
127 |
^ self selectedFiles collect:[:file| DropObject newFile:file]. |
|
128 |
! |
|
129 |
||
130 |
getLineNumberFor:aDropContext |
|
131 |
| yVisible| |
|
132 |
||
133 |
yVisible := (aDropContext targetPoint y). |
|
134 |
^ browser yVisibleToRowNr:yVisible. |
|
135 |
! |
|
136 |
||
4802 | 137 |
pushUserEvent:selector withArgument:argument |
138 |
self window sensor |
|
139 |
pushUserEvent:selector |
|
140 |
for:self |
|
141 |
withArgument:argument |
|
4712 | 142 |
! ! |
143 |
||
144 |
!AbstractDirectoryBrowser methodsFor:'file actions'! |
|
145 |
||
146 |
doCopy |
|
147 |
"copy current selected files/directories |
|
148 |
" |
|
149 |
||
150 |
self copyFilesToClipBoard:(self selectedFiles). |
|
151 |
! |
|
152 |
||
153 |
doCut |
|
154 |
"cut current selected files/directories" |
|
155 |
||
156 |
self cutFilesToClipBoard:(self selectedFiles). |
|
157 |
! |
|
158 |
||
159 |
doDelete |
|
160 |
"delete current selected files/directories |
|
161 |
" |
|
4742
972a9d30ec47
enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents:
4712
diff
changeset
|
162 |
self deleteFiles:(self selectedFiles copy). |
4712 | 163 |
! ! |
164 |
||
165 |
!AbstractDirectoryBrowser methodsFor:'selection'! |
|
166 |
||
167 |
selectedFiles |
|
168 |
||
169 |
^ self selectedItems collect:[:item| item fileName]. |
|
170 |
! ! |
|
171 |
||
172 |
!AbstractDirectoryBrowser methodsFor:'startup & release'! |
|
173 |
||
174 |
initialize |
|
175 |
||
176 |
inDropMode := false. |
|
177 |
^ super initialize. |
|
178 |
! |
|
179 |
||
180 |
postOpenAsSubcanvasWith:aBuilder |
|
181 |
||
182 |
super postOpenAsSubcanvasWith:aBuilder. |
|
183 |
self postOpen. |
|
184 |
! |
|
185 |
||
186 |
postOpenWith:aBuilder |
|
187 |
"only invoked if the application not started from a master" |
|
188 |
||
189 |
super postOpenWith:aBuilder. |
|
190 |
self postOpen. |
|
191 |
! |
|
192 |
||
193 |
preBuildWith:aBuilder |
|
194 |
||
195 |
self masterApplication isNil ifTrue:[ |
|
196 |
self masterApplication:nil. |
|
197 |
]. |
|
198 |
^ super preBuildWith:aBuilder. |
|
199 |
! ! |
|
200 |
||
201 |
!AbstractDirectoryBrowser class methodsFor:'documentation'! |
|
202 |
||
203 |
version |
|
5330 | 204 |
^ '$Header: /cvs/stx/stx/libtool/AbstractDirectoryBrowser.st,v 1.8 2003-10-30 13:36:01 penk Exp $' |
4712 | 205 |
! ! |