--- a/UIHelpTool.st Wed Jan 08 13:16:05 2003 +0100
+++ b/UIHelpTool.st Thu Jan 09 09:21:55 2003 +0100
@@ -28,7 +28,7 @@
!
HierarchicalItem subclass:#KeyItem
- instanceVariableNames:'helpKey helpText modified'
+ instanceVariableNames:'helpKey helpText modified icon'
classVariableNames:''
poolDictionaries:''
privateIn:UIHelpTool
@@ -705,40 +705,41 @@
list := OrderedCollection new.
(specClass isClass and:[specClass isLoaded]) ifTrue:[
- lastContents := nil.
- resource := specClass name, ' ', specSelector.
- self addToHistory:(Association key:resource value:#'loadFromMessage:').
+ lastContents := nil.
+ resource := specClass name, ' ', specSelector.
+ self addToHistory:(Association key:resource value:#'loadFromMessage:').
- specClass withAllSuperclasses reverse do:[:aClass| |value name|
- lastContents isNil ifTrue:[
- aClass == ApplicationModel ifTrue:[
- lastContents := IdentityDictionary new
- ].
- ] ifFalse:[
- root := ClassItem onClass:aClass.
+ specClass withAllSuperclasses reverse do:[:aClass| |value name|
+ lastContents isNil ifTrue:[
+ aClass == ApplicationModel ifTrue:[
+ lastContents := IdentityDictionary new
+ ].
+ ] ifFalse:[
+ root := ClassItem onClass:aClass.
- (aClass class includesSelector:specSelector) ifTrue:[
- value := aClass perform:specSelector.
+ (aClass class includesSelector:specSelector) ifTrue:[
+ value := aClass perform:specSelector.
- value keysAndValuesDo:[:k :v| |cval|
- cval := lastContents at:k ifAbsent:self.
- cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ].
- ].
- lastContents := value.
- ].
- root sort:[:a :b| a label < b label ].
- root modified:false.
- list add:root.
- ]
- ]
+ value keysAndValuesDo:[:k :v| |cval|
+ cval := lastContents at:k ifAbsent:self.
+ cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ].
+ ].
+ lastContents := value.
+ ].
+ root sort:[:a :b| a label < b label ].
+ root modified:false.
+ list add:root.
+ ]
+ ]
].
list isEmpty ifTrue:[
- list add:(ClassItem onClass:nil)
+ list add:(ClassItem onClass:nil)
].
self withoutModifyDo:[
- classItemList contents:list.
- classItemModel value:(list last)
+ classItemList contents:list.
+ self updateIcons.
+ classItemModel value:(list last)
].
!
@@ -956,6 +957,45 @@
^ true
].
^ false
+!
+
+updateIcons
+ "update all icons (redefinitions below above or both)
+ "
+ |iconBelow iconAbove iconAboveAndBelow isBehind redefinedAbove redefinedBelow icon|
+
+ "/ if only one class exists, its not possible to have redefinitions
+ classItemList size > 1 ifFalse:[ ^ self ].
+
+ iconBelow := SystemBrowser medium_methodRedefinedBelowIcon.
+ iconAbove := SystemBrowser medium_methodInheritedFromAboveIcon.
+ iconAboveAndBelow := SystemBrowser medium_methodInheritedFromAboveAndRedefinedBelowIcon.
+
+ classItemList do:[:runClass|
+ runClass do:[:aKeyItem|
+ isBehind := redefinedBelow := redefinedAbove := false.
+
+ classItemList do:[:testClass|
+ testClass == runClass ifTrue:[
+ isBehind := true
+ ] ifFalse:[
+ (testClass detectItemWithKey:(aKeyItem helpKey)) notNil ifTrue:[
+ isBehind ifTrue:[ redefinedBelow := true ]
+ ifFalse:[ redefinedAbove := true ].
+ ]
+ ]
+ ].
+
+ redefinedBelow ifTrue:[
+ redefinedAbove ifTrue:[ icon := iconAboveAndBelow ]
+ ifFalse:[ icon := iconBelow ]
+ ] ifFalse:[
+ redefinedAbove ifTrue:[ icon := iconAbove ]
+ ifFalse:[ icon := nil ]
+ ].
+ aKeyItem icon:icon.
+ ]
+ ].
! !
!UIHelpTool methodsFor:'startup & release'!
@@ -1033,10 +1073,11 @@
helpItem := root detectItemWithKey:helpKey.
helpItem isNil ifTrue:[
- helpItem := KeyItem helpKey:helpKey helpText:(helpTextView contents).
- root add:helpItem sortBlock:[:a :b| a label < b label ].
+ helpItem := KeyItem helpKey:helpKey helpText:(helpTextView contents).
+ root add:helpItem sortBlock:[:a :b| a label < b label ].
+ self updateIcons.
] ifFalse:[
- helpItem helpText:(helpTextView contents).
+ helpItem helpText:(helpTextView contents).
].
contentsModifiedChannel value:false.
@@ -1070,7 +1111,11 @@
|item|
item := keyItemModel value.
- item notNil ifTrue:[ item remove ].
+
+ item notNil ifTrue:[
+ item remove.
+ item icon notNil ifTrue:[ self updateIcons ].
+ ].
editModel value:nil.
!
@@ -1358,7 +1403,15 @@
icon
"returns the display icon (always nil)
"
- ^ nil
+ ^ icon
+!
+
+icon:anIcon
+
+ icon ~= anIcon ifTrue:[
+ icon := anIcon.
+ self changed:#icon.
+ ].
!
label