]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Check statement collisions"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 15 Sep 2016 18:33:03 +0000 (21:33 +0300)
committerGerrit Code Review <gerrit2@www.simantics.org>
Thu, 15 Sep 2016 18:33:03 +0000 (21:33 +0300)
bundles/org.simantics.document.ui.ontology/graph.tg
bundles/org.simantics.document.ui.ontology/graph/DocumentUI.pgraph
bundles/org.simantics.event.ontology/graph.tg
bundles/org.simantics.event.ontology/graph/Event.pgraph
bundles/org.simantics.selectionview.ontology/graph.tg
bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph
bundles/org.simantics.ui/schema/toolbarCommand.exsd
bundles/org.simantics.ui/src/org/simantics/ui/toolbar/ToolBarCommandRegistry.java
bundles/org.simantics.ui/src/org/simantics/ui/toolbar/ToolbarContributor.java

index a32cf12e7b099dd425525150c5fb82651e506854..66fea40388122bceab20c2c2a1b2f110e3a5154e 100644 (file)
Binary files a/bundles/org.simantics.document.ui.ontology/graph.tg and b/bundles/org.simantics.document.ui.ontology/graph.tg differ
index cb7cd6498d3139072b14268adac3cff8d40ccbcc..3ac065d5e5ef78299553b91710f9538720db247c 100644 (file)
@@ -15,6 +15,7 @@ UI = <http://www.simantics.org/DocumentUI-1.1> : L0.Ontology
     L0.HasResourceClass "org.simantics.document.ui.DocumentUIResource"
 
 UI.Functions : L0.Library
+UI.Functions.editorLoaded : L0.Function
 
 UI.CSSEditorContribution
     L0.HasLabel "Wiki Style Editor"
@@ -187,7 +188,7 @@ UI.Alternative : VIEWS.Alternative
       UI.NoDocument
 
 UI.Sash : VIEWS.SashForm
-  VIEWS.onLoaded UI.Functions.editorLoaded : L0.Function
+  VIEWS.onLoaded UI.Functions.editorLoaded
   VIEWS.Control.layoutData _ : VIEWS.GridLayout.GridData
     VIEWS.GridLayout.GridData.horizontalGrab true
     VIEWS.GridLayout.GridData.verticalGrab true
@@ -243,7 +244,7 @@ UI.NoDocument : VIEWS.Composite
               VIEWS.Button.modifier UI.Functions.onCreateDocumentButton : L0.Function
 
 UI.Editor : VIEWS.Composite
-  VIEWS.onLoaded UI.Functions.editorLoaded : L0.Function
+  VIEWS.onLoaded UI.Functions.editorLoaded
     L0.HasValueType "WriteGraph => Variable -> Variable -> Boolean"
   VIEWS.Control.layoutData _ : VIEWS.GridLayout.GridData
     VIEWS.GridLayout.GridData.horizontalGrab true
index ffa0b161cf6e8896f219017ea35028b68cb89b64..ed95dc026f154b526b304d49d7a9caa1fda91329 100644 (file)
Binary files a/bundles/org.simantics.event.ontology/graph.tg and b/bundles/org.simantics.event.ontology/graph.tg differ
index c48cda2d88807b82861e385b3e457c5763cc91f0..bec7cfe4fa4135cc4d065eab620f47fbde0a3f8c 100644 (file)
@@ -100,7 +100,8 @@ EVENT.Returns <R L0.IsRelatedTo : L0.FunctionalRelation
     L0.InverseOf EVENT.ReturnedBy <R L0.IsRelatedTo : L0.FunctionalRelation
         L0.HasDescription "This relation implies that the domain event is the event returned by the range event. See EVENT.Returns."
     L0.HasDescription "Some events can be considered to be states or flags that may be returned at some point in time. This relation implies that the domain event is the returning event for range event."
-    <-- EVENT.Event --> EVENT.Event
+    <-- EVENT.Event
+    --> EVENT.Event
 
 EVENT.NoReturn
     L0.HasDescription "A tag for marking events that are not expected to be returned. This can be used as a hint for user interfaces."
@@ -111,7 +112,8 @@ EVENT.ReturnEvent
     L0.HasDescription "Indicates that an event is a return event."
     @L0.defTag
     @L0.symmetric
-    <-- EVENT.Event --> EVENT.Event
+    <-- EVENT.Event
+    --> EVENT.Event
 
 /*
 // Future ideas:
index 67160405a4e25e7e519fbbd66f93893c8d118d5e..757158d3bf4087c45981b5ebc2ddcf5d58127e0e 100644 (file)
Binary files a/bundles/org.simantics.selectionview.ontology/graph.tg and b/bundles/org.simantics.selectionview.ontology/graph.tg differ
index d19eb4ed0e567895c2552069befb5b9bc48a8fd1..f9eb00666c472b36e1a18c0be974a1178e095677 100644 (file)
@@ -10,6 +10,7 @@ SEL.Functions : L0.Library
 SEL.TabContribution <T L0.Entity
 SEL.SelectionTransformation <T L0.Function
 
+SEL.Functions.getEnumerationValues : L0.Function
 SEL.Functions.singleVariableTransformation : SEL.SelectionTransformation
 SEL.Functions.singleResourceTransformation : SEL.SelectionTransformation
 SEL.Functions.singleResourceToVariableTransformation : SEL.SelectionTransformation
@@ -105,7 +106,7 @@ SEL.GenericParameterType <T L0.FunctionalRelation
   @L0.assert SEL.HasDisplayValue
     _ : SEL.DisplayValue
       SEL.HasEnumerationValues _ : L0.Value
-        L0.ConvertsToValueWith SEL.Functions.getEnumerationValues : L0.ExternalValue
+        L0.ConvertsToValueWith SEL.Functions.getEnumerationValues
   @L0.assert SEL.HasDisplayUnit
     _ : SEL.DisplayUnit
       L0.readOnly true
@@ -131,13 +132,13 @@ SEL.getSpecialCategory ==> "Resource -> <ReadGraph> Resource" <R L0.HasProperty
 SEL.ColorParameterType <T SEL.GenericParameterType
   @L0.assert SEL.HasDisplayValue
     _ : SEL.DisplayValue
-      SEL.HasEnumerationValues SEL.Functions.getEnumerationValues : L0.Function
+      SEL.HasEnumerationValues SEL.Functions.getEnumerationValues
       SEL.HasCustomModifier SEL.Functions.colorModifier : L0.Function
 
 SEL.FontParameterType <T SEL.GenericParameterType
   @L0.assert SEL.HasDisplayValue
     _ : SEL.DisplayValue
-      SEL.HasEnumerationValues SEL.Functions.getEnumerationValues : L0.Function
+      SEL.HasEnumerationValues SEL.Functions.getEnumerationValues
       SEL.HasCustomModifier SEL.Functions.fontModifier : L0.Function
 
 SEL.GenericCategory = ( "Properties", "", false ) : SEL.StandardPropertyInfo
index 52d1dd0a37f8c8d371958e6a7dd63884a10fbabb..cace7a863d5d92d41c1bfc506f6ff5eb38a9b84a 100644 (file)
 The difference is, that this system tracks state of the commands spearately for each editor, and automatically updates toggle- and radio buttons, when focus changes.\r
 \r
 The editor must use org.simantics.ui.toolbar.ToolbarContributor as  a contributorClass, and &quot;toolbar&quot; paramater pointing to used toolbar ID.\r
+Optional &quot;hide=true&quot; parameter allows hiding (hide by default)the toolbar when the editor is closed.\r
 \r
 Example:\r
-org.simantics.ui.toolbar.ToolbarContributor:toolbar=org.simantics.kcleco.ui.diagramToolbar\r
+org.simantics.ui.toolbar.ToolbarContributor:toolbar=org.simantics.kcleco.ui.diagramToolbar;hide=true\r
 \r
 Toggle buttons must use command state &quot;org.eclipse.ui.commands.toggleState&quot;.\r
 Radio and combo buttons must use  state &quot;org.eclipse.ui.commands.radioState&quot;.\r
@@ -63,6 +64,9 @@ TODO: investigate, if the mechanism could be used with menus aswell.
 \r
    <element name="command">\r
       <complexType>\r
+         <choice minOccurs="0" maxOccurs="unbounded">\r
+            <element ref="parameter"/>\r
+         </choice>\r
          <attribute name="commandId" type="string" use="required">\r
             <annotation>\r
                <documentation>\r
@@ -123,6 +127,25 @@ TODO: investigate, if the mechanism could be used with menus aswell.
       </complexType>\r
    </element>\r
 \r
+   <element name="parameter">\r
+      <complexType>\r
+         <attribute name="name" type="string" use="required">\r
+            <annotation>\r
+               <documentation>\r
+                  \r
+               </documentation>\r
+            </annotation>\r
+         </attribute>\r
+         <attribute name="value" type="string" use="required">\r
+            <annotation>\r
+               <documentation>\r
+                  \r
+               </documentation>\r
+            </annotation>\r
+         </attribute>\r
+      </complexType>\r
+   </element>\r
+\r
    <annotation>\r
       <appInfo>\r
          <meta.section type="since"/>\r
index 7287c5ae3b3d2c3d52990219f5ff564ccb809ea0..2e2ea3f191c391e4886c9a2046b52710da3c284f 100644 (file)
@@ -74,6 +74,12 @@ public class ToolBarCommandRegistry implements IExtensionChangeHandler {
                        ext.type = el.getAttribute("type");\r
                        ext.value = el.getAttribute("value");\r
                        ext.contributorId = el.getContributor().getName();\r
+                       for (IConfigurationElement param : el.getChildren("parameter")) {\r
+                               Parameter parameter = new Parameter();\r
+                               parameter.name = param.getAttribute("name");\r
+                               parameter.value = param.getAttribute("value");\r
+                               ext.parameters.add(parameter);\r
+                       }\r
                        tracker.registerObject(el.getDeclaringExtension(), ext, IExtensionTracker.REF_STRONG);\r
                        extensions.add(ext);\r
                        \r
@@ -111,6 +117,7 @@ public class ToolBarCommandRegistry implements IExtensionChangeHandler {
                public String value;\r
                public String image;\r
                public String contributorId;\r
+               public List<Parameter> parameters = new ArrayList<>();\r
                public ToolbarCommandExtension(String commandId) {\r
                        super();\r
                        this.commandId = commandId;\r
@@ -122,5 +129,10 @@ public class ToolBarCommandRegistry implements IExtensionChangeHandler {
                }\r
        }\r
        \r
+       public class Parameter {\r
+               public String name;\r
+               public String value;\r
+       }\r
+       \r
        \r
 }\r
index 84413bb4684f572fe2f20c53570c96be2fa33be0..0f7d3e26d26f90b2aef60cfcbecb396d4b2ec557 100644 (file)
@@ -11,6 +11,9 @@ import org.eclipse.core.commands.Command;
 import org.eclipse.core.commands.CommandEvent;\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.eclipse.core.commands.ICommandListener;\r
+import org.eclipse.core.commands.IParameter;\r
+import org.eclipse.core.commands.Parameterization;\r
+import org.eclipse.core.commands.ParameterizedCommand;\r
 import org.eclipse.core.commands.State;\r
 import org.eclipse.core.runtime.CoreException;\r
 import org.eclipse.core.runtime.IConfigurationElement;\r
@@ -42,11 +45,12 @@ import org.eclipse.ui.handlers.RadioState;
 import org.eclipse.ui.handlers.RegistryToggleState;\r
 import org.eclipse.ui.menus.WorkbenchWindowControlContribution;\r
 import org.eclipse.ui.part.EditorActionBarContributor;\r
-\r
 import org.simantics.db.common.utils.Logger;\r
 import org.simantics.ui.internal.Activator;\r
+import org.simantics.ui.toolbar.ToolBarCommandRegistry.Parameter;\r
 import org.simantics.ui.toolbar.ToolBarCommandRegistry.ToolbarCommandExtension;\r
 import org.simantics.utils.datastructures.MapList;\r
+import org.simantics.utils.ui.ExceptionUtils;\r
 \r
 \r
 /**\r
@@ -64,7 +68,8 @@ import org.simantics.utils.datastructures.MapList;
 public class ToolbarContributor extends EditorActionBarContributor implements ICommandListener, IPartListener, CommandStateListener, IExecutableExtension {\r
 \r
        private static boolean DEBUG = false;                   // Print debug messages to console\r
-       private static boolean REUSE = true;                    // true: Reuse contribution items / false: delete items on dispose \r
+       private boolean REUSE = true;                           // true: Reuse contribution items (leave toolbar in disabled state when editor closes)\r
+                                                       // false: delete items on dispose (remove toolbar editor closes) \r
        \r
        private static final String PLATFORM = "platform:/plugin/";\r
 \r
@@ -81,6 +86,8 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
     MapList<String, CommandAction> actions = new MapList<String, ToolbarContributor.CommandAction>();\r
     \r
     CommandStateRegistry stateRegistry;\r
+    \r
+    IPartListener partListener;\r
        \r
        private Map<String,ComboContribution> menus = new HashMap<String, ComboContribution>();\r
        \r
@@ -88,6 +95,28 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); \r
                handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);\r
                stateRegistry = CommandStateRegistry.getInstance();\r
+               // we need part listener to be notified for other editor activations (i.e editors that do not use this contributor).\r
+               partListener = new IPartListener() {\r
+                       \r
+                       @Override\r
+                       public void partOpened(IWorkbenchPart part) {}\r
+                       \r
+                       @Override\r
+                       public void partDeactivated(IWorkbenchPart part) {}\r
+                       \r
+                       @Override\r
+                       public void partClosed(IWorkbenchPart part) {}\r
+                       \r
+                       @Override\r
+                       public void partBroughtToTop(IWorkbenchPart part) {}\r
+                       \r
+                       @Override\r
+                       public void partActivated(IWorkbenchPart part) {\r
+                               if (part instanceof IEditorPart)\r
+                                       setContext2((IEditorPart)part);\r
+                       }\r
+               };\r
+               PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().addPartListener(partListener);\r
                \r
        }\r
        \r
@@ -106,7 +135,9 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
 \r
                        if ("toolbar".equals(key)) {\r
                            toolbarId = value;\r
-                       } \r
+                       }  else if ("hide".equals(key)) {\r
+                               REUSE = !Boolean.parseBoolean(value);\r
+                       }\r
                    }\r
                }\r
                \r
@@ -144,6 +175,26 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                if (DEBUG) System.out.println("Adding command to toolbar " +getToolbarId()  + " " + ext);\r
                String commandId = ext.commandId;\r
                Command command = service.getCommand(commandId);\r
+               ICommandWrapper wrapper = new CommandWrapper(command);\r
+               \r
+               ParameterizedCommand parameterizedCommand = null;\r
+               \r
+               if (ext.parameters.size() > 0) {\r
+                       try {\r
+                               Parameterization parameterizations[] = new Parameterization[ext.parameters.size()];\r
+                               for (int i = 0; i < ext.parameters.size(); i++) {\r
+                                       Parameter param = ext.parameters.get(i);\r
+                                       IParameter parameter = command.getParameter(param.name);\r
+                                       parameterizations[i] = new Parameterization(parameter, param.value);\r
+                               }\r
+                               parameterizedCommand = new ParameterizedCommand(command, parameterizations);\r
+                               wrapper = new ParameterizedCommandWrapper(parameterizedCommand);\r
+                       } catch (org.eclipse.core.commands.common.NotDefinedException e) {\r
+                               e.printStackTrace();\r
+                               ExceptionUtils.logError(e);\r
+                               return;\r
+                       }\r
+               }\r
                \r
                String type = ext.type;\r
                \r
@@ -157,15 +208,15 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                \r
                CommandAction a = null;\r
                if (type.equals("toggle") && toggleState != null) {\r
-                       a = new CommandCheckboxAction(command,name,image);\r
+                       a = new CommandCheckboxAction(wrapper,name,image);\r
 \r
                        stateRegistry.storeDefaultState(commandId);\r
                } else if (radioState != null && ext.value != null) {\r
                        stateRegistry.storeDefaultState(commandId);\r
                        if (type.equals("radio")) {\r
-                               a = new CommandRadioAction(command,name,ext.value,image);\r
+                               a = new CommandRadioAction(wrapper,name,ext.value,image);\r
                        } else if (type.equals("combo")) {\r
-                               a = new CommandRadioAction(command,name,ext.value,image);\r
+                               a = new CommandRadioAction(wrapper,name,ext.value,image);\r
                                ComboContribution combo = menus.get(commandId);\r
                                if (REUSE && combo == null) {\r
                                        combo = (ComboContribution)mgr.find(commandId);\r
@@ -190,7 +241,7 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                                return;\r
                        }\r
                } else if (type.equals("push")) {\r
-                       a = new CommandPushAction(command,name,image);\r
+                       a = new CommandPushAction(wrapper,name,image);\r
                } else {\r
                        if (DEBUG) System.out.println(ext + " is not valid.");\r
                        Logger.defaultLogError(ext + " is not valid.");\r
@@ -267,6 +318,14 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                        setContext((IEditorPart)part);\r
        }\r
        \r
+       private void setContext2(IEditorPart part) {\r
+               if (REUSE)\r
+                       return;\r
+               if (this.activePart == part)\r
+                       return;\r
+               setContext(null);\r
+       }\r
+       \r
        private void setContext(IEditorPart part) {\r
                this.activePart = part;\r
         if (activePart != null && !parts.contains(activePart)) {\r
@@ -289,8 +348,9 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                                        a.setEnabled(false);\r
                                }\r
                                ComboContribution menu = menus.get(commandId);\r
-                               if (menu != null) \r
+                               if (menu != null) {\r
                                        menu.setEnabled(false);\r
+                               }\r
                                \r
                        }\r
         }\r
@@ -323,13 +383,16 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                        actions.clear();\r
                        \r
                        // without this the contributed toolbar widgets would continue reserve the space even when they are destroyed.\r
-                       // TODO : how to make the toolbar fix its layout?\r
-                       // Note: Using REUSE flag alleviates the problem, since the widgets are not removed.\r
                        coolBarManager.update(true);\r
+                       mgr.update(true);\r
                }\r
                CommandStateRegistry.getInstance().removeListener(this);\r
                super.dispose();\r
                activePart = null;\r
+               if (partListener != null) {\r
+                       PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().addPartListener(partListener);\r
+                       partListener = null;\r
+               }\r
        }\r
        \r
        boolean settingState = false;\r
@@ -354,10 +417,12 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
        private void restoreActionStates() {\r
                if (activePart == null)\r
                        return;\r
+               if (DEBUG)System.out.println("Restore " + activePart);\r
                // toggles\r
                Map<String,Boolean> defaultToggleStates = stateRegistry.getDefaultToggleStates();\r
                for (String commandId : defaultToggleStates.keySet()) {\r
                        for (CommandAction a : actions.getValues(commandId)) {\r
+                               if (DEBUG)System.out.println(commandId + " def " + defaultToggleStates.get(commandId));\r
                                a.setChecked(defaultToggleStates.get(commandId));\r
                        }\r
                }\r
@@ -365,6 +430,7 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                if (editorStates != null) {\r
                        for (String commandId : editorStates.keySet()) {\r
                                for (CommandAction a : actions.getValues(commandId)) {\r
+                                       if (DEBUG)System.out.println(commandId + " " + editorStates.get(commandId));\r
                                        a.setChecked(editorStates.get(commandId));\r
                                }\r
                        }\r
@@ -375,6 +441,7 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                        String defaultValue = defaultRadioStates.get(commandId);\r
                        for (CommandAction a : actions.getValues(commandId)) {\r
                                CommandRadioAction r = (CommandRadioAction)a;\r
+                               if (DEBUG)System.out.println(commandId + " def " + r.getValue().equals(defaultValue) +" " + r.getValue());\r
                                r.setChecked(r.getValue().equals(defaultValue));\r
                        }\r
                }\r
@@ -385,6 +452,7 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                                String defaultValue = editorRadioStates.get(commandId);\r
                                for (CommandAction a : actions.getValues(commandId)) {\r
                                        CommandRadioAction r = (CommandRadioAction)a;\r
+                                       if (DEBUG)System.out.println(commandId + " " + r.getValue().equals(defaultValue) +" " + r.getValue());\r
                                        r.setChecked(r.getValue().equals(defaultValue));\r
                                }\r
                        }\r
@@ -434,14 +502,28 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                return (Boolean)toggleState.getValue();\r
        }\r
        \r
-       private abstract class CommandAction extends Action {\r
+       private interface ICommandWrapper {\r
+               \r
+               public Command getCommand();\r
+               public String getCommandId();\r
+               public void run();\r
+       }\r
+       \r
+       private class CommandWrapper implements ICommandWrapper{\r
                private Command command;\r
                \r
-               public CommandAction(Command command, String name, ImageDescriptor image, int style) {\r
-                       super(name,style);\r
+               public CommandWrapper(Command command) {\r
                        this.command = command;\r
-                       if (image != null)\r
-                               setImageDescriptor(image);\r
+               }\r
+               \r
+               @Override\r
+               public Command getCommand() {\r
+                       return command;\r
+               }\r
+               \r
+               @Override\r
+               public String getCommandId() {\r
+                       return command.getId();\r
                }\r
                \r
                @Override\r
@@ -453,35 +535,93 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                        }\r
                }\r
                \r
+               @Override\r
+               public boolean equals(Object obj) {\r
+                       if (obj.getClass() != getClass())\r
+                               return false;\r
+                       CommandWrapper other= (CommandWrapper)obj;\r
+                       return other.getCommandId().equals(getCommandId());\r
+               }\r
+       }\r
+       \r
+       private class ParameterizedCommandWrapper implements ICommandWrapper{\r
+               private ParameterizedCommand command;\r
+               \r
+               public ParameterizedCommandWrapper(ParameterizedCommand command) {\r
+                       this.command = command;\r
+               }\r
+               \r
+               @Override\r
                public Command getCommand() {\r
-                       return command;\r
+                       return command.getCommand();\r
                }\r
                \r
+               @Override\r
                public String getCommandId() {\r
                        return command.getId();\r
                }\r
                \r
+               @Override\r
+               public void run() {\r
+                       try {\r
+                               handlerService.executeCommand(command, null);\r
+                       } catch (Exception e) {\r
+                               e.printStackTrace();\r
+                       }\r
+               }\r
+               \r
+               @Override\r
+               public boolean equals(Object obj) {\r
+                       if (obj.getClass() != getClass())\r
+                               return false;\r
+                       ParameterizedCommandWrapper other= (ParameterizedCommandWrapper)obj;\r
+                       return other.command.equals(command);\r
+               }\r
+       }\r
+       \r
+       private abstract class CommandAction extends Action {\r
+               private ICommandWrapper command;\r
+               \r
+               public CommandAction(ICommandWrapper command, String name, ImageDescriptor image, int style) {\r
+                       super(name,style);\r
+                       this.command = command;\r
+                       if (image != null)\r
+                               setImageDescriptor(image);\r
+               }\r
+               \r
+               @Override\r
+               public void run() {\r
+                       command.run();\r
+               }\r
+               \r
+               public Command getCommand() {\r
+                       return command.getCommand();\r
+               }\r
+               \r
+               public String getCommandId() {\r
+                       return command.getCommandId();\r
+               }\r
+               \r
 \r
                @Override\r
                public boolean equals(Object obj) {\r
                        if (obj.getClass() != getClass())\r
                                return false;\r
                        CommandAction other= (CommandAction)obj;\r
-                       if (!other.getCommandId().equals(getCommandId()))\r
-                               return false;\r
-                       return true;\r
+                       return command.equals(other.command);\r
                }\r
 \r
                \r
                @Override\r
                public int hashCode() {\r
-                       return command.getId().hashCode();\r
+                       return command.getCommandId().hashCode();\r
                }\r
        }\r
        \r
+       \r
        private class CommandCheckboxAction extends CommandAction {\r
                \r
-               public CommandCheckboxAction(Command command, String name, ImageDescriptor image) {\r
+               public CommandCheckboxAction(ICommandWrapper command, String name, ImageDescriptor image) {\r
                        super(command,name,image,Action.AS_CHECK_BOX);\r
                        \r
                }\r
@@ -505,7 +645,7 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
 \r
                private String value;\r
                \r
-               public CommandRadioAction(Command command, String name, String value, ImageDescriptor image) {\r
+               public CommandRadioAction(ICommandWrapper command, String name, String value, ImageDescriptor image) {\r
                        super(command,name,image,Action.AS_RADIO_BUTTON);\r
                        this.value = value;\r
                }\r
@@ -543,7 +683,7 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
 \r
        private class CommandPushAction extends CommandAction {\r
                \r
-               public CommandPushAction(Command command, String name, ImageDescriptor image) {\r
+               public CommandPushAction(ICommandWrapper command, String name, ImageDescriptor image) {\r
                        super(command,name,image,Action.AS_PUSH_BUTTON);\r
                }\r
 \r
@@ -615,6 +755,12 @@ public class ToolbarContributor extends EditorActionBarContributor implements IC
                        if (combo != null)\r
                                combo.setEnabled(enabled);\r
                }\r
+               \r
+               @Override\r
+               public void dispose() {\r
+                       combo.dispose();\r
+                       super.dispose();\r
+               }\r
        }\r
        \r
 }\r