class: MenuEditor
authorClaus Gittinger <cg@exept.de>
Tue, 09 Jul 2013 21:55:06 +0200
changeset 3028 272d45da727d
parent 3027 50657c666fdc
child 3029 58cc0b402815
class: MenuEditor changed: #doBrowseApplicationMethodFor:
MenuEditor.st
--- a/MenuEditor.st	Fri Jul 05 00:54:18 2013 +0200
+++ b/MenuEditor.st	Tue Jul 09 21:55:06 2013 +0200
@@ -2594,7 +2594,7 @@
 !
 
 doBrowseApplicationMethodFor:aspect
-    |selector cls category|
+    |selector cls implClass browsedClass category|
 
     specClass isNil ifTrue:[
         self warn:(resources string:'Please define the application class first.').
@@ -2617,16 +2617,27 @@
         ^ self
     ].
 
+    browsedClass := cls.
     (cls includesSelector:selector) ifFalse:[
-        category := UserPreferences current categoryForMenuActionsMethods.
-
-        SmalltalkCodeGeneratorTool
-            createActionMethodFor:selector in:cls
-            category:category
-            redefine:(self redefineAspectMethodsChannel value).
+        (implClass := cls whichClassImplements:selector) notNil ifTrue:[
+            (Dialog confirm:(resources 
+                        stringWithCRs:'The application does not directly implement %1.\However it inherits this from %2.\\Create a redefinition in %1?'
+                        with:cls name
+                        with:implClass name))
+            ifTrue:[
+                category := UserPreferences current categoryForMenuActionsMethods.
+
+                SmalltalkCodeGeneratorTool
+                    createActionMethodFor:selector in:cls
+                    category:category
+                    redefine:(self redefineAspectMethodsChannel value).
+            ] ifFalse:[
+                browsedClass := implClass
+            ]
+        ]
     ].
 
-    UserPreferences systemBrowserClass openInClass:cls selector:selector
+    UserPreferences systemBrowserClass openInClass:browsedClass selector:selector
 
     "Created: / 21-10-2010 / 14:07:32 / cg"
     "Modified: / 31-01-2011 / 18:28:59 / cg"