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