Resolve UI resources when building a `Menu` from menu spec jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 19 Jun 2019 10:21:20 +0100
branchjv
changeset 4462 c85ec88c3a52
parent 4278 8cc5f9eafef8
child 4463 0e3a18dcf877
Resolve UI resources when building a `Menu` from menu spec Fix a bad long-standing bug in `ApplicationModel >> menuFor:`. When a a menu is build from a spec, we MUST resolve UI resources otherwise menu slices may not be properly inserted. This manifested in class browser menu "View" when sometimes the slice appeared as submenu.
ApplicationModel.st
abbrev.stc
--- a/ApplicationModel.st	Fri Jun 07 19:57:30 2019 +0100
+++ b/ApplicationModel.st	Wed Jun 19 10:21:20 2019 +0100
@@ -1813,27 +1813,28 @@
 
     "/ Ask myself first...
     (thisContext isRecursive not and:[ self respondsTo: key ]) ifTrue:[
-	menu := self perform: key
+        menu := self perform: key
     ] ifFalse:[
-	"/ Ask my class...
-	(self class respondsTo: key) ifTrue:[
-	    menu := self class perform: key
-	] ifFalse:[
-	    "/ Ask masterApplication if any...
-	    masterApplication notNil ifTrue:[
-		menu := masterApplication menuFor: key
-	    ].
-	].
+        "/ Ask my class...
+        (self class respondsTo: key) ifTrue:[
+            menu := self class perform: key
+        ] ifFalse:[
+            "/ Ask masterApplication if any...
+            masterApplication notNil ifTrue:[
+                menu := masterApplication menuFor: key
+            ].
+        ].
     ].
 
     "/ If the provided menu is a menu spec, create Menu from it...
-    menu isArray ifTrue:[
-	menu :=  Menu decodeFromLiteralArray: menu.
+    menu isCollection ifTrue:[
+        menu := Menu decodeFromLiteralArray:menu.
+        menu findGuiResourcesIn:self.
     ].
     ^ menu.
 
     "Modified: / 18-06-1998 / 20:33:56 / cg"
-    "Modified: / 24-01-2014 / 09:46:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2019 / 10:01:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 specificationFor:aKey
--- a/abbrev.stc	Fri Jun 07 19:57:30 2019 +0100
+++ b/abbrev.stc	Wed Jun 19 10:21:20 2019 +0100
@@ -1,11 +1,29 @@
-# automagically generated by the project definition
-# this file is needed for stc to be able to compile modules independently.
-# it provides information about a classes filename, category and especially namespace.
-ActiveHelpView ActiveHelpView stx:libview2 'Interface-Help' 2
-ApplicationSubView ApplicationSubView stx:libview2 'Views-Basic' 2
-ApplicationWindow ApplicationWindow stx:libview2 'Interface-Framework' 2
+AVIReader AVIReader stx:libview2 'Graphics-Images-Readers' 0
+ActiveHelp ActiveHelp stx:libview2 'Interface-Help' 3
+ActiveHelpView ActiveHelpView stx:libview2 'Interface-Help' 0
+AlignmentOrigin AlignmentOrigin stx:libview2 'Graphics-Geometry' 0
+ApplicationController ApplicationController stx:libview2 'Interface-Framework' 0
+ApplicationModel ApplicationModel stx:libview2 'Interface-Framework' 2
+ApplicationSubView ApplicationSubView stx:libview2 'Views-Basic' 0
+ApplicationWindow ApplicationWindow stx:libview2 'Interface-Framework' 0
+ApplicationWithFileHistory ApplicationWithFileHistory stx:libview2 'Interface-Framework' 3
+AspectAdaptor AspectAdaptor stx:libview2 'Interface-Support-Models' 0
+AspectAdaptorWithDefault AspectAdaptorWithDefault stx:libview2 'Interface-Support-Models' 0
+BlitImageReader BlitImageReader stx:libview2 'Graphics-Images-Readers' 0
+BlockValue BlockValue stx:libview2 'Interface-Support-Models' 0
+BooleanBlockValue BooleanBlockValue stx:libview2 'Interface-Support-Models' 0
+BooleanValueHolder BooleanValueHolder stx:libview2 'Interface-Support-Models' 0
+BorderedWrapper BorderedWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+BoundedWrapper BoundedWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+BufferedValueHolder BufferedValueHolder stx:libview2 'Interface-Support-Models' 0
 ColorValue ColorValue stx:libview2 'Graphics-Support' 0
+CompositePart CompositePart stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+CompositeTransform CompositeTransform stx:libview2 'Graphics-Transformations' 0
+ConvertedValue ConvertedValue stx:libview2 'Interface-Support-Models' 0
+DependentPart DependentPart stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+DictionaryAdaptor DictionaryAdaptor stx:libview2 'Interface-Support-Models' 0
 DisplayObject DisplayObject stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+DisplayTransform DisplayTransform stx:libview2 'Graphics-Transformations' 0
 DragAndDropManager DragAndDropManager stx:libview2 'Interface-DragAndDrop' 0
 DragHandler DragHandler stx:libview2 'Interface-DragAndDrop' 0
 DrawAdaptor DrawAdaptor stx:libview2 'Views-Support' 0
@@ -14,101 +32,82 @@
 DropSource DropSource stx:libview2 'Interface-DragAndDrop' 0
 DropTarget DropTarget stx:libview2 'Interface-DragAndDrop' 0
 EventListener EventListener stx:libview2 'Interface-Support-UI' 0
-ExternalTopView ExternalTopView stx:libview2 'Views-Basic' 2
+ExternalTopView ExternalTopView stx:libview2 'Views-Basic' 0
+FLIReader FLIReader stx:libview2 'Graphics-Images-Readers' 0
+FaceReader FaceReader stx:libview2 'Graphics-Images-Readers' 0
+FillingWrapper FillingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+FlyByHelp FlyByHelp stx:libview2 'Interface-Help' 3
 GIFReader GIFReader stx:libview2 'Graphics-Images-Readers' 0
+GeometricWrapper GeometricWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+HersheyFont HersheyFont stx:libview2 'Graphics-Support' 0
 Icon Icon stx:libview2 'Graphics-Images' 0
 ImageFrame ImageFrame stx:libview2 'Graphics-Images' 0
 ImageSequence ImageSequence stx:libview2 'Graphics-Images' 0
-InputView InputView stx:libview2 'Views-Special' 2
+IndirectValue IndirectValue stx:libview2 'Interface-Support-Models' 0
+InputView InputView stx:libview2 'Views-Special' 0
+Insets Insets stx:libview2 'Graphics-Geometry' 0
+IrisRGBReader IrisRGBReader stx:libview2 'Graphics-Images-Readers' 0
 JPEGReader JPEGReader stx:libview2 'Graphics-Images-Readers' 0
 KeyboardProcessor KeyboardProcessor stx:libview2 'Interface-Framework' 0
 Layout Layout stx:libview2 'Graphics-Geometry' 0
+LayoutFrame LayoutFrame stx:libview2 'Graphics-Geometry' 0
+LayoutOrigin LayoutOrigin stx:libview2 'Graphics-Geometry' 0
+LayoutWrapper LayoutWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
 MIMETypeIconLibrary MIMETypeIconLibrary stx:libview2 'Interface-Smalltalk' 0
 MIMETypes MIMETypes stx:libview2 'Net-Communication-Support' 0
 MacOSXIconReader MacOSXIconReader stx:libview2 'Graphics-Images-Readers' 0
+MatrixTransform2x3 MatrixTransform2x3 stx:libview2 'Graphics-Transformations' 0
+Menu Menu stx:libview2 'Views-Support' 0
 MenuItem MenuItem stx:libview2 'Views-Support' 0
 Model Model stx:libview2 'Interface-Support-Models' 0
 MultiImage MultiImage stx:libview2 'Graphics-Images' 0
+PBMReader PBMReader stx:libview2 'Graphics-Images-Readers' 0
+PCXReader PCXReader stx:libview2 'Graphics-Images-Readers' 0
+PICTReader PICTReader stx:libview2 'Graphics-Images-Readers' 0
 PNGReader PNGReader stx:libview2 'Graphics-Images-Readers' 0
-PopUpBanner PopUpBanner stx:libview2 'Views-Basic' 2
+Plug Plug stx:libview2 'Kernel-Objects' 0
+PluggableAdaptor PluggableAdaptor stx:libview2 'Interface-Support-Models' 0
+PluggableEventListener PluggableEventListener stx:libview2 'Interface-Support-UI' 0
+PluggableView PluggableView stx:libview2 'Views-Basic' 0
+PopUpBanner PopUpBanner stx:libview2 'Views-Basic' 0
 PrintConverter PrintConverter stx:libview2 'Interface-Support' 0
 PrinterContext PrinterContext stx:libview2 'Interface-Printing' 0
 PropertyListDictionary PropertyListDictionary stx:libview2 'Interface-Support-UI' 0
+ProtocolAdaptor ProtocolAdaptor stx:libview2 'Interface-Support-Models' 0
+RIFFReader RIFFReader stx:libview2 'System-Support-FileFormats' 0
+RangeAdaptor RangeAdaptor stx:libview2 'Interface-Support-Models' 0
 ResourceRetriever ResourceRetriever stx:libview2 'Interface-Support-UI' 1
+ResourceSpecEditor ResourceSpecEditor stx:libview2 'Interface-Framework' 8
+ST80FormReader ST80FormReader stx:libview2 'Graphics-Images-Readers' 0
+ScreenLock ScreenLock stx:libview2 'Interface-Support' 0
+SimpleDialog SimpleDialog stx:libview2 'Interface-Framework' 2
 StandardSystemController StandardSystemController stx:libview2 'Interface-Support-Controllers' 0
+StrokingOrFillingWrapper StrokingOrFillingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+StrokingWrapper StrokingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+SunRasterReader SunRasterReader stx:libview2 'Graphics-Images-Readers' 0
 TIFFReader TIFFReader stx:libview2 'Graphics-Images-Readers' 0
-TransparentBox TransparentBox stx:libview2 'Views-Basic' 2
-VisualRegion VisualRegion stx:libview2 'Views-Special' 2
-WinPrinterStream WinPrinterStream stx:libview2  'unknownCategory'  0
+TargaReader TargaReader stx:libview2 'Graphics-Images-Readers' 0
+ToolApplicationModel ToolApplicationModel stx:libview2 'Interface-Framework' 8
+TranslatingWrapper TranslatingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+TransparentBox TransparentBox stx:libview2 'Views-Basic' 0
+TriggerValue TriggerValue stx:libview2 'Interface-Support-Models' 0
+TypeConverter TypeConverter stx:libview2 'Interface-Support-Models' 0
+TypedValueHolder TypedValueHolder stx:libview2 'Interface-Support-Models' 0
+UIBuilder UIBuilder stx:libview2 'Interface-Framework' 0
+ValueHolder ValueHolder stx:libview2 'Interface-Support-Models' 0
+ValueHolderWithRememberedPreviousValue ValueHolderWithRememberedPreviousValue stx:libview2 'Interface-Support-Models' 0
+ValueHolderWithWeakDependents ValueHolderWithWeakDependents stx:libview2 'Interface-Support-Models' 0
+ValueModel ValueModel stx:libview2 'Interface-Support-Models' 0
+ViewForwardingController ViewForwardingController stx:libview2 'Interface-Support-Controllers' 0
+VisualComponent VisualComponent stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+VisualPart VisualPart stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
+VisualRegion VisualRegion stx:libview2 'Views-Special' 0
+WinPrinterContext WinPrinterContext stx:libview2 'Interface-Printing' 0
+WinPrinterStream WinPrinterStream stx:libview2 'Interface-Printing' 0
 WindowBuilder WindowBuilder stx:libview2 'Interface-Framework' 0
 WindowsIconReader WindowsIconReader stx:libview2 'Graphics-Images-Readers' 0
+Wrapper Wrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
 XBMReader XBMReader stx:libview2 'Graphics-Images-Readers' 0
 XPMReader XPMReader stx:libview2 'Graphics-Images-Readers' 0
-stx_libview2 stx_libview2 stx:libview2 '* Projects & Packages *' 3
-ActiveHelp ActiveHelp stx:libview2 'Interface-Help' 3
-ApplicationModel ApplicationModel stx:libview2 'Interface-Framework' 2
-LayoutOrigin LayoutOrigin stx:libview2 'Graphics-Geometry' 0
-Menu Menu stx:libview2 'Views-Support' 0
-Plug Plug stx:libview2 'Kernel-Objects' 0
-PluggableEventListener PluggableEventListener stx:libview2 'Interface-Support-UI' 0
-ScreenLock ScreenLock stx:libview2 'Interface-Support' 0
-UIBuilder UIBuilder stx:libview2 'Interface-Framework' 0
-ValueModel ValueModel stx:libview2 'Interface-Support-Models' 0
-VisualComponent VisualComponent stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-WinPrinterContext WinPrinterContext stx:libview2  'unknownCategory'  0
-AlignmentOrigin AlignmentOrigin stx:libview2 'Graphics-Geometry' 0
-ApplicationWithFileHistory ApplicationWithFileHistory stx:libview2 'Interface-Framework' 3
-BlockValue BlockValue stx:libview2 'Interface-Support-Models' 0
-FlyByHelp FlyByHelp stx:libview2 'Interface-Help' 3
-IndirectValue IndirectValue stx:libview2 'Interface-Support-Models' 0
-LayoutFrame LayoutFrame stx:libview2 'Graphics-Geometry' 0
-PluggableAdaptor PluggableAdaptor stx:libview2 'Interface-Support-Models' 0
-ProtocolAdaptor ProtocolAdaptor stx:libview2 'Interface-Support-Models' 0
-SimpleDialog SimpleDialog stx:libview2 'Interface-Framework' 2
-ToolApplicationModel ToolApplicationModel stx:libview2 'Interface-Framework' 8
-ValueHolder ValueHolder stx:libview2 'Interface-Support-Models' 0
-VisualPart VisualPart stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-AspectAdaptor AspectAdaptor stx:libview2 'Interface-Support-Models' 0
-BooleanBlockValue BooleanBlockValue stx:libview2 'Interface-Support-Models' 0
-BooleanValueHolder BooleanValueHolder stx:libview2 'Interface-Support-Models' 0
-BufferedValueHolder BufferedValueHolder stx:libview2 'Interface-Support-Models' 0
-DictionaryAdaptor DictionaryAdaptor stx:libview2 'Interface-Support-Models' 0
-RangeAdaptor RangeAdaptor stx:libview2 'Interface-Support-Models' 0
-ResourceSpecEditor ResourceSpecEditor stx:libview2 'Interface-Framework' 8
-TriggerValue TriggerValue stx:libview2 'Interface-Support-Models' 0
-TypeConverter TypeConverter stx:libview2 'Interface-Support-Models' 0
-ValueHolderWithRememberedPreviousValue ValueHolderWithRememberedPreviousValue stx:libview2 'Interface-Support-Models' 0
-ValueHolderWithWeakDependents ValueHolderWithWeakDependents stx:libview2 'Interface-Support-Models' 0
-AspectAdaptorWithDefault AspectAdaptorWithDefault stx:libview2 'Interface-Support-Models' 0
-Wrapper Wrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-TranslatingWrapper TranslatingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-LayoutWrapper LayoutWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-BoundedWrapper BoundedWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-AVIReader AVIReader stx:libview2 'Graphics-Images-Readers' 0
-ApplicationController ApplicationController stx:libview2 'Interface-Framework' 0
-BlitImageReader BlitImageReader stx:libview2 'Graphics-Images-Readers' 0
-BorderedWrapper BorderedWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-CompositePart CompositePart stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-CompositeTransform CompositeTransform stx:libview2 'Graphics-Transformations' 0
-ConvertedValue ConvertedValue stx:libview2 'Interface-Support-Models' 0
-DependentPart DependentPart stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-FLIReader FLIReader stx:libview2 'Graphics-Images-Readers' 0
-FaceReader FaceReader stx:libview2 'Graphics-Images-Readers' 0
-GeometricWrapper GeometricWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-StrokingOrFillingWrapper StrokingOrFillingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-FillingWrapper FillingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-HersheyFont HersheyFont stx:libview2 'Graphics-Support' 0
-Insets Insets stx:libview2 'Graphics-Geometry' 0
-IrisRGBReader IrisRGBReader stx:libview2 'Graphics-Images-Readers' 0
-MatrixTransform2x3 MatrixTransform2x3 stx:libview2 'Graphics-Transformations' 0
-PBMReader PBMReader stx:libview2 'Graphics-Images-Readers' 0
-PCXReader PCXReader stx:libview2 'Graphics-Images-Readers' 0
-PICTReader PICTReader stx:libview2 'Graphics-Images-Readers' 0
-PluggableView PluggableView stx:libview2 'Views-Basic' 2
-RIFFReader RIFFReader stx:libview2 'System-Support-FileFormats' 0
-ST80FormReader ST80FormReader stx:libview2 'Graphics-Images-Readers' 0
-StrokingWrapper StrokingWrapper stx:libview2 'Compatibility-ST80-Graphics-Display Objects' 0
-SunRasterReader SunRasterReader stx:libview2 'Graphics-Images-Readers' 0
-TargaReader TargaReader stx:libview2 'Graphics-Images-Readers' 0
-ViewForwardingController ViewForwardingController stx:libview2 'Interface-Support-Controllers' 0
 XWDReader XWDReader stx:libview2 'Graphics-Images-Readers' 0
+stx_libview2 stx_libview2 stx:libview2 '* Projects & Packages *' 0