author | Claus Gittinger <cg@exept.de> |
Thu, 24 Aug 2006 23:14:06 +0200 | |
changeset 6988 | 0f810a65e1d5 |
parent 6590 | 8299059ad349 |
child 7402 | a0d38bb3a02e |
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 |
updateToExternFileHolderLock isNil ifTrue:[ |
|
52 |
updateToExternFileHolderLock := self class newLock. |
|
53 |
]. |
|
54 |
^ updateToExternFileHolderLock |
|
55 |
! ! |
|
56 |
||
57 |
!AbstractDirectoryBrowser methodsFor:'drag & drop'! |
|
58 |
||
59 |
canDrop:aContext |
|
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 |
6377 | 90 |
|dropObjects| |
4712 | 91 |
|
92 |
self dropTargetItemChangedTo:nil in:aContext. |
|
93 |
inDropMode := false. |
|
94 |
||
95 |
"/ self directory isNil ifTrue:[^ self]. |
|
6377 | 96 |
dropObjects := aContext dropObjects. |
4712 | 97 |
|
6377 | 98 |
dropObjects do:[:aObject| |
4712 | 99 |
|checkObject checkObjectString| |
100 |
||
101 |
aObject isFileObject ifFalse:[^ self]. |
|
102 |
||
103 |
checkObject := aObject theObject. |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
5967
diff
changeset
|
104 |
checkObject isFilename ifFalse:[^ self]. |
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
5967
diff
changeset
|
105 |
(aContext dropSource argument == #archivApplication) ifFalse:[ |
4712 | 106 |
checkObject isSpecialFile ifTrue:[^ self]. |
107 |
checkObject isReadable ifFalse:[^ self]. |
|
108 |
]. |
|
109 |
]. |
|
110 |
inDropMode := true. |
|
111 |
! |
|
112 |
||
113 |
dropLeave:aDropContext |
|
114 |
"send the last time, when leaving the widget |
|
115 |
" |
|
116 |
inDropMode ifFalse:[ ^ self ]. |
|
117 |
||
118 |
self dropTargetItemChangedTo:nil in:aDropContext. |
|
119 |
self removeExpandItemTimedBlock. |
|
120 |
inDropMode := false. |
|
121 |
! |
|
122 |
||
5330 | 123 |
dropTargetItemChangedTo:anItem in:aContext |
124 |
||
125 |
self subclassResponsibility |
|
126 |
! |
|
127 |
||
4712 | 128 |
getDropObjects:anArgument |
129 |
||
130 |
^ self selectedFiles collect:[:file| DropObject newFile:file]. |
|
131 |
! |
|
132 |
||
133 |
getLineNumberFor:aDropContext |
|
134 |
| yVisible| |
|
135 |
||
136 |
yVisible := (aDropContext targetPoint y). |
|
137 |
^ browser yVisibleToRowNr:yVisible. |
|
138 |
! |
|
139 |
||
4802 | 140 |
pushUserEvent:selector withArgument:argument |
141 |
self window sensor |
|
142 |
pushUserEvent:selector |
|
143 |
for:self |
|
144 |
withArgument:argument |
|
5796 | 145 |
! |
146 |
||
147 |
removeExpandItemTimedBlock |
|
148 |
"left blank" |
|
4712 | 149 |
! ! |
150 |
||
151 |
!AbstractDirectoryBrowser methodsFor:'file actions'! |
|
152 |
||
153 |
doCopy |
|
6286 | 154 |
"copy the selected files/directories to the clipBoard" |
4712 | 155 |
|
156 |
self copyFilesToClipBoard:(self selectedFiles). |
|
157 |
! |
|
158 |
||
159 |
doCut |
|
6286 | 160 |
"cut the selected files/directories to the clipBoard" |
4712 | 161 |
|
162 |
self cutFilesToClipBoard:(self selectedFiles). |
|
163 |
! |
|
164 |
||
165 |
doDelete |
|
6286 | 166 |
"delete the selected files/directories" |
5967 | 167 |
|
4742
972a9d30ec47
enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents:
4712
diff
changeset
|
168 |
self deleteFiles:(self selectedFiles copy). |
6286 | 169 |
! |
170 |
||
171 |
doErase |
|
172 |
"erase the selected files" |
|
173 |
||
174 |
self eraseFiles:(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 |
|
6590 | 211 |
^ '$Header: /cvs/stx/stx/libtool/AbstractDirectoryBrowser.st,v 1.19 2006-02-21 12:18:43 cg Exp $' |
4712 | 212 |
! ! |