author | Claus Gittinger <cg@exept.de> |
Fri, 14 Oct 2005 00:26:20 +0200 | |
changeset 6399 | acaf5e4ada07 |
parent 6006 | 6bc518b7aa2f |
child 6461 | 7d0b624dc991 |
permissions | -rw-r--r-- |
5591 | 1 |
" |
2 |
COPYRIGHT (c) 2000 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 |
||
5592 | 13 |
"{ Package: 'stx:libtool' }" |
5591 | 14 |
|
15 |
"{ NameSpace: Tools }" |
|
16 |
||
17 |
Object subclass:#NavigationState |
|
18 |
instanceVariableNames:'browserLabel codeModifiedHolder categoryList classList |
|
19 |
packageFilter nameSpaceFilter hidePrivateClasses canvasType |
|
20 |
notMetaToggle metaToggle metaToggleLabel organizerMode codeAspect |
|
21 |
codeHolder classDocumentationHolder canvas selectorListGenerator |
|
22 |
protocolListGenerator classListPerNameSpaceGenerator |
|
23 |
classListGenerator categoryListGenerator nameSpaceListGenerator |
|
24 |
projectListGenerator classHierarchyTopClass meta selectedMethods |
|
25 |
selectedProtocols selectedClasses selectedCategories |
|
26 |
selectedProjects selectedNamespaces variableFilter |
|
27 |
filterClassVars sortBy noAllItem autoSearchPattern |
|
28 |
autoSearchIgnoreCase autoSearchAction realModifiedState |
|
29 |
methodInfo versionDiffApplication selectorListGeneratorArray |
|
30 |
selectedMethodsArray infoLabelHolder packageLabelHolder |
|
31 |
cursorLineLabelHolder cursorColLabelHolder modeLabelHolder |
|
32 |
sortVariablesBy' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
category:'Interface-Browsers-New' |
|
36 |
! |
|
37 |
||
38 |
!NavigationState class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
42 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
43 |
All Rights Reserved |
|
44 |
||
45 |
This software is furnished under a license and may be used |
|
46 |
only in accordance with the terms of that license and with the |
|
47 |
inclusion of the above copyright notice. This software may not |
|
48 |
be provided or otherwise made available to, or used by, any |
|
49 |
other person. No title to or ownership of the software is |
|
50 |
hereby transferred. |
|
51 |
" |
|
52 |
! ! |
|
53 |
||
54 |
!NavigationState methodsFor:'accessing'! |
|
55 |
||
56 |
autoSearchAction |
|
57 |
^ autoSearchAction |
|
58 |
! |
|
59 |
||
60 |
autoSearchAction:something |
|
61 |
autoSearchAction := something. |
|
62 |
! |
|
63 |
||
64 |
autoSearchIgnoreCase |
|
65 |
"return true if the autSearch is to be case-insensitive" |
|
66 |
||
67 |
^ autoSearchIgnoreCase |
|
68 |
! |
|
69 |
||
70 |
autoSearchIgnoreCase:aBoolean |
|
71 |
"change the autSearches case-insensitivenes" |
|
72 |
||
73 |
autoSearchIgnoreCase := aBoolean |
|
74 |
! |
|
75 |
||
76 |
autoSearchPattern |
|
77 |
"return the automatic search pattern" |
|
78 |
||
79 |
^ autoSearchPattern |
|
80 |
! |
|
81 |
||
82 |
autoSearchPattern:aPattern |
|
83 |
"change the automatic search pattern" |
|
84 |
||
85 |
autoSearchPattern := aPattern. |
|
86 |
! |
|
87 |
||
88 |
browserLabel |
|
89 |
"return the assigned state-label (to be shown in the tab)." |
|
90 |
||
91 |
^ browserLabel |
|
92 |
! |
|
93 |
||
94 |
browserLabel:aString |
|
95 |
"set the assigned state-label (to be shown in the tab)." |
|
96 |
||
97 |
browserLabel := aString |
|
98 |
! |
|
99 |
||
100 |
canvas |
|
101 |
"return the value of the instance variable 'canvas' (automatically generated)" |
|
102 |
||
103 |
^ canvas |
|
104 |
! |
|
105 |
||
106 |
canvas:something |
|
107 |
"set the value of the instance variable 'canvas' (automatically generated)" |
|
108 |
||
109 |
canvas := something. |
|
110 |
canvasType isNil ifTrue:[ |
|
111 |
canvasType := something spec |
|
112 |
]. |
|
113 |
! |
|
114 |
||
115 |
canvasType |
|
116 |
"return the type of canvas" |
|
117 |
||
118 |
^ canvasType |
|
119 |
! |
|
120 |
||
121 |
canvasType:aSpecSymbol |
|
122 |
"set the type of canvas" |
|
123 |
||
124 |
canvasType notNil ifTrue:[ |
|
125 |
canvasType ~~ aSpecSymbol ifTrue:[ |
|
126 |
self halt:'cannot be changed, once set'. |
|
127 |
] |
|
128 |
]. |
|
129 |
canvasType := aSpecSymbol |
|
130 |
! |
|
131 |
||
132 |
codeAspect |
|
133 |
"return the codeAspect; a symbol describing what is shown in the codeView" |
|
134 |
||
135 |
^ codeAspect |
|
136 |
||
137 |
"Created: / 11.2.2000 / 12:43:29 / cg" |
|
138 |
! |
|
139 |
||
140 |
codeAspect:aSymbolOrNil |
|
141 |
"set the codeAspect; a symbol describing what is shown in the codeView" |
|
142 |
||
143 |
codeAspect := aSymbolOrNil |
|
144 |
||
145 |
"Created: / 11.2.2000 / 12:43:45 / cg" |
|
146 |
! |
|
147 |
||
148 |
codeView |
|
149 |
|builder v| |
|
150 |
||
151 |
canvas notNil ifTrue:[ |
|
6399 | 152 |
builder := canvas builder. |
153 |
builder notNil ifTrue:[ |
|
154 |
v := builder componentAt:#CodeView. |
|
155 |
v notNil ifTrue:[ |
|
156 |
^ v scrolledView |
|
157 |
]. |
|
158 |
] |
|
5591 | 159 |
]. |
160 |
^ nil |
|
161 |
||
162 |
"Created: / 11.2.2000 / 13:28:25 / cg" |
|
163 |
! |
|
164 |
||
165 |
environment |
|
166 |
^ Smalltalk |
|
167 |
! |
|
168 |
||
169 |
modified |
|
170 |
"check for modified code by asking the editTextView; |
|
171 |
this one returns true if ever modified - even if |
|
172 |
the modifiecations where undone in the editor |
|
173 |
(i.e. not really modified). |
|
174 |
Use #reallyModified if the contents should be compared |
|
175 |
against the original contents" |
|
176 |
||
177 |
|codeView| |
|
178 |
||
179 |
realModifiedState == true ifTrue:[^ true]. |
|
180 |
^ (codeView := self codeView) notNil |
|
181 |
and:[codeView modified] |
|
182 |
! |
|
183 |
||
184 |
modified:aBoolean |
|
185 |
|codeView| |
|
186 |
||
187 |
(codeView := self codeView) notNil ifTrue:[ |
|
188 |
codeView modified:aBoolean |
|
189 |
]. |
|
190 |
! |
|
191 |
||
192 |
realModifiedState |
|
193 |
^ realModifiedState |
|
194 |
! |
|
195 |
||
196 |
realModifiedState:aBoolean |
|
197 |
realModifiedState := aBoolean |
|
198 |
! ! |
|
199 |
||
200 |
!NavigationState methodsFor:'accessing-selection'! |
|
201 |
||
202 |
theSingleSelectedClass |
|
203 |
"if only one class is selected, return it. |
|
204 |
Otherwise, return nil" |
|
205 |
||
206 |
|classes| |
|
207 |
||
208 |
classes := self selectedClasses value. |
|
209 |
classes size == 1 ifTrue:[ |
|
210 |
^ classes first |
|
211 |
]. |
|
212 |
^ nil |
|
213 |
! |
|
214 |
||
215 |
theSingleSelectedMethod |
|
216 |
"if only one method is selected, return it. |
|
217 |
Otherwise, return nil" |
|
218 |
||
219 |
|methods| |
|
220 |
||
221 |
methods := self selectedMethods value. |
|
222 |
methods size == 1 ifTrue:[ |
|
223 |
^ methods first |
|
224 |
]. |
|
225 |
^ nil |
|
226 |
! ! |
|
227 |
||
228 |
!NavigationState methodsFor:'accessing-subApps'! |
|
229 |
||
230 |
applicationOfComponent:aComponentName |
|
231 |
^ self applicationOfComponent:aComponentName or:nil |
|
232 |
||
233 |
! |
|
234 |
||
235 |
applicationOfComponent:aComponentName or:anotherComponentName |
|
236 |
|builder view| |
|
237 |
||
238 |
builder := canvas builder. |
|
5906
9ff3d80263f5
use findVisibleComponentAt: when searching for listViews by name.
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
239 |
|
9ff3d80263f5
use findVisibleComponentAt: when searching for listViews by name.
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
240 |
view := builder findVisibleComponentAt:aComponentName. |
5591 | 241 |
(view isNil and:[anotherComponentName notNil]) ifTrue:[ |
5906
9ff3d80263f5
use findVisibleComponentAt: when searching for listViews by name.
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
242 |
view := builder findVisibleComponentAt:anotherComponentName. |
5591 | 243 |
]. |
5906
9ff3d80263f5
use findVisibleComponentAt: when searching for listViews by name.
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
244 |
|
5591 | 245 |
view notNil ifTrue:[ |
5906
9ff3d80263f5
use findVisibleComponentAt: when searching for listViews by name.
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
246 |
^ view application |
5591 | 247 |
]. |
248 |
^ nil |
|
249 |
! |
|
250 |
||
251 |
classCategoryListApplication |
|
252 |
^ self applicationOfComponent:#ClassCategoryList |
|
253 |
||
254 |
! |
|
255 |
||
256 |
classListApplication |
|
257 |
^ self applicationOfComponent:#ClassList |
|
258 |
||
259 |
! |
|
260 |
||
261 |
metaToggleComponent |
|
262 |
^ canvas builder findComponentAt:#ClassToggle. |
|
263 |
! |
|
264 |
||
265 |
methodCategoryListApplication |
|
266 |
^ self applicationOfComponent:#MethodCategoryList |
|
267 |
! |
|
268 |
||
269 |
methodListApplication |
|
270 |
^ self applicationOfComponent:#MethodList |
|
271 |
! |
|
272 |
||
273 |
nameSpaceListApplication |
|
274 |
^ self applicationOfComponent:#NamespaceList or:#PseudoNamespaceList |
|
275 |
! |
|
276 |
||
277 |
projectListApplication |
|
278 |
^ self applicationOfComponent:#ProjectList or:#PseudoProjectList |
|
279 |
! |
|
280 |
||
281 |
variableListApplication |
|
282 |
^ self applicationOfComponent:#VariableList |
|
283 |
! |
|
284 |
||
285 |
versionDiffApplication |
|
286 |
^ versionDiffApplication |
|
287 |
||
288 |
! |
|
289 |
||
290 |
versionDiffApplication:anApplication |
|
291 |
versionDiffApplication := anApplication |
|
292 |
||
293 |
! ! |
|
294 |
||
295 |
!NavigationState methodsFor:'aspects'! |
|
296 |
||
297 |
categoryList |
|
298 |
categoryList isNil ifTrue:[ |
|
299 |
categoryList := nil asValue. |
|
300 |
]. |
|
301 |
^ categoryList |
|
302 |
||
303 |
"Modified: / 25.2.2000 / 01:35:42 / cg" |
|
304 |
"Created: / 25.2.2000 / 01:57:45 / cg" |
|
305 |
! |
|
306 |
||
307 |
categoryListGenerator |
|
308 |
categoryListGenerator isNil ifTrue:[ |
|
309 |
categoryListGenerator := nil asValue. |
|
310 |
]. |
|
311 |
^ categoryListGenerator |
|
312 |
||
313 |
"Created: / 25.2.2000 / 01:34:30 / cg" |
|
314 |
"Modified: / 25.2.2000 / 01:35:42 / cg" |
|
315 |
! |
|
316 |
||
317 |
classDocumentationHolder |
|
318 |
classDocumentationHolder isNil ifTrue:[ |
|
319 |
classDocumentationHolder := nil asValue. |
|
320 |
]. |
|
321 |
^ classDocumentationHolder |
|
322 |
! |
|
323 |
||
324 |
classHierarchyTopClass |
|
325 |
classHierarchyTopClass isNil ifTrue:[ |
|
326 |
classHierarchyTopClass := nil asValue. |
|
327 |
]. |
|
328 |
^ classHierarchyTopClass |
|
329 |
||
330 |
! |
|
331 |
||
332 |
classList |
|
333 |
classList isNil ifTrue:[ |
|
334 |
classList := nil asValue. |
|
335 |
]. |
|
336 |
^ classList |
|
337 |
||
338 |
"Created: / 25.2.2000 / 01:57:28 / cg" |
|
339 |
! |
|
340 |
||
341 |
classListGenerator |
|
342 |
classListGenerator isNil ifTrue:[ |
|
343 |
classListGenerator := nil asValue. |
|
344 |
]. |
|
345 |
^ classListGenerator |
|
346 |
||
347 |
||
348 |
! |
|
349 |
||
350 |
classListPerNameSpaceGenerator |
|
351 |
classListPerNameSpaceGenerator isNil ifTrue:[ |
|
352 |
classListPerNameSpaceGenerator := nil asValue. |
|
353 |
]. |
|
354 |
^ classListPerNameSpaceGenerator |
|
355 |
||
356 |
"Created: / 18.8.2000 / 14:15:34 / cg" |
|
357 |
! |
|
358 |
||
359 |
codeHolder |
|
360 |
codeHolder isNil ifTrue:[ |
|
361 |
codeHolder := nil asValue. |
|
362 |
]. |
|
363 |
^ codeHolder |
|
364 |
||
365 |
! |
|
366 |
||
367 |
codeModifiedHolder |
|
368 |
codeModifiedHolder isNil ifTrue:[ |
|
369 |
codeModifiedHolder := false asValue. |
|
370 |
]. |
|
371 |
^ codeModifiedHolder |
|
372 |
! |
|
373 |
||
374 |
cursorColLabelHolder |
|
375 |
cursorColLabelHolder isNil ifTrue:[ |
|
6399 | 376 |
"/ self codeView isNil ifTrue:[^ nil]. |
377 |
||
378 |
cursorColLabelHolder := BlockValue |
|
379 |
with:[:v | v printString] |
|
380 |
argument:self codeView cursorColHolder. |
|
5591 | 381 |
]. |
382 |
^ cursorColLabelHolder |
|
383 |
! |
|
384 |
||
385 |
cursorLineLabelHolder |
|
386 |
cursorLineLabelHolder isNil ifTrue:[ |
|
6399 | 387 |
"/ self codeView isNil ifTrue:[^ nil]. |
388 |
||
389 |
cursorLineLabelHolder := BlockValue |
|
390 |
with:[:v | v printString] |
|
391 |
argument:self codeView cursorLineHolder. |
|
5591 | 392 |
]. |
393 |
^ cursorLineLabelHolder |
|
394 |
! |
|
395 |
||
396 |
filterClassVars |
|
397 |
filterClassVars isNil ifTrue:[ |
|
398 |
filterClassVars := false asValue. |
|
399 |
]. |
|
400 |
^ filterClassVars |
|
401 |
||
402 |
"Created: / 24.2.2000 / 23:45:28 / cg" |
|
403 |
! |
|
404 |
||
405 |
hidePrivateClasses |
|
406 |
hidePrivateClasses isNil ifTrue:[ |
|
407 |
hidePrivateClasses := false asValue. |
|
408 |
]. |
|
409 |
^ hidePrivateClasses |
|
410 |
||
411 |
"Created: / 24.2.2000 / 16:17:02 / cg" |
|
412 |
! |
|
413 |
||
414 |
infoLabelHolder |
|
415 |
infoLabelHolder isNil ifTrue:[ |
|
416 |
infoLabelHolder := '' asValue. |
|
417 |
]. |
|
418 |
^ infoLabelHolder |
|
419 |
! |
|
420 |
||
421 |
meta |
|
422 |
meta isNil ifTrue:[ |
|
423 |
meta := false asValue. |
|
424 |
]. |
|
425 |
^ meta |
|
426 |
||
427 |
||
428 |
! |
|
429 |
||
430 |
metaToggleLabelHolder |
|
431 |
metaToggleLabel isNil ifTrue:[ |
|
432 |
metaToggleLabel := 'Class' asValue. |
|
433 |
]. |
|
434 |
^ metaToggleLabel |
|
435 |
! |
|
436 |
||
437 |
methodInfo |
|
438 |
methodInfo isNil ifTrue:[ |
|
439 |
methodInfo := nil asValue. |
|
440 |
]. |
|
441 |
^ methodInfo |
|
442 |
||
443 |
! |
|
444 |
||
445 |
methodList |
|
446 |
|methodListApplication| |
|
447 |
||
448 |
methodListApplication := self methodListApplication. |
|
449 |
methodListApplication isNil ifTrue:[^ nil]. |
|
450 |
||
451 |
^ methodListApplication methodList |
|
452 |
! |
|
453 |
||
454 |
modeLabelHolder |
|
455 |
modeLabelHolder isNil ifTrue:[ |
|
456 |
modeLabelHolder := self codeView modeLabelHolder. |
|
457 |
]. |
|
458 |
^ modeLabelHolder |
|
459 |
! |
|
460 |
||
461 |
nameSpaceFilter |
|
462 |
nameSpaceFilter isNil ifTrue:[ |
|
463 |
nameSpaceFilter := nil asValue. |
|
464 |
]. |
|
465 |
^ nameSpaceFilter |
|
466 |
||
467 |
"Created: / 18.8.2000 / 14:25:24 / cg" |
|
468 |
! |
|
469 |
||
470 |
nameSpaceListGenerator |
|
471 |
nameSpaceListGenerator isNil ifTrue:[ |
|
472 |
nameSpaceListGenerator := nil asValue. |
|
473 |
]. |
|
474 |
^ nameSpaceListGenerator |
|
475 |
||
476 |
"Created: / 18.8.2000 / 14:26:19 / cg" |
|
477 |
"Modified: / 18.8.2000 / 14:27:59 / cg" |
|
478 |
! |
|
479 |
||
480 |
noAllItem |
|
481 |
noAllItem isNil ifTrue:[ |
|
482 |
noAllItem := nil asValue. |
|
483 |
]. |
|
484 |
^ noAllItem |
|
485 |
! |
|
486 |
||
487 |
organizerMode |
|
488 |
"return the organizerMode holder; |
|
489 |
holding a symbol describing how things are organized |
|
490 |
(#category, #hierarchy, #project or #namespace)" |
|
491 |
||
492 |
organizerMode isNil ifTrue:[ |
|
493 |
organizerMode := #category asValue. |
|
494 |
]. |
|
495 |
^ organizerMode |
|
496 |
||
497 |
"Created: / 18.2.2000 / 13:33:55 / cg" |
|
498 |
"Modified: / 18.8.2000 / 18:37:22 / cg" |
|
499 |
! |
|
500 |
||
501 |
packageFilter |
|
502 |
packageFilter isNil ifTrue:[ |
|
503 |
packageFilter := nil asValue. |
|
504 |
]. |
|
505 |
^ packageFilter |
|
506 |
||
507 |
"Created: / 24.2.2000 / 23:45:28 / cg" |
|
508 |
! |
|
509 |
||
510 |
packageLabelHolder |
|
511 |
packageLabelHolder isNil ifTrue:[ |
|
512 |
packageLabelHolder := '' asValue. |
|
513 |
]. |
|
514 |
^ packageLabelHolder |
|
515 |
! |
|
516 |
||
517 |
projectListGenerator |
|
518 |
projectListGenerator isNil ifTrue:[ |
|
519 |
projectListGenerator := nil asValue. |
|
520 |
]. |
|
521 |
^ projectListGenerator |
|
522 |
||
523 |
"Modified: / 25.2.2000 / 01:35:42 / cg" |
|
524 |
"Created: / 25.2.2000 / 02:43:26 / cg" |
|
525 |
! |
|
526 |
||
527 |
protocolListGenerator |
|
528 |
protocolListGenerator isNil ifTrue:[ |
|
529 |
protocolListGenerator := nil asValue. |
|
530 |
]. |
|
531 |
^ protocolListGenerator |
|
532 |
||
533 |
! |
|
534 |
||
535 |
selectedCategories |
|
536 |
selectedCategories isNil ifTrue:[ |
|
537 |
selectedCategories := nil asValue. |
|
538 |
]. |
|
539 |
^ selectedCategories |
|
540 |
||
541 |
! |
|
542 |
||
543 |
selectedClasses |
|
544 |
selectedClasses isNil ifTrue:[ |
|
545 |
selectedClasses := "SpecialValueHolder with:nil." nil asValue. |
|
546 |
]. |
|
547 |
^ selectedClasses |
|
548 |
! |
|
549 |
||
550 |
selectedMethods |
|
551 |
selectedMethods isNil ifTrue:[ |
|
552 |
selectedMethods := nil asValue. |
|
553 |
]. |
|
554 |
^ selectedMethods |
|
555 |
||
556 |
! |
|
557 |
||
558 |
selectedMethodsArrayAt:index |
|
559 |
|holder| |
|
560 |
||
561 |
selectedMethodsArray isNil ifTrue:[ |
|
562 |
selectedMethodsArray := OrderedCollection new |
|
563 |
]. |
|
564 |
index > selectedMethodsArray size ifTrue:[ |
|
565 |
selectedMethodsArray grow:index |
|
566 |
]. |
|
567 |
holder := selectedMethodsArray at:index. |
|
568 |
holder isNil ifTrue:[ |
|
569 |
selectedMethodsArray at:index put:(holder := ValueHolder new) |
|
570 |
]. |
|
571 |
^ holder. |
|
572 |
! |
|
573 |
||
574 |
selectedNamespaces |
|
575 |
selectedNamespaces isNil ifTrue:[ |
|
576 |
selectedNamespaces := nil asValue. |
|
577 |
]. |
|
578 |
^ selectedNamespaces |
|
579 |
||
580 |
! |
|
581 |
||
582 |
selectedProjects |
|
583 |
selectedProjects isNil ifTrue:[ |
|
584 |
selectedProjects := nil asValue. |
|
585 |
]. |
|
586 |
^ selectedProjects |
|
587 |
||
588 |
! |
|
589 |
||
590 |
selectedProtocols |
|
591 |
selectedProtocols isNil ifTrue:[ |
|
592 |
selectedProtocols := nil asValue. |
|
593 |
]. |
|
594 |
^ selectedProtocols |
|
595 |
||
596 |
! |
|
597 |
||
598 |
selectorListGenerator |
|
599 |
selectorListGenerator isNil ifTrue:[ |
|
600 |
selectorListGenerator := nil asValue. |
|
601 |
]. |
|
602 |
^ selectorListGenerator |
|
603 |
||
604 |
! |
|
605 |
||
606 |
selectorListGeneratorArray |
|
607 |
self halt:'should not be invoked'. |
|
608 |
! |
|
609 |
||
610 |
selectorListGeneratorArrayAt:index |
|
611 |
|holder| |
|
612 |
||
613 |
selectorListGeneratorArray isNil ifTrue:[ |
|
614 |
selectorListGeneratorArray := OrderedCollection new |
|
615 |
]. |
|
616 |
index > selectorListGeneratorArray size ifTrue:[ |
|
617 |
selectorListGeneratorArray grow:index |
|
618 |
]. |
|
619 |
holder := selectorListGeneratorArray at:index. |
|
620 |
holder isNil ifTrue:[ |
|
621 |
selectorListGeneratorArray at:index put:(holder := ValueHolder new) |
|
622 |
]. |
|
623 |
^ holder. |
|
624 |
! |
|
625 |
||
626 |
sortBy |
|
627 |
sortBy isNil ifTrue:[ |
|
628 |
sortBy := nil asValue. |
|
629 |
]. |
|
630 |
^ sortBy |
|
631 |
! |
|
632 |
||
633 |
variableFilter |
|
634 |
variableFilter isNil ifTrue:[ |
|
635 |
variableFilter := nil asValue. |
|
636 |
]. |
|
637 |
^ variableFilter |
|
638 |
||
639 |
"Created: / 24.2.2000 / 23:45:28 / cg" |
|
640 |
! ! |
|
641 |
||
642 |
!NavigationState methodsFor:'aspects-kludges'! |
|
643 |
||
644 |
metaToggle |
|
645 |
metaToggle isNil ifTrue:[ |
|
646 |
metaToggle := PluggableAdaptor on:(self meta). |
|
647 |
metaToggle |
|
648 |
getBlock:[:m | m value == true] |
|
649 |
putBlock:[:m :newValue | m value:(newValue ? false)] |
|
650 |
updateBlock:[:m :aspect :param | true]. |
|
651 |
]. |
|
652 |
^ metaToggle |
|
653 |
! |
|
654 |
||
655 |
notMetaToggle |
|
656 |
notMetaToggle isNil ifTrue:[ |
|
657 |
notMetaToggle := PluggableAdaptor on:(self meta). |
|
658 |
notMetaToggle |
|
659 |
getBlock:[:m | m value == false] |
|
660 |
putBlock:[:m :newValue | m value:(newValue ? false) not] |
|
661 |
updateBlock:[:m :aspect :param | true]. |
|
662 |
]. |
|
663 |
^ notMetaToggle |
|
664 |
! ! |
|
665 |
||
666 |
!NavigationState methodsFor:'printing & storing'! |
|
667 |
||
668 |
colorizeForModifiedBuffer:someString |
|
669 |
^ someString asText emphasisAllAdd:(UserPreferences current emphasisForModifiedBuffer) |
|
670 |
! |
|
671 |
||
672 |
nameString |
|
673 |
"a descriptive string of what this state shows" |
|
674 |
||
675 |
|s| |
|
676 |
||
677 |
s := self rawNameStringOrNil ? 'nothing selected'. |
|
678 |
||
679 |
(realModifiedState == true) ifTrue:[ |
|
680 |
^ self colorizeForModifiedBuffer:s string |
|
681 |
]. |
|
682 |
^ s |
|
683 |
! |
|
684 |
||
685 |
nameStringOrNil |
|
686 |
"a descriptive string of what this state shows" |
|
687 |
||
688 |
|s "codeView"| |
|
689 |
||
690 |
s := self rawNameStringOrNil. |
|
691 |
s notNil ifTrue:[ |
|
692 |
realModifiedState == true |
|
693 |
"/ ((codeView := self codeView) notNil |
|
694 |
"/ and:[codeView modified]) |
|
695 |
ifTrue:[ |
|
696 |
^ self colorizeForModifiedBuffer:s string |
|
697 |
]. |
|
698 |
]. |
|
699 |
^ s |
|
700 |
! |
|
701 |
||
702 |
rawNameStringForCategory |
|
703 |
|categories theCategory| |
|
704 |
||
705 |
categories := self selectedCategories value. |
|
706 |
categories size == 1 ifTrue:[ |
|
707 |
theCategory := categories first. |
|
708 |
theCategory notNil ifTrue:[ |
|
709 |
^ theCategory string, ' [Category]' |
|
710 |
]. |
|
711 |
]. |
|
712 |
^ nil |
|
713 |
||
714 |
"Created: / 18.8.2000 / 19:42:42 / cg" |
|
715 |
! |
|
716 |
||
717 |
rawNameStringForNameSpace |
|
718 |
|namespaces theNamespace nsName s| |
|
719 |
||
720 |
namespaces := self selectedNamespaces value. |
|
721 |
namespaces size == 1 ifTrue:[ |
|
722 |
theNamespace := namespaces first |
|
723 |
]. |
|
724 |
theNamespace notNil ifTrue:[ |
|
725 |
theNamespace isNameSpace ifTrue:[ |
|
726 |
nsName := theNamespace name |
|
727 |
] ifFalse:[ |
|
728 |
nsName := theNamespace |
|
729 |
]. |
|
730 |
s := nsName , ' [NameSpace]'. |
|
731 |
(self isNameSpaceBrowser or:[self isNameSpaceFullBrowser]) ifTrue:[ |
|
732 |
^ LabelAndIcon icon:(NewSystemBrowser nameSpaceIcon) string:s. |
|
733 |
]. |
|
734 |
^ s |
|
735 |
]. |
|
736 |
^ nil |
|
737 |
||
738 |
"Created: / 18.8.2000 / 20:15:02 / cg" |
|
739 |
! |
|
740 |
||
741 |
rawNameStringForProject |
|
742 |
|projects theProject s| |
|
743 |
||
744 |
projects := self selectedProjects value. |
|
745 |
projects size == 1 ifTrue:[ |
|
746 |
theProject := projects first |
|
747 |
]. |
|
748 |
theProject notNil ifTrue:[ |
|
749 |
s := theProject , ' [Project]'. |
|
750 |
(self isProjectBrowser or:[self isProjectFullBrowser]) ifTrue:[ |
|
751 |
^ LabelAndIcon icon:(NewSystemBrowser packageIcon) string:s. |
|
752 |
]. |
|
753 |
^ s |
|
754 |
]. |
|
755 |
^ nil |
|
756 |
||
757 |
"Created: / 18.8.2000 / 20:18:34 / cg" |
|
758 |
! |
|
759 |
||
760 |
rawNameStringOrNil |
|
761 |
"a descriptive string of what this state shows; nil, if nothing is selected" |
|
762 |
||
763 |
^ self rawNameStringOrNilWantShort:false |
|
764 |
! |
|
765 |
||
766 |
rawNameStringOrNilWantShort:shortName |
|
767 |
"a descriptive string of what this state shows; nil, if nothing is selected" |
|
768 |
||
769 |
|lbl nr numClasses numMethods numCategories cats classes theClass |
|
770 |
"protocols theProtocol" |
|
771 |
methods theSingleMethod projects theProject longName nm methodName suffix cls| |
|
772 |
||
773 |
browserLabel notNil ifTrue:[ |
|
774 |
"/ add the number of selected methods |
|
775 |
((canvasType == #singleFullProtocolBrowserSpec) |
|
776 |
or:[canvasType == #methodListBrowserSpec]) ifTrue:[ |
|
777 |
nr := self selectedMethods value size. |
|
778 |
nr > 5 ifTrue:[ |
|
779 |
^ browserLabel string , ' - ' , nr printString , ' methods' |
|
780 |
]. |
|
781 |
]. |
|
782 |
^ browserLabel |
|
783 |
]. |
|
784 |
||
785 |
suffix := ''. |
|
786 |
||
787 |
self isProtocolOrFullProtocolBrowser ifTrue:[ |
|
788 |
lbl := self rawNameStringForProject. |
|
789 |
lbl notNil ifTrue:[^ lbl]. |
|
790 |
suffix := ' [Protocol]'. |
|
791 |
]. |
|
792 |
||
793 |
self isCategoryBrowser ifTrue:[ |
|
794 |
lbl := self rawNameStringForCategory. |
|
795 |
lbl notNil ifTrue:[^ lbl]. |
|
796 |
suffix := ' [Category]'. |
|
797 |
]. |
|
798 |
||
799 |
self isNameSpaceBrowser ifTrue:[ |
|
800 |
lbl := self rawNameStringForNameSpace. |
|
801 |
lbl notNil ifTrue:[^ lbl]. |
|
802 |
suffix := ' [NameSpace]'. |
|
803 |
]. |
|
804 |
||
805 |
self isProjectBrowser ifTrue:[ |
|
806 |
projects := self selectedProjects value. |
|
807 |
projects size == 1 ifTrue:[ |
|
808 |
theProject := projects first |
|
809 |
]. |
|
810 |
suffix := ' [Project]'. |
|
811 |
theProject notNil ifTrue:[ |
|
812 |
^ theProject , suffix |
|
813 |
] |
|
814 |
]. |
|
815 |
||
816 |
classes := self selectedClasses value. |
|
817 |
classes size == 1 ifTrue:[ |
|
818 |
theClass := classes first. |
|
819 |
theClass notNil ifTrue:[ |
|
820 |
theClass := theClass theNonMetaclass |
|
821 |
] |
|
822 |
]. |
|
823 |
||
824 |
self isClassBrowser ifTrue:[ |
|
825 |
suffix := ' [Class]'. |
|
826 |
theClass notNil ifTrue:[ |
|
827 |
^ theClass name , suffix |
|
828 |
] |
|
829 |
]. |
|
830 |
||
831 |
"/ protocols := self selectedProtocols value. |
|
832 |
"/ protocols size == 1 ifTrue:[ |
|
833 |
"/ theProtocol := protocols first |
|
834 |
"/ ]. |
|
835 |
||
836 |
methods := self selectedMethods value. |
|
837 |
methods size == 1 ifTrue:[ |
|
838 |
theSingleMethod := methods first |
|
839 |
]. |
|
840 |
||
841 |
theSingleMethod notNil ifTrue:[ |
|
842 |
methodName := theSingleMethod selector. |
|
843 |
theSingleMethod isJavaMethod ifTrue:[ |
|
844 |
methodName := theSingleMethod printStringForBrowserWithSelector:methodName. |
|
845 |
]. |
|
846 |
]. |
|
847 |
||
848 |
self isMethodBrowser ifTrue:[ |
|
849 |
suffix := ' [Selector]'. |
|
850 |
||
851 |
theSingleMethod notNil ifTrue:[ |
|
852 |
theSingleMethod mclass isNil ifTrue:[ |
|
853 |
^ '???' |
|
854 |
]. |
|
855 |
^ theSingleMethod mclass name , ' ' , methodName , suffix |
|
856 |
] |
|
857 |
]. |
|
858 |
||
859 |
self isCategoryBrowser ifTrue:[ |
|
860 |
suffix := ' [Category]'. |
|
861 |
] ifFalse:[ |
|
862 |
self isFullClassSourceBrowser ifTrue:[ |
|
863 |
suffix := ' [Full]'. |
|
864 |
] ifFalse:[ |
|
865 |
self isClassDocumentationBrowser ifTrue:[ |
|
866 |
suffix := ' [Doc]'. |
|
867 |
] ifFalse:[ |
|
868 |
self isProjectBrowser ifTrue:[ |
|
869 |
suffix := ' [Project]'. |
|
870 |
] |
|
871 |
] |
|
872 |
] |
|
873 |
]. |
|
874 |
||
875 |
nm := nil. |
|
876 |
(numClasses := classes size) > 0 ifTrue:[ |
|
877 |
numClasses > 1 ifTrue:[ |
|
878 |
methods size > 0 ifTrue:[ |
|
879 |
theSingleMethod notNil ifTrue:[ |
|
880 |
cls := theSingleMethod mclass. |
|
881 |
cls isNil ifTrue:[ |
|
882 |
"/ oops - unbound |
|
883 |
nm := '???' |
|
884 |
] ifFalse:[ |
|
885 |
longName := nm := cls nameInBrowser. |
|
886 |
shortName ifTrue:[ |
|
887 |
nm := cls nameWithoutPrefix. |
|
888 |
cls isPrivate ifTrue:[ |
|
889 |
nm := ':' , nm |
|
890 |
] |
|
891 |
]. |
|
892 |
]. |
|
893 |
nm := nm , ' ', (methodName ? '???') |
|
894 |
] ifFalse:[ |
|
895 |
nm := methods size printString , ' methods'. |
|
896 |
numClasses := (methods collect:[:each | each mclass]) asIdentitySet size. |
|
897 |
numClasses > 1 ifTrue:[ |
|
898 |
nm := nm , ' in ' , numClasses printString , ' classes'. |
|
899 |
]. |
|
900 |
]. |
|
901 |
^ nm , suffix. |
|
902 |
]. |
|
903 |
||
904 |
nm := numClasses printString , ' classes in '. |
|
905 |
"/ cats := self selectedCategories value |
|
906 |
cats := (classes collect:[:each | each category]) asSet. |
|
907 |
(numCategories := cats size) == 1 ifTrue:[ |
|
908 |
nm := nm , cats first |
|
909 |
] ifFalse:[ |
|
910 |
nm := nm , numCategories printString , ' categories' |
|
911 |
] |
|
912 |
] ifFalse:[ |
|
913 |
cls := theClass theNonMetaclass. |
|
914 |
longName := nm := cls nameInBrowser. |
|
915 |
shortName ifTrue:[ |
|
916 |
nm := cls nameWithoutPrefix. |
|
917 |
cls isPrivate ifTrue:[ |
|
918 |
nm := ':' , nm |
|
919 |
] |
|
920 |
]. |
|
921 |
methods := self selectedMethods value. |
|
922 |
(numMethods := methods size) > 0 ifTrue:[ |
|
923 |
numMethods == 1 ifTrue:[ |
|
924 |
theSingleMethod := methods first. |
|
925 |
nm := nm , ' ', (methodName ? '???') |
|
926 |
] ifFalse:[ |
|
927 |
nm := numMethods printString , ' methods in ' , nm |
|
928 |
] |
|
929 |
] |
|
930 |
] |
|
931 |
] ifFalse:[ |
|
932 |
(self isNameSpaceBrowser |
|
933 |
or:[self isNameSpaceFullBrowser |
|
934 |
or:[organizerMode value == #namespace]]) ifTrue:[ |
|
935 |
lbl := self rawNameStringForNameSpace. |
|
936 |
lbl notNil ifTrue:[^ lbl]. |
|
937 |
suffix := ' [NameSpace]'. |
|
938 |
] ifFalse:[ |
|
939 |
(self isProjectBrowser |
|
940 |
or:[self isProjectFullBrowser |
|
941 |
or:[organizerMode value == #project]]) ifTrue:[ |
|
942 |
lbl := self rawNameStringForProject. |
|
943 |
lbl notNil ifTrue:[^ lbl]. |
|
944 |
suffix := ' [Project]'. |
|
945 |
] ifFalse:[ |
|
946 |
cats := self selectedCategories value. |
|
947 |
cats size == 1 ifTrue:[ |
|
948 |
nm := cats first string |
|
949 |
] |
|
950 |
] |
|
951 |
]. |
|
952 |
]. |
|
953 |
nm isNil ifTrue:[ ^ nil ]. |
|
954 |
^ nm , suffix. |
|
955 |
||
956 |
"Created: / 11.2.2000 / 13:32:16 / cg" |
|
957 |
"Modified: / 18.8.2000 / 21:06:35 / cg" |
|
958 |
! |
|
959 |
||
960 |
shortNameString |
|
961 |
"a descriptive string of what this state shows" |
|
962 |
||
963 |
|s| |
|
964 |
||
965 |
s := (self rawNameStringOrNilWantShort:true) ? 'nothing selected'. |
|
966 |
||
967 |
(realModifiedState == true) ifTrue:[ |
|
968 |
^ self colorizeForModifiedBuffer:s string |
|
969 |
]. |
|
970 |
^ s |
|
971 |
! ! |
|
972 |
||
973 |
!NavigationState methodsFor:'queries'! |
|
974 |
||
975 |
isCategoryBrowser |
|
976 |
^ canvasType == #categoryBrowserSpec |
|
977 |
or:[ canvasType == #singleCategoryBrowserSpec |
|
978 |
or:[ canvasType == #multipleCategoryBrowserSpec ]] |
|
979 |
||
980 |
"Modified: / 25.2.2000 / 01:17:02 / cg" |
|
981 |
! |
|
982 |
||
983 |
isChainBrowser |
|
984 |
^ canvasType == #chainBrowserSpec |
|
985 |
! |
|
986 |
||
987 |
isCheckOutputBrowser |
|
988 |
^ canvasType == #multipleClassWithInfoAndMethodWithInfoBrowserSpec |
|
989 |
or:[canvasType == #multipleMethodWithInfoBrowserSpec |
|
990 |
or:[canvasType == #multipleClassWithInfoBrowserSpec]] |
|
991 |
! |
|
992 |
||
993 |
isClassBrowser |
|
994 |
^ canvasType == #classBrowserSpec |
|
995 |
or:[ canvasType == #singleClassBrowserSpec |
|
996 |
or:[ canvasType == #multipleClassBrowserSpec ]] |
|
997 |
||
998 |
"Modified: / 25.2.2000 / 00:38:07 / cg" |
|
999 |
! |
|
1000 |
||
1001 |
isClassDocumentationBrowser |
|
1002 |
^ canvasType == #classDocumentationBrowserSpec |
|
1003 |
||
1004 |
"Created: / 24.2.2000 / 14:54:40 / cg" |
|
1005 |
! |
|
1006 |
||
6006 | 1007 |
isClassExtensionBrowser |
1008 |
^ canvasType == #multipleClassExtensionBrowserSpec |
|
1009 |
||
1010 |
"Created: / 24.2.2000 / 14:54:40 / cg" |
|
1011 |
! |
|
1012 |
||
5591 | 1013 |
isFullBrowser |
1014 |
^ canvasType == #fullBrowserSpec |
|
1015 |
! |
|
1016 |
||
1017 |
isFullClassSourceBrowser |
|
1018 |
^ canvasType == #fullClassSourceBrowserSpec |
|
1019 |
||
1020 |
"Created: / 24.2.2000 / 14:54:40 / cg" |
|
1021 |
! |
|
1022 |
||
1023 |
isFullProtocolBrowser |
|
1024 |
^ canvasType == #singleFullProtocolBrowserSpec |
|
1025 |
or:[ canvasType == #multipleFullProtocolBrowserSpec ] |
|
1026 |
||
1027 |
"Created: / 24.2.2000 / 21:32:09 / cg" |
|
1028 |
"Modified: / 25.2.2000 / 03:11:00 / cg" |
|
1029 |
! |
|
1030 |
||
1031 |
isMethodBrowser |
|
1032 |
^ canvasType == #methodListBrowserSpec |
|
1033 |
or:[ canvasType == #singleMethodBrowserSpec |
|
1034 |
or:[ canvasType == #multipleMethodBrowserSpec |
|
1035 |
or:[ canvasType == #multipleMethodWithInfoBrowserSpec ]]] |
|
1036 |
||
1037 |
"Modified: / 1.3.2000 / 13:35:12 / cg" |
|
1038 |
! |
|
1039 |
||
1040 |
isMethodListBrowser |
|
1041 |
^ canvasType == #methodListBrowserSpec |
|
1042 |
or:[canvasType == #multipleMethodBrowserSpec] |
|
1043 |
! |
|
1044 |
||
1045 |
isNameSpaceBrowser |
|
1046 |
^ canvasType == #singleNameSpaceBrowserSpec |
|
1047 |
or:[ canvasType == #multipleNameSpaceBrowserSpec] |
|
1048 |
||
1049 |
"Modified: / 18.8.2000 / 16:12:34 / cg" |
|
1050 |
! |
|
1051 |
||
1052 |
isNameSpaceFullBrowser |
|
1053 |
^ canvasType == #singleNameSpaceFullBrowserSpec |
|
1054 |
or:[ canvasType == #multipleNameSpaceFullBrowserSpec ] |
|
1055 |
||
1056 |
"Created: / 18.8.2000 / 14:58:36 / cg" |
|
1057 |
! |
|
1058 |
||
1059 |
isProjectBrowser |
|
1060 |
^ canvasType == #singleProjectBrowserSpec |
|
1061 |
or:[ canvasType == #multipleProjectBrowserSpec ] |
|
1062 |
||
1063 |
"Created: / 24.2.2000 / 21:32:09 / cg" |
|
1064 |
"Modified: / 25.2.2000 / 03:11:00 / cg" |
|
1065 |
! |
|
1066 |
||
1067 |
isProjectFullBrowser |
|
1068 |
^ canvasType == #singleProjectFullBrowserSpec |
|
1069 |
or:[ canvasType == #multipleProjectFullBrowserSpec ] |
|
1070 |
||
1071 |
"Created: / 18.8.2000 / 19:02:49 / cg" |
|
1072 |
! |
|
1073 |
||
1074 |
isProtocolBrowser |
|
1075 |
^ canvasType == #singleProtocolBrowserSpec |
|
1076 |
or:[ canvasType == #multipleProtocolBrowserSpec ] |
|
1077 |
||
1078 |
"Created: / 24.2.2000 / 21:32:09 / cg" |
|
1079 |
"Modified: / 25.2.2000 / 03:11:00 / cg" |
|
1080 |
! |
|
1081 |
||
1082 |
isProtocolOrFullProtocolBrowser |
|
1083 |
^ self isProtocolBrowser |
|
1084 |
or:[ self isFullProtocolBrowser ] |
|
1085 |
! |
|
1086 |
||
1087 |
isSingleCategoryBrowser |
|
1088 |
^ canvasType == #singleCategoryBrowserSpec |
|
1089 |
! |
|
1090 |
||
1091 |
isSingleClassBrowser |
|
1092 |
^ canvasType == #singleClassBrowserSpec |
|
1093 |
! |
|
1094 |
||
1095 |
isSingleFullProtocolBrowser |
|
1096 |
^ canvasType == #singleFullProtocolBrowserSpec |
|
1097 |
! |
|
1098 |
||
1099 |
isSingleMethodBrowser |
|
1100 |
^ canvasType == #singleMethodBrowserSpec |
|
1101 |
||
1102 |
"Created: / 1.3.2000 / 13:35:52 / cg" |
|
1103 |
! |
|
1104 |
||
1105 |
isSingleNamespaceBrowser |
|
1106 |
^ canvasType == #singleNameSpaceBrowserSpec |
|
1107 |
! |
|
1108 |
||
1109 |
isSingleNamespaceFullBrowser |
|
1110 |
^ canvasType == #singleNameSpaceFullBrowserSpec |
|
1111 |
! |
|
1112 |
||
1113 |
isSingleProjectBrowser |
|
1114 |
^ canvasType == #singleProjectBrowserSpec |
|
1115 |
||
1116 |
"Created: / 24.2.2000 / 21:32:09 / cg" |
|
1117 |
"Modified: / 25.2.2000 / 03:11:00 / cg" |
|
1118 |
! |
|
1119 |
||
1120 |
isSingleProjectFullBrowser |
|
1121 |
^ canvasType == #singleProjectFullBrowserSpec |
|
1122 |
||
1123 |
"Created: / 24.2.2000 / 21:32:09 / cg" |
|
1124 |
"Modified: / 25.2.2000 / 03:11:00 / cg" |
|
1125 |
! |
|
1126 |
||
1127 |
isSingleProtocolBrowser |
|
1128 |
^ canvasType == #singleProtocolBrowserSpec |
|
1129 |
! |
|
1130 |
||
1131 |
isVersionDiffBrowser |
|
1132 |
^ canvasType == #multipleClassRepositoryDiffBrowserSpec |
|
1133 |
! ! |
|
1134 |
||
1135 |
!NavigationState class methodsFor:'documentation'! |
|
1136 |
||
1137 |
version |
|
6399 | 1138 |
^ '$Header: /cvs/stx/stx/libtool/Tools_NavigationState.st,v 1.5 2005-10-13 22:26:20 cg Exp $' |
5591 | 1139 |
! ! |