author | Claus Gittinger <cg@exept.de> |
Wed, 27 Apr 2005 12:22:01 +0200 | |
changeset 6286 | fac153824f35 |
parent 6250 | 5b0673ccff1c |
child 6377 | 5c3a4c5d70cc |
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. |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
5967
diff
changeset
|
108 |
checkObject isFilename ifFalse:[^ self]. |
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
5967
diff
changeset
|
109 |
(aContext dropSource argument == #archivApplication) ifFalse:[ |
4712 | 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 |
|
6286 | 158 |
"copy the selected files/directories to the clipBoard" |
4712 | 159 |
|
160 |
self copyFilesToClipBoard:(self selectedFiles). |
|
161 |
! |
|
162 |
||
163 |
doCut |
|
6286 | 164 |
"cut the selected files/directories to the clipBoard" |
4712 | 165 |
|
166 |
self cutFilesToClipBoard:(self selectedFiles). |
|
167 |
! |
|
168 |
||
169 |
doDelete |
|
6286 | 170 |
"delete the selected files/directories" |
5967 | 171 |
|
4742
972a9d30ec47
enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents:
4712
diff
changeset
|
172 |
self deleteFiles:(self selectedFiles copy). |
6286 | 173 |
! |
174 |
||
175 |
doErase |
|
176 |
"erase the selected files" |
|
177 |
||
178 |
self eraseFiles:(self selectedFiles copy). |
|
4712 | 179 |
! ! |
180 |
||
181 |
!AbstractDirectoryBrowser methodsFor:'selection'! |
|
182 |
||
183 |
selectedFiles |
|
184 |
||
185 |
^ self selectedItems collect:[:item| item fileName]. |
|
186 |
! ! |
|
187 |
||
188 |
!AbstractDirectoryBrowser methodsFor:'startup & release'! |
|
189 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
190 |
commonPostOpen |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
191 |
self postOpenFromMaster:true. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
192 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
193 |
|
4712 | 194 |
initialize |
195 |
||
196 |
inDropMode := false. |
|
197 |
^ super initialize. |
|
198 |
! |
|
199 |
||
5444 | 200 |
postOpenFromMaster:fromMaster |
5442 | 201 |
self subclassResponsibility |
4712 | 202 |
! |
203 |
||
204 |
preBuildWith:aBuilder |
|
205 |
||
206 |
self masterApplication isNil ifTrue:[ |
|
207 |
self masterApplication:nil. |
|
208 |
]. |
|
209 |
^ super preBuildWith:aBuilder. |
|
210 |
! ! |
|
211 |
||
212 |
!AbstractDirectoryBrowser class methodsFor:'documentation'! |
|
213 |
||
214 |
version |
|
6286 | 215 |
^ '$Header: /cvs/stx/stx/libtool/AbstractDirectoryBrowser.st,v 1.16 2005-04-27 10:21:46 cg Exp $' |
4712 | 216 |
! ! |