author | Stefan Vogel <sv@exept.de> |
Wed, 31 Jan 2018 07:14:54 +0100 | |
changeset 17971 | 0f6d265b9ffb |
parent 17811 | 215663d4f8a3 |
child 18184 | 43f24857d9df |
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 |
||
15588
558245ed3e2d
class: AbstractFileApplicationNoteBookComponent
Stefan Vogel <sv@exept.de>
parents:
14800
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
558245ed3e2d
class: AbstractFileApplicationNoteBookComponent
Stefan Vogel <sv@exept.de>
parents:
14800
diff
changeset
|
15 |
|
3892 | 16 |
ApplicationModel subclass:#AbstractFileApplicationNoteBookComponent |
17 |
instanceVariableNames:'sameFileIndex item type notifyChannel' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Tools-File' |
|
21 |
! |
|
22 |
||
5140 | 23 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
5967 | 37 |
! |
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
[Author:] |
|
42 |
Christian Penk |
|
43 |
" |
|
5140 | 44 |
! ! |
3892 | 45 |
|
46 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'defaults'! |
|
47 |
||
48 |
tabStringFor:aApplicationType |
|
7689 | 49 |
"the formatString shown in a tab (language translated)" |
3892 | 50 |
|
51 |
^ nil |
|
7689 | 52 |
|
53 |
"Modified: / 01-03-2007 / 21:43:10 / cg" |
|
54 |
! |
|
55 |
||
56 |
tabStringFor:aApplicationType forContents:shownContents |
|
57 |
||
58 |
^ nil |
|
59 |
||
60 |
"Created: / 01-03-2007 / 21:35:39 / cg" |
|
3892 | 61 |
! ! |
62 |
||
63 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'queries'! |
|
64 |
||
5010 | 65 |
canOpenItem:anItem |
3892 | 66 |
|
67 |
" |
|
68 |
example: |
|
5010 | 69 |
^ (anItem suffix == 'cc') |
3892 | 70 |
" |
71 |
^ false |
|
72 |
! |
|
73 |
||
16198 | 74 |
isAbstract |
75 |
"Return if this class is an abstract class. |
|
76 |
True is returned here for myself only; false for subclasses. |
|
77 |
Abstract subclasses must redefine this again." |
|
78 |
||
79 |
^ self == AbstractFileApplicationNoteBookComponent. |
|
80 |
! |
|
81 |
||
3892 | 82 |
wantNewApplicationAnyway |
83 |
||
84 |
^ true |
|
85 |
! ! |
|
86 |
||
87 |
!AbstractFileApplicationNoteBookComponent methodsFor:'accessing'! |
|
88 |
||
4529 | 89 |
notify:msg |
90 |
self notifyChannel value:msg |
|
91 |
! |
|
92 |
||
17811 | 93 |
sameFileIndex |
94 |
||
95 |
^ sameFileIndex |
|
96 |
! |
|
97 |
||
98 |
sameFileIndex:something |
|
99 |
||
100 |
sameFileIndex := something. |
|
101 |
! ! |
|
102 |
||
103 |
!AbstractFileApplicationNoteBookComponent methodsFor:'accessing-channels'! |
|
104 |
||
3892 | 105 |
notifyChannel |
106 |
notifyChannel isNil ifTrue:[ |
|
107 |
self masterApplication notNil ifTrue:[ |
|
108 |
notifyChannel := masterApplication notifyChannel. |
|
109 |
] ifFalse:[ |
|
110 |
notifyChannel := ValueHolder with:''. |
|
111 |
]. |
|
112 |
]. |
|
113 |
^ notifyChannel |
|
114 |
! ! |
|
115 |
||
116 |
!AbstractFileApplicationNoteBookComponent methodsFor:'actions'! |
|
117 |
||
5010 | 118 |
changeItem:anItem |
3892 | 119 |
|
5010 | 120 |
^ self item:anItem. |
3892 | 121 |
! |
122 |
||
123 |
doClose |
|
124 |
|master| |
|
125 |
||
126 |
"/ tell the NoteBookApplication to close me |
|
127 |
(master := self masterApplication) notNil ifTrue:[ |
|
128 |
master closeSubCanvas:self. |
|
3933
2e083e6e224f
must send #release manually (to release processes)
Claus Gittinger <cg@exept.de>
parents:
3892
diff
changeset
|
129 |
self release. |
3892 | 130 |
] ifFalse:[ |
131 |
self closeRequest. |
|
132 |
]. |
|
3954 | 133 |
^ true |
3892 | 134 |
! ! |
135 |
||
5120 | 136 |
!AbstractFileApplicationNoteBookComponent methodsFor:'aspects'! |
137 |
||
138 |
cursorColLabelHolder |
|
139 |
^ '' |
|
140 |
! |
|
141 |
||
15822
161ba719c870
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
15588
diff
changeset
|
142 |
cursorLineAndColumnLabelHolder |
161ba719c870
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
15588
diff
changeset
|
143 |
^ '' |
161ba719c870
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
15588
diff
changeset
|
144 |
! |
161ba719c870
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
15588
diff
changeset
|
145 |
|
5120 | 146 |
cursorLineLabelHolder |
147 |
^ '' |
|
148 |
! |
|
149 |
||
5528 | 150 |
fileEncodingHolder |
5586 | 151 |
^ #'iso8859-1' |
5528 | 152 |
! |
153 |
||
5737 | 154 |
lockFileEncodingHolder |
7289 | 155 |
^ nil |
5737 | 156 |
! |
157 |
||
5120 | 158 |
modeLabelHolder |
159 |
^ '' |
|
7105 | 160 |
! |
161 |
||
162 |
modeLabelMenu |
|
163 |
^ nil |
|
164 |
||
165 |
"Created: / 11-09-2006 / 12:32:37 / cg" |
|
17971 | 166 |
! |
167 |
||
168 |
reloadButtonVisible |
|
169 |
^ self fileName notNil |
|
170 |
||
171 |
"Created: / 31-01-2018 / 07:14:04 / stefan" |
|
5120 | 172 |
! ! |
173 |
||
9358
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
174 |
!AbstractFileApplicationNoteBookComponent methodsFor:'drag & drop support'! |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
175 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
176 |
doStartDrag:aDropSource in:aView |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
177 |
"common code, used in subclasses" |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
178 |
|
17201 | 179 |
AbstractFileBrowser doStartDrag:aDropSource in:aView |
180 |
"/ same code |
|
181 |
"/ |hdl| |
|
182 |
"/ |
|
183 |
"/ hdl := DragAndDropManager new. |
|
184 |
"/ |
|
185 |
"/ hdl disabledCursor:AbstractFileBrowser disabledCursorIcon. |
|
186 |
"/ hdl enabledCursor:AbstractFileBrowser enabledCursorIcon. |
|
187 |
"/ hdl alienCursor:nil. |
|
188 |
"/ |
|
189 |
"/ hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft |
|
9358
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
190 |
! ! |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
191 |
|
3892 | 192 |
!AbstractFileApplicationNoteBookComponent methodsFor:'queries'! |
193 |
||
7468 | 194 |
additionalInfo |
195 |
^ '' |
|
196 |
||
197 |
"Created: / 24-10-2006 / 12:25:51 / cg" |
|
198 |
! |
|
199 |
||
11225 | 200 |
closeButtonShown |
201 |
^ false. |
|
202 |
||
203 |
"Created: / 27-01-2012 / 15:00:22 / cg" |
|
204 |
! |
|
205 |
||
12492
1c485310f1ca
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
11225
diff
changeset
|
206 |
cvsMenusAreShown |
1c485310f1ca
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
11225
diff
changeset
|
207 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
1c485310f1ca
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
11225
diff
changeset
|
208 |
! |
1c485310f1ca
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
11225
diff
changeset
|
209 |
|
3892 | 210 |
fileName |
211 |
item notNil ifTrue:[ |
|
212 |
^ item fileName. |
|
213 |
]. |
|
214 |
^ nil |
|
215 |
! |
|
216 |
||
217 |
getDirWithoutFileName:aFileName |
|
218 |
||
219 |
| dir | |
|
220 |
aFileName isNil ifTrue:[ |
|
221 |
^ aFileName. |
|
222 |
]. |
|
223 |
dir := aFileName asFilename. |
|
224 |
dir isDirectory ifFalse:[ |
|
225 |
dir := dir directory. |
|
226 |
]. |
|
227 |
^ dir. |
|
228 |
! |
|
229 |
||
14800
993062566d3f
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
12492
diff
changeset
|
230 |
getTabIcon |
993062566d3f
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
12492
diff
changeset
|
231 |
"the item shown in a tab" |
993062566d3f
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
12492
diff
changeset
|
232 |
|
993062566d3f
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
12492
diff
changeset
|
233 |
^ nil |
993062566d3f
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
12492
diff
changeset
|
234 |
! |
993062566d3f
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
12492
diff
changeset
|
235 |
|
3892 | 236 |
getTabString |
7689 | 237 |
"get the tab string from the application" |
3892 | 238 |
|
15974 | 239 |
|formatString valueString stream| |
240 |
||
241 |
stream := CharacterWriteStream on:''. |
|
3892 | 242 |
|
15974 | 243 |
valueString := self getTabValueString. |
244 |
valueString isNil ifTrue:[ |
|
245 |
valueString := resources string:'<unnamed>' |
|
246 |
]. |
|
247 |
formatString := self class tabStringFor:type. |
|
248 |
formatString isNil ifTrue:[ |
|
249 |
"/ default: take the class name |
|
250 |
formatString := self className. |
|
251 |
]. |
|
252 |
stream nextPutAll:(resources string:formatString with:valueString). |
|
8387 | 253 |
|
15974 | 254 |
^ stream contents. |
7689 | 255 |
|
256 |
"Modified: / 01-03-2007 / 21:45:02 / cg" |
|
3892 | 257 |
! |
258 |
||
259 |
getTabStringEnd |
|
15588
558245ed3e2d
class: AbstractFileApplicationNoteBookComponent
Stefan Vogel <sv@exept.de>
parents:
14800
diff
changeset
|
260 |
" get the tab string from the application list on the class side " |
3892 | 261 |
|
5460 | 262 |
| stream| |
3892 | 263 |
|
264 |
self item notNil ifTrue:[ |
|
15588
558245ed3e2d
class: AbstractFileApplicationNoteBookComponent
Stefan Vogel <sv@exept.de>
parents:
14800
diff
changeset
|
265 |
stream := CharacterWriteStream new. |
5460 | 266 |
self type = #directoryDescription ifTrue:[ |
267 |
stream nextPutAll:self fileName directory baseName. |
|
268 |
stream space. |
|
269 |
stream nextPut:$[. |
|
270 |
stream nextPutAll:self fileName baseName. |
|
271 |
stream nextPut:$]. |
|
272 |
] ifFalse:[ |
|
273 |
stream nextPutAll:self fileName baseName. |
|
274 |
stream space. |
|
275 |
self sameFileIndex notNil ifTrue:[ |
|
276 |
stream nextPutAll:self sameFileIndex asString. |
|
277 |
]. |
|
3892 | 278 |
]. |
5460 | 279 |
^ stream contents. |
3892 | 280 |
]. |
281 |
^ nil |
|
282 |
! |
|
283 |
||
7689 | 284 |
getTabValueString |
285 |
"the item shown in a tab (not language translated)" |
|
286 |
||
15974 | 287 |
|stream fn baseName| |
288 |
||
7689 | 289 |
self item isNil ifTrue:[^ nil]. |
290 |
||
15974 | 291 |
stream := CharacterWriteStream on:''. |
7689 | 292 |
|
15974 | 293 |
fn := self fileName. |
294 |
baseName := fn baseName. |
|
295 |
self type = #directoryDescription ifTrue:[ |
|
296 |
stream nextPutAll:(fn directory baseName). |
|
297 |
stream space. |
|
298 |
stream nextPut:$[. |
|
299 |
stream nextPutAll:baseName. |
|
300 |
stream nextPut:$]. |
|
301 |
] ifFalse:[ |
|
302 |
stream nextPutAll:baseName. |
|
303 |
stream space. |
|
304 |
self sameFileIndex notNil ifTrue:[ |
|
305 |
stream nextPutAll:self sameFileIndex asString. |
|
306 |
]. |
|
307 |
]. |
|
308 |
||
309 |
^ stream contents |
|
7689 | 310 |
|
311 |
"Created: / 01-03-2007 / 21:40:03 / cg" |
|
312 |
! |
|
313 |
||
3892 | 314 |
isEmbeddedApplication |
315 |
||
316 |
^ self masterApplication notNil |
|
317 |
! |
|
318 |
||
319 |
isModified |
|
320 |
||
321 |
^ false |
|
322 |
! |
|
323 |
||
4147 | 324 |
isTextEditor |
325 |
||
326 |
^ false |
|
327 |
! |
|
328 |
||
3892 | 329 |
item |
330 |
||
331 |
^ item |
|
332 |
! |
|
333 |
||
5010 | 334 |
item:anItem |
3892 | 335 |
|
5010 | 336 |
item := anItem. |
3892 | 337 |
^ true |
338 |
! |
|
339 |
||
340 |
presentation |
|
341 |
||
342 |
^ nil |
|
343 |
! |
|
344 |
||
345 |
type |
|
346 |
||
347 |
^ type |
|
348 |
! |
|
349 |
||
350 |
type:aType |
|
351 |
||
352 |
type := aType |
|
353 |
! |
|
354 |
||
355 |
wantChangeAnyWay |
|
356 |
||
357 |
^ (self type == #directoryDescription) |
|
358 |
! ! |
|
359 |
||
5604 | 360 |
!AbstractFileApplicationNoteBookComponent methodsFor:'resources'! |
361 |
||
362 |
resources |
|
363 |
masterApplication notNil ifTrue:[ |
|
364 |
^ masterApplication resources |
|
365 |
]. |
|
366 |
^ super resources |
|
367 |
! ! |
|
368 |
||
3892 | 369 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'! |
370 |
||
371 |
version |
|
15822
161ba719c870
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
15588
diff
changeset
|
372 |
^ '$Header$' |
9358
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
373 |
! |
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
374 |
|
cb6f7757c128
support drag&drop from the find-file resultlist
Claus Gittinger <cg@exept.de>
parents:
8683
diff
changeset
|
375 |
version_CVS |
15822
161ba719c870
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
15588
diff
changeset
|
376 |
^ '$Header$' |
3892 | 377 |
! ! |
12492
1c485310f1ca
class: AbstractFileApplicationNoteBookComponent
Claus Gittinger <cg@exept.de>
parents:
11225
diff
changeset
|
378 |