*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 26 Feb 2008 11:20:50 +0100
changeset 2297 ee43ce83094d
parent 2296 365b3a73cd28
child 2298 d5467f85544f
*** empty log message ***
MenuEditor.st
--- a/MenuEditor.st	Tue Feb 26 11:20:34 2008 +0100
+++ b/MenuEditor.st	Tue Feb 26 11:20:50 2008 +0100
@@ -476,6 +476,12 @@
 
 !MenuEditor class methodsFor:'image specs'!
 
+browseActionImage
+    <resource: #programImage>
+
+    ^ UIPainter browseActionImage
+!
+
 defaultIcon
     <resource: #programImage>
 
@@ -1637,40 +1643,40 @@
 !
 
 accept:ok
-    "ok if true the modifications are accepted
-     than reload from item
+    "if ok is true, the modifications are accepted.
+     then reload from item
     "
     |selectedItem rscRetrHolder helpKeyHolder helpTool imageTool acceptChannel|
 
     selectedItem := self selectedItem.
 
     selectedItem ifNotNil:[
-	self withoutNotifyDo:[
-	    rscRetrHolder := aspects at:#resourceRetriever.
-	    helpKeyHolder := aspects at:#activeHelpKey.
-	    imageTool     := self imageTool.
-	    helpTool      := self helpTool.
-	    acceptChannel := self acceptChannel.
-
-	    acceptChannel triggerValue:true.
-	    acceptChannel setValue:false.
-
-	    ok ifTrue:[
-		helpTool accept.
-		rscRetrHolder value:(imageTool resourceRetriever).
-		helpKeyHolder value:(helpTool  helpKey).
-		selectedItem  fromAspects:aspects.
-		self setModified.
-
-		selectedItem isRootItem ifTrue:[
-		    "/ update specSelector
-		    specSelector := selectedItem rawLabel.
-		].
-	    ].
-	    selectedItem toAspects:aspects.
-	    helpTool     helpKey:(helpKeyHolder value).
-	    imageTool    resourceRetriever:(rscRetrHolder value).
-	]
+        self withoutNotifyDo:[
+            rscRetrHolder := aspects at:#resourceRetriever.
+            helpKeyHolder := aspects at:#activeHelpKey.
+            imageTool     := self imageTool.
+            helpTool      := self helpTool.
+            acceptChannel := self acceptChannel.
+
+            acceptChannel triggerValue:true.
+            acceptChannel setValue:false.
+
+            ok ifTrue:[
+                helpTool accept.
+                rscRetrHolder value:(imageTool resourceRetriever).
+                helpKeyHolder value:(helpTool  helpKey).
+                selectedItem  fromAspects:aspects.
+                self setModified.
+
+                selectedItem isRootItem ifTrue:[
+                    "/ update specSelector
+                    specSelector := selectedItem rawLabel.
+                ].
+            ].
+            selectedItem toAspects:aspects.
+            helpTool     helpKey:(helpKeyHolder value).
+            imageTool    resourceRetriever:(rscRetrHolder value).
+        ]
     ].
     self updateChannels.
 "/    self clearModified.
@@ -2482,6 +2488,43 @@
     ^ selectors asOrderedCollection
 !
 
+doBrowseActionMethod
+    |selector cls category|
+
+    selector := (self aspectFor:#itemValue) value.
+
+    selector isEmptyOrNil ifTrue:[
+        Dialog information:(resources 
+                                string:'Please enter an action method name.').
+        ^ self
+    ].
+
+    selector := selector asSymbol.
+
+    specClass isNil ifTrue:[
+        self warn:'Please define the application class first.'.
+        ^ self
+    ].
+
+    cls := self resolveName:specClass.
+    cls isNil ifTrue:[
+        self warn:'Class ', specClass asString, ' does not exist!!'.
+        ^ self
+    ].
+
+    (cls implements:selector) ifFalse:[
+        category := UserPreferences current categoryForMenuActionsMethods.
+
+        CodeGeneratorTool
+            createActionMethodFor:selector in:cls
+            category:category
+            redefine:(self redefineAspectMethodsChannel value).
+    ].
+
+    UserPreferences current systemBrowserClass
+        openInClass:cls selector:selector.
+!
+
 doGenerateAspectMethods
     "compile aspect and action methods"
 
@@ -3662,17 +3705,17 @@
 
     <resource: #canvas>
 
-    ^
+    ^ 
      #(FullSpec
         name: basicsEditSpec
-        window:
+        window: 
        (WindowSpec
           label: 'basicsEditSpec'
           name: 'basicsEditSpec'
           min: (Point 10 10)
           bounds: (Rectangle 0 0 340 340)
         )
-        component:
+        component: 
        (SpecCollection
           collection: (
            (LabelSpec
@@ -3736,7 +3779,7 @@
             )
            (InputFieldSpec
               name: 'valueField'
-              layout: (LayoutFrame 110 0 71 0 -5 1.0 93 0)
+              layout: (LayoutFrame 110 0 71 0 -25 1.0 93 0)
               activeHelpKey: basicsAction
               tabable: true
               model: itemValue
@@ -3751,6 +3794,16 @@
               modifiedChannel: modifiedChannel
               acceptOnPointerLeave: true
             )
+           (ActionButtonSpec
+              label: 'browseActionImage'
+              name: 'Button1'
+              layout: (LayoutFrame -25 1 71 0 -5 1 93 0)
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+              resizeForLabel: true
+              tabable: true
+              model: doBrowseActionMethod
+            )
            (LabelSpec
               label: 'Argument:'
               name: 'argumentLabel'
@@ -3910,7 +3963,7 @@
               translateLabel: true
             )
            )
-
+         
         )
       )
 ! !