MenuEditor.st
changeset 2810 a2bb164d401c
parent 2798 dac473a7fcdf
child 2833 c4e0add90aaa
--- a/MenuEditor.st	Thu Oct 21 13:55:30 2010 +0200
+++ b/MenuEditor.st	Thu Oct 21 14:18:18 2010 +0200
@@ -280,6 +280,9 @@
 #basicsAction
 'An action selector with 0, 1 (the argument field), or 2 (the selected item) arguments.'
 
+#browseMethod
+'Open a browser on this method in the application. Create the method, if it does not exist.'
+
 #basicsArgument
 'An optional arg passed with above selector, if it is a 1 or 2 arg selector (enter a Smalltalk literal).'
 
@@ -411,7 +414,7 @@
 
 )
 
-    "Modified: / 20-09-2010 / 13:24:49 / cg"
+    "Modified: / 21-10-2010 / 14:18:03 / cg"
 !
 
 localFlyHelpSpecStrings
@@ -2581,26 +2584,34 @@
 !
 
 doBrowseActionMethod
+    "open a browser on the callback method (create if not yet existing)"
+
+    self doBrowseApplicationMethodFor:#itemValue
+
+    "Modified: / 21-10-2010 / 14:09:33 / cg"
+!
+
+doBrowseApplicationMethodFor:aspect
     |selector cls category|
 
-    selector := (self aspectFor:#itemValue) value.
-
-    selector isEmptyOrNil ifTrue:[
-        Dialog information:(resources 
-                                string:'Please enter an action method name.').
+    specClass isNil ifTrue:[
+        self warn:(resources string:'Please define the application class first.').
         ^ self
     ].
 
-    selector := selector asSymbol.
-
-    specClass isNil ifTrue:[
-        self warn:'Please define the application class first.'.
+    selector := (self aspectFor:aspect) value.
+    selector isEmptyOrNil ifTrue:[
+        Dialog information:(resources string:'Please enter an action method name.').
         ^ self
     ].
+    (selector = 'true' or:[selector = 'false']) ifTrue:[^ self].
+    (selector == true or:[selector == false]) ifTrue:[^ self].
+
+    selector := selector asSymbol.
 
     cls := self resolveName:specClass.
     cls isNil ifTrue:[
-        self warn:'Class ', specClass asString, ' does not exist!!'.
+        self warn:(resources string:'Class %1 does not exist!!' with:specClass asString).
         ^ self
     ].
 
@@ -2613,7 +2624,25 @@
             redefine:(self redefineAspectMethodsChannel value).
     ].
 
-    UserPreferences current systemBrowse 
+    UserPreferences current systemBrowserClass openInClass:cls selector:selector
+
+    "Created: / 21-10-2010 / 14:07:32 / cg"
+!
+
+doBrowseEnabledMethod
+    "open a browser on the enabled method (create if not yet existing)"
+
+    self doBrowseApplicationMethodFor:#enabled
+
+    "Created: / 21-10-2010 / 14:09:41 / cg"
+!
+
+doBrowseVisibilityMethod
+    "open a browser on the visibility method (create if not yet existing)"
+
+    self doBrowseApplicationMethodFor:#isVisible
+
+    "Created: / 21-10-2010 / 14:09:56 / cg"
 !
 
 doGenerateAspectMethods
@@ -3306,17 +3335,17 @@
 
     <resource: #canvas>
 
-    ^
+    ^ 
      #(FullSpec
         name: detailsEditSpec
-        window:
+        window: 
        (WindowSpec
           label: 'Details Edit'
           name: 'Details Edit'
           min: (Point 10 10)
           bounds: (Rectangle 0 0 407 291)
         )
-        component:
+        component: 
        (SpecCollection
           collection: (
            (LabelSpec
@@ -3354,7 +3383,7 @@
             )
            (InputFieldSpec
               name: 'enabledField'
-              layout: (LayoutFrame 110 0 40 0 -5 1.0 62 0)
+              layout: (LayoutFrame 110 0 40 0 -25 1.0 62 0)
               activeHelpKey: detailsEnabled
               tabable: true
               model: enabled
@@ -3367,6 +3396,17 @@
               modifiedChannel: modifiedChannel
               acceptOnPointerLeave: false
             )
+           (ActionButtonSpec
+              label: 'browseActionImage'
+              name: 'Button1'
+              layout: (LayoutFrame -25 1 40 0 -5 1 62 0)
+              activeHelpKey: browseMethod
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+              resizeForLabel: true
+              tabable: true
+              model: doBrowseEnabledMethod
+            )
            (LabelSpec
               label: 'Visibility:'
               name: 'visibilityLabel'
@@ -3378,7 +3418,7 @@
             )
            (InputFieldSpec
               name: 'isVisibleInputField'
-              layout: (LayoutFrame 110 0 65 0 -5 1.0 87 0)
+              layout: (LayoutFrame 110 0 65 0 -25 1.0 87 0)
               activeHelpKey: detailsVisibility
               tabable: true
               model: isVisible
@@ -3391,6 +3431,17 @@
               modifiedChannel: modifiedChannel
               acceptOnPointerLeave: false
             )
+           (ActionButtonSpec
+              label: 'browseActionImage'
+              name: 'Button2'
+              layout: (LayoutFrame -25 1 65 0 -5 1 87 0)
+              activeHelpKey: browseMethod
+              hasCharacterOrientedLabel: false
+              translateLabel: true
+              resizeForLabel: true
+              tabable: true
+              model: doBrowseVisibilityMethod
+            )
            (LabelSpec
               label: 'Aux Value'
               name: 'auxLabel'
@@ -3431,7 +3482,11 @@
               activeHelpKey: detailsStartGroup
               tabable: true
               model: startGroup
-              menu: (left right conditionalRight)
+              menu: 
+             (Array
+                left right
+                conditionalRight
+              )
             )
            (LabelSpec
               label: 'Access Character Position:'
@@ -3495,22 +3550,18 @@
               adjust: right
             )
            (FontMenuSpec
-              attributes:
-             (tabable
-                true
-              )
               name: 'fontMenu'
               layout: (LayoutFrame 110 0 260 0 -5 1.0 282 0)
               activeHelpKey: fontMenu
               model: font
-                    allowSymbolicFonts: true
+              allowSymbolicFonts: true
             )
            )
-
+         
         )
       )
 
-    "Modified: / 16-10-2006 / 12:48:12 / cg"
+    "Modified: / 21-10-2010 / 14:15:09 / cg"
 ! !
 
 !MenuEditor::Item class methodsFor:'interface-editor'!
@@ -3953,6 +4004,7 @@
               resizeForLabel: true
               tabable: true
               model: doBrowseActionMethod
+              activeHelpKey: browseMethod
             )
            (LabelSpec
               label: 'Argument:'
@@ -4116,6 +4168,8 @@
          
         )
       )
+
+    "Modified: / 21-10-2010 / 14:14:49 / cg"
 ! !
 
 !MenuEditor::ActionItem class methodsFor:'interface-editor'!