author | Claus Gittinger <cg@exept.de> |
Thu, 30 Oct 2008 16:51:37 +0100 | |
changeset 8387 | 44efd774e4fc |
parent 7689 | f044f38e823c |
child 8683 | 128a252ae16a |
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 |
||
3892 | 152 |
!AbstractFileApplicationNoteBookComponent methodsFor:'queries'! |
153 |
||
7468 | 154 |
additionalInfo |
155 |
^ '' |
|
156 |
||
157 |
"Created: / 24-10-2006 / 12:25:51 / cg" |
|
158 |
! |
|
159 |
||
3892 | 160 |
fileName |
161 |
||
162 |
item notNil ifTrue:[ |
|
163 |
^ item fileName. |
|
164 |
]. |
|
165 |
^ nil |
|
166 |
! |
|
167 |
||
168 |
getDirWithoutFileName:aFileName |
|
169 |
||
170 |
| dir | |
|
171 |
aFileName isNil ifTrue:[ |
|
172 |
^ aFileName. |
|
173 |
]. |
|
174 |
dir := aFileName asFilename. |
|
175 |
dir isDirectory ifFalse:[ |
|
176 |
dir := dir directory. |
|
177 |
]. |
|
178 |
^ dir. |
|
179 |
! |
|
180 |
||
181 |
getTabString |
|
7689 | 182 |
"get the tab string from the application" |
3892 | 183 |
|
8387 | 184 |
^ (Unicode16String |
185 |
streamContents:[:stream | |
|
186 |
|formatString valueString| |
|
3892 | 187 |
|
8387 | 188 |
valueString := self getTabValueString. |
189 |
valueString isNil ifTrue:[ |
|
190 |
valueString := resources string:'<unnamed>' |
|
191 |
]. |
|
192 |
||
193 |
formatString := self class tabStringFor:type. |
|
194 |
formatString isNil ifTrue:[ |
|
195 |
"/ default: take the class name |
|
196 |
formatString := self className. |
|
197 |
]. |
|
198 |
stream nextPutAll:(resources string:formatString with:valueString). |
|
199 |
]) asSingleByteStringIfPossible |
|
7689 | 200 |
|
201 |
"Modified: / 01-03-2007 / 21:45:02 / cg" |
|
3892 | 202 |
! |
203 |
||
204 |
getTabStringEnd |
|
205 |
||
206 |
" get the tab string from the application list on the class side " |
|
207 |
||
5460 | 208 |
| stream| |
3892 | 209 |
|
210 |
self item notNil ifTrue:[ |
|
211 |
stream := WriteStream on:''. |
|
5460 | 212 |
self type = #directoryDescription ifTrue:[ |
213 |
stream nextPutAll:self fileName directory baseName. |
|
214 |
stream space. |
|
215 |
stream nextPut:$[. |
|
216 |
stream nextPutAll:self fileName baseName. |
|
217 |
stream nextPut:$]. |
|
218 |
] ifFalse:[ |
|
219 |
stream nextPutAll:self fileName baseName. |
|
220 |
stream space. |
|
221 |
self sameFileIndex notNil ifTrue:[ |
|
222 |
stream nextPutAll:self sameFileIndex asString. |
|
223 |
]. |
|
3892 | 224 |
]. |
5460 | 225 |
^ stream contents. |
3892 | 226 |
]. |
227 |
^ nil |
|
228 |
! |
|
229 |
||
7689 | 230 |
getTabValueString |
231 |
"the item shown in a tab (not language translated)" |
|
232 |
||
233 |
self item isNil ifTrue:[^ nil]. |
|
234 |
||
8387 | 235 |
^ (Unicode16String |
236 |
streamContents:[:stream | |
|
237 |
|fn baseName| |
|
7689 | 238 |
|
8387 | 239 |
fn := self fileName. |
240 |
baseName := fn baseName. |
|
241 |
self type = #directoryDescription ifTrue:[ |
|
242 |
stream nextPutAll:(fn directory baseName). |
|
243 |
stream space. |
|
244 |
stream nextPut:$[. |
|
245 |
stream nextPutAll:baseName. |
|
246 |
stream nextPut:$]. |
|
247 |
] ifFalse:[ |
|
248 |
stream nextPutAll:baseName. |
|
249 |
stream space. |
|
250 |
self sameFileIndex notNil ifTrue:[ |
|
251 |
stream nextPutAll:self sameFileIndex asString. |
|
252 |
]. |
|
7689 | 253 |
]. |
8387 | 254 |
]) asSingleByteStringIfPossible. |
7689 | 255 |
|
256 |
"Created: / 01-03-2007 / 21:40:03 / cg" |
|
257 |
! |
|
258 |
||
3892 | 259 |
isEmbeddedApplication |
260 |
||
261 |
^ self masterApplication notNil |
|
262 |
! |
|
263 |
||
264 |
isModified |
|
265 |
||
266 |
^ false |
|
267 |
! |
|
268 |
||
4147 | 269 |
isTextEditor |
270 |
||
271 |
^ false |
|
272 |
! |
|
273 |
||
3892 | 274 |
item |
275 |
||
276 |
^ item |
|
277 |
! |
|
278 |
||
5010 | 279 |
item:anItem |
3892 | 280 |
|
5010 | 281 |
item := anItem. |
3892 | 282 |
^ true |
283 |
! |
|
284 |
||
285 |
presentation |
|
286 |
||
287 |
^ nil |
|
288 |
! |
|
289 |
||
290 |
type |
|
291 |
||
292 |
^ type |
|
293 |
! |
|
294 |
||
295 |
type:aType |
|
296 |
||
297 |
type := aType |
|
298 |
! |
|
299 |
||
300 |
wantChangeAnyWay |
|
301 |
||
302 |
^ (self type == #directoryDescription) |
|
303 |
! ! |
|
304 |
||
5604 | 305 |
!AbstractFileApplicationNoteBookComponent methodsFor:'resources'! |
306 |
||
307 |
resources |
|
308 |
masterApplication notNil ifTrue:[ |
|
309 |
^ masterApplication resources |
|
310 |
]. |
|
311 |
^ super resources |
|
312 |
! ! |
|
313 |
||
3892 | 314 |
!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'! |
315 |
||
316 |
version |
|
8387 | 317 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileApplicationNoteBookComponent.st,v 1.20 2008-10-30 15:51:37 cg Exp $' |
3892 | 318 |
! ! |