author | Claus Gittinger <cg@exept.de> |
Fri, 13 Oct 2006 11:57:56 +0200 | |
changeset 7402 | a0d38bb3a02e |
parent 6590 | 8299059ad349 |
child 7407 | 99b39bbcf9b5 |
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 |
||
71 |
destinationPath ifNil:[^ self]. |
|
72 |
||
73 |
aContext dropSource argument == #archivApplication ifTrue:[ |
|
74 |
receiver := aContext dropSource receiver. |
|
75 |
receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true. |
|
76 |
^ self |
|
77 |
]. |
|
78 |
||
79 |
col := aContext dropObjects collect:[:obj | obj theObject]. |
|
80 |
didDrop := self copyOrMoveFiles:col to:destinationPath. |
|
81 |
didDrop ifFalse:[ |
|
4770 | 82 |
aContext clearHasDroppedFlagToSuppressFeedBack |
83 |
]. |
|
4745 | 84 |
! |
85 |
||
5335 | 86 |
dropDestinationPath |
87 |
self subclassResponsibility |
|
88 |
! |
|
89 |
||
4712 | 90 |
dropEnter:aContext |
6377 | 91 |
|dropObjects| |
4712 | 92 |
|
93 |
self dropTargetItemChangedTo:nil in:aContext. |
|
94 |
inDropMode := false. |
|
95 |
||
96 |
"/ self directory isNil ifTrue:[^ self]. |
|
6377 | 97 |
dropObjects := aContext dropObjects. |
4712 | 98 |
|
6377 | 99 |
dropObjects do:[:aObject| |
4712 | 100 |
|checkObject checkObjectString| |
101 |
||
102 |
aObject isFileObject ifFalse:[^ self]. |
|
103 |
||
104 |
checkObject := aObject theObject. |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
5967
diff
changeset
|
105 |
checkObject isFilename ifFalse:[^ self]. |
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
5967
diff
changeset
|
106 |
(aContext dropSource argument == #archivApplication) ifFalse:[ |
4712 | 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 |
|
5796 | 146 |
! |
147 |
||
148 |
removeExpandItemTimedBlock |
|
149 |
"left blank" |
|
4712 | 150 |
! ! |
151 |
||
152 |
!AbstractDirectoryBrowser methodsFor:'file actions'! |
|
153 |
||
154 |
doCopy |
|
6286 | 155 |
"copy the selected files/directories to the clipBoard" |
4712 | 156 |
|
157 |
self copyFilesToClipBoard:(self selectedFiles). |
|
158 |
! |
|
159 |
||
160 |
doCut |
|
6286 | 161 |
"cut the selected files/directories to the clipBoard" |
4712 | 162 |
|
163 |
self cutFilesToClipBoard:(self selectedFiles). |
|
164 |
! |
|
165 |
||
166 |
doDelete |
|
6286 | 167 |
"delete the selected files/directories" |
5967 | 168 |
|
4742
972a9d30ec47
enumerate copies of the selection in delete & rename
Claus Gittinger <cg@exept.de>
parents:
4712
diff
changeset
|
169 |
self deleteFiles:(self selectedFiles copy). |
6286 | 170 |
! |
171 |
||
172 |
doErase |
|
173 |
"erase the selected files" |
|
174 |
||
175 |
self eraseFiles:(self selectedFiles copy). |
|
4712 | 176 |
! ! |
177 |
||
178 |
!AbstractDirectoryBrowser methodsFor:'selection'! |
|
179 |
||
180 |
selectedFiles |
|
181 |
||
182 |
^ self selectedItems collect:[:item| item fileName]. |
|
183 |
! ! |
|
184 |
||
185 |
!AbstractDirectoryBrowser methodsFor:'startup & release'! |
|
186 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
187 |
commonPostOpen |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
188 |
self postOpenFromMaster:true. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
189 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5796
diff
changeset
|
190 |
|
4712 | 191 |
initialize |
192 |
||
193 |
inDropMode := false. |
|
194 |
^ super initialize. |
|
195 |
! |
|
196 |
||
5444 | 197 |
postOpenFromMaster:fromMaster |
5442 | 198 |
self subclassResponsibility |
4712 | 199 |
! |
200 |
||
201 |
preBuildWith:aBuilder |
|
202 |
||
203 |
self masterApplication isNil ifTrue:[ |
|
204 |
self masterApplication:nil. |
|
205 |
]. |
|
206 |
^ super preBuildWith:aBuilder. |
|
207 |
! ! |
|
208 |
||
209 |
!AbstractDirectoryBrowser class methodsFor:'documentation'! |
|
210 |
||
211 |
version |
|
7402 | 212 |
^ '$Header: /cvs/stx/stx/libtool/AbstractDirectoryBrowser.st,v 1.20 2006-10-13 09:57:56 cg Exp $' |
4712 | 213 |
! ! |