author | Claus Gittinger <cg@exept.de> |
Mon, 14 Feb 2011 17:23:19 +0100 | |
changeset 9764 | 47b9c33465a1 |
parent 9358 | cb6f7757c128 |
child 11225 | 2f252f501b9e |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 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 |
" |
|
3892 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
ApplicationModel subclass:#AbstractFileApplicationNoteBookComponent |
|
15 |
instanceVariableNames:'sameFileIndex item type notifyChannel' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Tools-File' |
|
19 |
! |
|
20 |
||
5140 | 21 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2002 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 |
" |
|
5967 | 35 |
! |
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
[Author:] |
|
40 |
Christian Penk |
|
41 |
" |
|
5140 | 42 |
! ! |
3892 | 43 |
|
44 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'defaults'! |
|
45 |
||
46 |
tabStringFor:aApplicationType |
|
7689 | 47 |
"the formatString shown in a tab (language translated)" |
3892 | 48 |
|
49 |
^ nil |
|
7689 | 50 |
|
51 |
"Modified: / 01-03-2007 / 21:43:10 / cg" |
|
52 |
! |
|
53 |
||
54 |
tabStringFor:aApplicationType forContents:shownContents |
|
55 |
||
56 |
^ nil |
|
57 |
||
58 |
"Created: / 01-03-2007 / 21:35:39 / cg" |
|
3892 | 59 |
! ! |
60 |
||
61 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'queries'! |
|
62 |
||
5010 | 63 |
canOpenItem:anItem |
3892 | 64 |
|
65 |
" |
|
66 |
example: |
|
5010 | 67 |
^ (anItem suffix == 'cc') |
3892 | 68 |
" |
69 |
^ false |
|
70 |
! |
|
71 |
||
72 |
wantNewApplicationAnyway |
|
73 |
||
74 |
^ true |
|
75 |
! ! |
|
76 |
||
77 |
!AbstractFileApplicationNoteBookComponent methodsFor:'accessing'! |
|
78 |
||
4529 | 79 |
notify:msg |
80 |
self notifyChannel value:msg |
|
81 |
! |
|
82 |
||
3892 | 83 |
notifyChannel |
84 |
notifyChannel isNil ifTrue:[ |
|
85 |
self masterApplication notNil ifTrue:[ |
|
86 |
notifyChannel := masterApplication notifyChannel. |
|
87 |
] ifFalse:[ |
|
88 |
notifyChannel := ValueHolder with:''. |
|
89 |
]. |
|
90 |
]. |
|
91 |
^ notifyChannel |
|
92 |
! |
|
93 |
||
94 |
sameFileIndex |
|
95 |
||
96 |
^ sameFileIndex |
|
97 |
! |
|
98 |
||
99 |
sameFileIndex:something |
|
100 |
||
101 |
sameFileIndex := something. |
|
102 |
! ! |
|
103 |
||
104 |
!AbstractFileApplicationNoteBookComponent methodsFor:'actions'! |
|
105 |
||
5010 | 106 |
changeItem:anItem |
3892 | 107 |
|
5010 | 108 |
^ self item:anItem. |
3892 | 109 |
! |
110 |
||
111 |
doClose |
|
112 |
|master| |
|
113 |
||
114 |
"/ tell the NoteBookApplication to close me |
|
115 |
(master := self masterApplication) notNil ifTrue:[ |
|
116 |
master closeSubCanvas:self. |
|
3933
2e083e6e224f
must send #release manually (to release processes)
Claus Gittinger <cg@exept.de>
parents:
3892
diff
changeset
|
117 |
self release. |
3892 | 118 |
] ifFalse:[ |
119 |
self closeRequest. |
|
120 |
]. |
|
3954 | 121 |
^ true |
3892 | 122 |
! ! |
123 |
||
5120 | 124 |
!AbstractFileApplicationNoteBookComponent methodsFor:'aspects'! |
125 |
||
126 |
cursorColLabelHolder |
|
127 |
^ '' |
|
128 |
! |
|
129 |
||
130 |
cursorLineLabelHolder |
|
131 |
^ '' |
|
132 |
! |
|
133 |
||
5528 | 134 |
fileEncodingHolder |
5586 | 135 |
^ #'iso8859-1' |
5528 | 136 |
! |
137 |
||
5737 | 138 |
lockFileEncodingHolder |
7289 | 139 |
^ nil |
5737 | 140 |
! |
141 |
||
5120 | 142 |
modeLabelHolder |
143 |
^ '' |
|
7105 | 144 |
! |
145 |
||
146 |
modeLabelMenu |
|
147 |
^ nil |
|
148 |
||
149 |
"Created: / 11-09-2006 / 12:32:37 / cg" |
|
5120 | 150 |
! ! |
151 |
||
9358
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
152 |
!AbstractFileApplicationNoteBookComponent methodsFor:'drag & drop support'! |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
153 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
154 |
doStartDrag:aDropSource in:aView |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
155 |
"common code, used in subclasses" |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
156 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
157 |
|hdl| |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
158 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
159 |
hdl := DragAndDropManager new. |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
160 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
161 |
hdl disabledCursor:AbstractFileBrowser disabledCursorImage. |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
162 |
hdl enabledCursor:AbstractFileBrowser enabledCursorImage. |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
163 |
hdl alienCursor:nil. |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
164 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
165 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
166 |
! ! |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
167 |
|
3892 | 168 |
!AbstractFileApplicationNoteBookComponent methodsFor:'queries'! |
169 |
||
7468 | 170 |
additionalInfo |
171 |
^ '' |
|
172 |
||
173 |
"Created: / 24-10-2006 / 12:25:51 / cg" |
|
174 |
! |
|
175 |
||
3892 | 176 |
fileName |
177 |
item notNil ifTrue:[ |
|
178 |
^ item fileName. |
|
179 |
]. |
|
180 |
^ nil |
|
181 |
! |
|
182 |
||
183 |
getDirWithoutFileName:aFileName |
|
184 |
||
185 |
| dir | |
|
186 |
aFileName isNil ifTrue:[ |
|
187 |
^ aFileName. |
|
188 |
]. |
|
189 |
dir := aFileName asFilename. |
|
190 |
dir isDirectory ifFalse:[ |
|
191 |
dir := dir directory. |
|
192 |
]. |
|
193 |
^ dir. |
|
194 |
! |
|
195 |
||
196 |
getTabString |
|
7689 | 197 |
"get the tab string from the application" |
3892 | 198 |
|
8387 | 199 |
^ (Unicode16String |
200 |
streamContents:[:stream | |
|
201 |
|formatString valueString| |
|
3892 | 202 |
|
8387 | 203 |
valueString := self getTabValueString. |
204 |
valueString isNil ifTrue:[ |
|
205 |
valueString := resources string:'<unnamed>' |
|
206 |
]. |
|
207 |
||
208 |
formatString := self class tabStringFor:type. |
|
209 |
formatString isNil ifTrue:[ |
|
210 |
"/ default: take the class name |
|
211 |
formatString := self className. |
|
212 |
]. |
|
213 |
stream nextPutAll:(resources string:formatString with:valueString). |
|
214 |
]) asSingleByteStringIfPossible |
|
7689 | 215 |
|
216 |
"Modified: / 01-03-2007 / 21:45:02 / cg" |
|
3892 | 217 |
! |
218 |
||
219 |
getTabStringEnd |
|
220 |
||
221 |
" get the tab string from the application list on the class side " |
|
222 |
||
5460 | 223 |
| stream| |
3892 | 224 |
|
225 |
self item notNil ifTrue:[ |
|
226 |
stream := WriteStream on:''. |
|
5460 | 227 |
self type = #directoryDescription ifTrue:[ |
228 |
stream nextPutAll:self fileName directory baseName. |
|
229 |
stream space. |
|
230 |
stream nextPut:$[. |
|
231 |
stream nextPutAll:self fileName baseName. |
|
232 |
stream nextPut:$]. |
|
233 |
] ifFalse:[ |
|
234 |
stream nextPutAll:self fileName baseName. |
|
235 |
stream space. |
|
236 |
self sameFileIndex notNil ifTrue:[ |
|
237 |
stream nextPutAll:self sameFileIndex asString. |
|
238 |
]. |
|
3892 | 239 |
]. |
5460 | 240 |
^ stream contents. |
3892 | 241 |
]. |
242 |
^ nil |
|
243 |
! |
|
244 |
||
7689 | 245 |
getTabValueString |
246 |
"the item shown in a tab (not language translated)" |
|
247 |
||
248 |
self item isNil ifTrue:[^ nil]. |
|
249 |
||
8387 | 250 |
^ (Unicode16String |
251 |
streamContents:[:stream | |
|
252 |
|fn baseName| |
|
7689 | 253 |
|
8387 | 254 |
fn := self fileName. |
255 |
baseName := fn baseName. |
|
256 |
self type = #directoryDescription ifTrue:[ |
|
257 |
stream nextPutAll:(fn directory baseName). |
|
258 |
stream space. |
|
259 |
stream nextPut:$[. |
|
260 |
stream nextPutAll:baseName. |
|
261 |
stream nextPut:$]. |
|
262 |
] ifFalse:[ |
|
263 |
stream nextPutAll:baseName. |
|
264 |
stream space. |
|
265 |
self sameFileIndex notNil ifTrue:[ |
|
266 |
stream nextPutAll:self sameFileIndex asString. |
|
267 |
]. |
|
7689 | 268 |
]. |
8387 | 269 |
]) asSingleByteStringIfPossible. |
7689 | 270 |
|
271 |
"Created: / 01-03-2007 / 21:40:03 / cg" |
|
272 |
! |
|
273 |
||
3892 | 274 |
isEmbeddedApplication |
275 |
||
276 |
^ self masterApplication notNil |
|
277 |
! |
|
278 |
||
279 |
isModified |
|
280 |
||
281 |
^ false |
|
282 |
! |
|
283 |
||
4147 | 284 |
isTextEditor |
285 |
||
286 |
^ false |
|
287 |
! |
|
288 |
||
3892 | 289 |
item |
290 |
||
291 |
^ item |
|
292 |
! |
|
293 |
||
5010 | 294 |
item:anItem |
3892 | 295 |
|
5010 | 296 |
item := anItem. |
3892 | 297 |
^ true |
298 |
! |
|
299 |
||
300 |
presentation |
|
301 |
||
302 |
^ nil |
|
303 |
! |
|
304 |
||
305 |
type |
|
306 |
||
307 |
^ type |
|
308 |
! |
|
309 |
||
310 |
type:aType |
|
311 |
||
312 |
type := aType |
|
313 |
! |
|
314 |
||
315 |
wantChangeAnyWay |
|
316 |
||
317 |
^ (self type == #directoryDescription) |
|
318 |
! ! |
|
319 |
||
5604 | 320 |
!AbstractFileApplicationNoteBookComponent methodsFor:'resources'! |
321 |
||
322 |
resources |
|
323 |
masterApplication notNil ifTrue:[ |
|
324 |
^ masterApplication resources |
|
325 |
]. |
|
326 |
^ super resources |
|
327 |
! ! |
|
328 |
||
3892 | 329 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'! |
330 |
||
331 |
version |
|
9358
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
332 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileApplicationNoteBookComponent.st,v 1.22 2010-02-02 14:19:44 cg Exp $' |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
333 |
! |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
334 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
335 |
version_CVS |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
336 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileApplicationNoteBookComponent.st,v 1.22 2010-02-02 14:19:44 cg Exp $' |
3892 | 337 |
! ! |