Bug 553167 - [Moka] Two identical menus
* Remove Moka -> Breakpoints menu
* Move code created the Trace and Debug menu from
org.eclipse.papyrus.moka.tracepoint.service to
org.eclipse.papyrus.moka.ui
Change-Id: I224f19dfb91a87fab998c577a06019b174972ea3
Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/META-INF/MANIFEST.MF b/plugins/org.eclipse.papyrus.moka.tracepoint.service/META-INF/MANIFEST.MF
index 8450018..a0747fd 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.papyrus.moka.tracepoint.service/META-INF/MANIFEST.MF
@@ -19,6 +19,5 @@
Automatic-Module-Name: org.eclipse.papyrus.moka.tracepoint.service
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.moka.tracepoint.service,
- org.eclipse.papyrus.moka.tracepoint.service.commands,
org.eclipse.papyrus.moka.tracepoint.service.dialogs,
org.eclipse.papyrus.moka.tracepoint.service.preferences
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/plugin.xml b/plugins/org.eclipse.papyrus.moka.tracepoint.service/plugin.xml
index 0cddb56..e8f5e08 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/plugin.xml
+++ b/plugins/org.eclipse.papyrus.moka.tracepoint.service/plugin.xml
@@ -2,140 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="traceMechanism" name="traceMechanism" schema="schema/traceMechanism.exsd"/>
-
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="true"
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
- <menu
- icon="icons/etool16/debug.gif"
- id="org.eclipse.papyrus.views.modelexplorer.popup.tracing"
- label="Trace and Debug">
- </menu>
- </menuContribution>
- <menuContribution
- allPopups="true"
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popup.tracing">
- <command
- commandId="org.eclipse.papyrus.tracepoints.togglebreakpoint"
- icon="icons/etool16/brkp_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.togglebreakpoint"
- label="Toggle breakpoint">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.togglebreakpointactivation"
- icon="icons/etool16/brkpd_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.togglebreakpointactivation"
- label="Toggle breakpoint activation">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.toggletracepoint"
- icon="icons/etool16/trcp_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.toggletracepoint"
- label="Toggle tracepoint">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.toggletracepointactivation"
- icon="icons/etool16/trcpd_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.toggletracepointactivation"
- label="Toggle tracepoint activation">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.tracepointproperties"
- icon="icons/etool16/properties.gif"
- id="org.eclipse.papyrus.tracepoints.tracepointproperties"
- label="Tracepoint properties">
- </command>
- </menuContribution>
- </extension>
-
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="true"
- locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
- <menu
- icon="icons/etool16/debug.gif"
- id="org.eclipse.papyrus.views.gmf.popup.tracing"
- label="Trace and Debug">
- </menu>
- </menuContribution>
- <menuContribution
- allPopups="true"
- locationURI="popup:org.eclipse.papyrus.views.gmf.popup.tracing">
- <command
- commandId="org.eclipse.papyrus.tracepoints.togglebreakpoint"
- icon="icons/etool16/brkp_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.toggletracepoint"
- label="Toggle breakpoint">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.togglebreakpointactivation"
- icon="icons/etool16/brkpd_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.togglebreakpointactivation"
- label="Toggle breakpoint activation">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.toggletracepoint"
- icon="icons/etool16/trcp_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.toggletracepoint"
- label="Toggle tracepoint">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.toggletracepointactivation"
- icon="icons/etool16/trcpd_16x16.gif"
- id="org.eclipse.papyrus.tracepoints.toggletracepointactivation"
- label="Toggle tracepoint activation">
- </command>
- <command
- commandId="org.eclipse.papyrus.tracepoints.tracepointproperties"
- icon="icons/etool16/properties.gif"
- id="org.eclipse.papyrus.tracepoints.tracepointproperties"
- label="Tracepoint properties">
- </command>
- </menuContribution>
- </extension>
-
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.tracepoint.service.handler.ToggleBreakpointHandler"
- description="ToggleBreakpoint"
- id="org.eclipse.papyrus.tracepoints.togglebreakpoint"
- name="ToggleBreakpoint">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.tracepoint.service.handler.ToggleBreakpointActivationHandler"
- description="ToggleBreakpointActivation"
- id="org.eclipse.papyrus.tracepoints.togglebreakpointactivation"
- name="ToggleBreakpointActivation">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.tracepoint.service.handler.ToggleTracepointHandler"
- description="ToggleTracepoint"
- id="org.eclipse.papyrus.tracepoints.toggletracepoint"
- name="ToggleTracepoint">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.tracepoint.service.handler.ToggleTracepointActivationHandler"
- description="ToggleTracepointActivation"
- id="org.eclipse.papyrus.tracepoints.toggletracepointactivation"
- name="ToggleTracepointActivation">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.tracepoint.service.handler.TracepointPropertiesHandler"
- description="TracepointPropertoes"
- id="org.eclipse.papyrus.tracepoints.tracepointproperties"
- name="TracepointProperties">
- </command>
- </extension>
-
+
<extension
point="org.eclipse.papyrus.infra.services.decoration.decorationSpecificFunctions">
<client
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleBreakpointActivationHandler.java b/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleBreakpointActivationHandler.java
deleted file mode 100644
index 393c316..0000000
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleBreakpointActivationHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Ansgar Radermacher (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.moka.tracepoint.service.handler;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.moka.tracepoint.service.commands.ToggleBreakpointActivationCommand;
-
-/**
- * An handler for managing activation/deactivation of a Breakpoint
- *
- */
-public class ToggleBreakpointActivationHandler extends AbstractCommandHandler {
-
- @Override
- protected Command getCommand() {
- return new GMFtoEMFCommandWrapper(new ToggleBreakpointActivationCommand(getSelectedElement()));
- }
-
-}
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleBreakpointHandler.java b/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleBreakpointHandler.java
deleted file mode 100644
index ab11014..0000000
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleBreakpointHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Ansgar Radermacher (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.handler;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.moka.tracepoint.service.commands.ToggleBreakpointCommand;
-
-/**
- * A handler for managing creation/destruction of a Breakpoint
- *
- */
-public class ToggleBreakpointHandler extends AbstractCommandHandler {
-
- @Override
- protected Command getCommand() {
- return new GMFtoEMFCommandWrapper(new ToggleBreakpointCommand(getSelectedElement()));
- }
-
-}
diff --git a/plugins/org.eclipse.papyrus.moka.ui.tracepoint.view/src/org/eclipse/papyrus/moka/ui/tracepoint/view/TracepointView.java b/plugins/org.eclipse.papyrus.moka.ui.tracepoint.view/src/org/eclipse/papyrus/moka/ui/tracepoint/view/TracepointView.java
index b46f847..ba9d18c 100644
--- a/plugins/org.eclipse.papyrus.moka.ui.tracepoint.view/src/org/eclipse/papyrus/moka/ui/tracepoint/view/TracepointView.java
+++ b/plugins/org.eclipse.papyrus.moka.ui.tracepoint.view/src/org/eclipse/papyrus/moka/ui/tracepoint/view/TracepointView.java
@@ -54,6 +54,7 @@
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.moka.tracepoint.service.MarkerUtils;
+import org.eclipse.papyrus.moka.tracepoint.service.TraceMechanism;
import org.eclipse.papyrus.moka.tracepoint.service.TraceState;
import org.eclipse.papyrus.moka.tracepoint.service.TracepointConstants;
import org.eclipse.papyrus.moka.tracepoint.service.dialogs.TraceActionSelection;
@@ -473,6 +474,12 @@
actionTraceSelect.setText("Trace Action"); //$NON-NLS-1$
actionTraceSelect.setToolTipText("Select Trace Action"); //$NON-NLS-1$
actionTraceSelect.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+
+ if (TraceMechanism.getTraceMechanisms().isEmpty()) {
+ actionTraceSelect.setEnabled(false);
+ String tooltip = actionTraceSelect.getToolTipText();
+ actionTraceSelect.setToolTipText(tooltip + " (no plugins provide trace extension mechanism)"); //$NON-NLS-1$
+ }
}
protected void hookDoubleClickAction() {
diff --git a/plugins/org.eclipse.papyrus.moka.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.papyrus.moka.ui/META-INF/MANIFEST.MF
index 3dc5efc..60c16eb 100644
--- a/plugins/org.eclipse.papyrus.moka.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.papyrus.moka.ui/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@
org.eclipse.papyrus.moka.ui.tracepoint.view,
org.eclipse.papyrus.moka.trace.interfaces,
org.eclipse.papyrus.moka.trace,
+ org.eclipse.papyrus.moka.tracepoint.service;bundle-version="[4.0.0,5.0.0)",
org.eclipse.e4.ui.css.core;bundle-version="[0.12.700,0.13.0)"
Export-Package: org.eclipse.papyrus.moka.launch,
org.eclipse.papyrus.moka.ui,
diff --git a/plugins/org.eclipse.papyrus.moka.ui/icons/properties.gif b/plugins/org.eclipse.papyrus.moka.ui/icons/properties.gif
new file mode 100644
index 0000000..1dc19a3
--- /dev/null
+++ b/plugins/org.eclipse.papyrus.moka.ui/icons/properties.gif
Binary files differ
diff --git a/plugins/org.eclipse.papyrus.moka.ui/icons/trcp_16x16.gif b/plugins/org.eclipse.papyrus.moka.ui/icons/trcp_16x16.gif
new file mode 100644
index 0000000..29ec606
--- /dev/null
+++ b/plugins/org.eclipse.papyrus.moka.ui/icons/trcp_16x16.gif
Binary files differ
diff --git a/plugins/org.eclipse.papyrus.moka.ui/icons/trcpd_16x16.gif b/plugins/org.eclipse.papyrus.moka.ui/icons/trcpd_16x16.gif
new file mode 100644
index 0000000..76c65b6
--- /dev/null
+++ b/plugins/org.eclipse.papyrus.moka.ui/icons/trcpd_16x16.gif
Binary files differ
diff --git a/plugins/org.eclipse.papyrus.moka.ui/plugin.xml b/plugins/org.eclipse.papyrus.moka.ui/plugin.xml
index e1a8a15..82290ee 100644
--- a/plugins/org.eclipse.papyrus.moka.ui/plugin.xml
+++ b/plugins/org.eclipse.papyrus.moka.ui/plugin.xml
@@ -54,39 +54,11 @@
checkEnabled="false">
</visibleWhen>
</command>
- <menu
- icon="icons/brkp_16x16.gif"
- id="org.eclipse.papyrus.views.modelexplorer.popup.moka.debug"
- label="Breakpoints">
- <visibleWhen
- checkEnabled="true">
- </visibleWhen>
- </menu>
</menuContribution>
<menuContribution
allPopups="true"
locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popup.moka.debug">
<command
- commandId="org.eclipse.papyrus.moka.togglebreakpoint"
- icon="icons/brkp_16x16.gif"
- id="org.eclipse.papyrus.moka.togglebreakpoint"
- label="Toggle breakpoint"
- style="push">
- <visibleWhen
- checkEnabled="true">
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.moka.togglebreakpointactivation"
- icon="icons/brkpd_16x16.gif"
- id="org.eclipse.papyrus.moka.togglebreakpointactivation"
- label="Toggle breakpoint activation"
- style="push">
- <visibleWhen
- checkEnabled="true">
- </visibleWhen>
- </command>
- <command
commandId="org.eclipse.papyrus.moka.ui.runAsCommand"
icon="icons/run.gif"
label="Run"
@@ -94,6 +66,49 @@
<visibleWhen checkEnabled="false"></visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <menu
+ icon="icons/debug.gif"
+ id="org.eclipse.papyrus.views.modelexplorer.popup.traceanddebug"
+ label="Trace and Debug">
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popup.traceanddebug">
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpoint"
+ icon="icons/brkp_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpoint"
+ label="Toggle breakpoint">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpointactivation"
+ icon="icons/brkpd_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpointactivation"
+ label="Toggle breakpoint activation">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepoint"
+ icon="icons/trcp_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepoint"
+ label="Toggle tracepoint">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepointactivation"
+ icon="icons/trcpd_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepointactivation"
+ label="Toggle tracepoint activation">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.tracepointproperties"
+ icon="icons/properties.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.tracepointproperties"
+ label="Tracepoint properties">
+ </command>
+ </menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
@@ -136,49 +151,54 @@
</visibleWhen>
</menu>
</menuContribution>
- <menuContribution
- allPopups="true"
- locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu.moka.debug">
- <command
- commandId="org.eclipse.papyrus.moka.togglebreakpoint"
- icon="icons/brkp_16x16.gif"
- id="org.eclipse.papyrus.moka.togglebreakpoint.diagram"
- label="Toggle breakpoint"
- style="push">
- <visibleWhen
- checkEnabled="true">
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.moka.togglebreakpointactivation"
- icon="icons/brkpd_16x16.gif"
- id="org.eclipse.papyrus.moka.togglebreakpointactivation.diagram"
- label="Toggle breakpoint activation"
- style="push">
- <visibleWhen
- checkEnabled="true">
- </visibleWhen>
- </command>
- </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
+ <menu
+ icon="icons/debug.gif"
+ id="org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu.popup.traceanddebug"
+ label="Trace and Debug">
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu.popup.traceanddebug">
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpoint"
+ icon="icons/brkp_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpoint"
+ label="Toggle breakpoint">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpointactivation"
+ icon="icons/brkpd_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpointactivation"
+ label="Toggle breakpoint activation">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepoint"
+ icon="icons/trcp_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepoint"
+ label="Toggle tracepoint">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepointactivation"
+ icon="icons/trcpd_16x16.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepointactivation"
+ label="Toggle tracepoint activation">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.moka.ui.traceanddebug.tracepointproperties"
+ icon="icons/properties.gif"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.tracepointproperties"
+ label="Tracepoint properties">
+ </command>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.ToggleBreakpointHandler"
- description="ToggleBreakpoint"
- id="org.eclipse.papyrus.moka.togglebreakpoint"
- name="ToggleBreakpoing">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.ToggleBreakpointActivationHandler"
- description="ToggleBreakpointActivation"
- id="org.eclipse.papyrus.moka.togglebreakpointactivation"
- name="ToggleBreakpointActivation">
- </command>
- <command
- categoryId="org.eclipse.papyrus.editor.category"
description="DebugAsCommand"
id="org.eclipse.papyrus.moka.ui.debugAsCommand"
name="DebugAsCommand">
@@ -189,6 +209,41 @@
id="org.eclipse.papyrus.moka.ui.runAsCommand"
name="RunAsCommand">
</command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.ToggleBreakpointHandler"
+ description="ToggleBreakpoint"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpoint"
+ name="ToggleBreakpoint">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.ToggleBreakpointActivationHandler"
+ description="ToggleBreakpointActivation"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.togglebreakpointactivation"
+ name="ToggleBreakpointActivation">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.ToggleTracepointHandler"
+ description="ToggleTracepoint"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepoint"
+ name="ToggleTracepoint">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.ToggleTracepointActivationHandler"
+ description="ToggleTracepointActivation"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.toggletracepointactivation"
+ name="ToggleTracepointActivation">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.moka.ui.breakpoint.handlers.TracepointPropertiesHandler"
+ description="TracepointProperties"
+ id="org.eclipse.papyrus.moka.ui.traceanddebug.tracepointproperties"
+ name="TracepointProperties">
+ </command>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/AbstractTracepointCommand.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/AbstractTraceAndDebugCommand.java
similarity index 94%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/AbstractTracepointCommand.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/AbstractTraceAndDebugCommand.java
index b04cae9..9892bfc 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/AbstractTracepointCommand.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/AbstractTraceAndDebugCommand.java
@@ -13,7 +13,7 @@
* Ansgar Radermarcher (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.commands;
+package org.eclipse.papyrus.moka.ui.breakpoint.commands;
import java.util.Collections;
@@ -44,7 +44,7 @@
*
* @author Ansgar Radermacher (CEA LIST)
*/
-abstract public class AbstractTracepointCommand extends AbstractTransactionalCommand {
+abstract public class AbstractTraceAndDebugCommand extends AbstractTransactionalCommand {
protected TransactionalEditingDomain domain;
@@ -60,7 +60,7 @@
* @param selectedElement
* a selected element
*/
- public AbstractTracepointCommand(String label, TransactionalEditingDomain domain, EObject selectedElement) {
+ public AbstractTraceAndDebugCommand(String label, TransactionalEditingDomain domain, EObject selectedElement) {
super(domain, label, Collections.EMPTY_LIST);
this.domain = domain;
this.selectedElement = selectedElement;
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleBreakpointActivationCommand.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleBreakpointActivationCommand.java
similarity index 96%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleBreakpointActivationCommand.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleBreakpointActivationCommand.java
index 12bd0b7..5b85e5b 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleBreakpointActivationCommand.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleBreakpointActivationCommand.java
@@ -15,7 +15,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.commands;
+package org.eclipse.papyrus.moka.ui.breakpoint.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
@@ -35,7 +35,7 @@
/**
* Command to toggle a breakpoint activation
*/
-public class ToggleBreakpointActivationCommand extends AbstractTracepointCommand {
+public class ToggleBreakpointActivationCommand extends AbstractTraceAndDebugCommand {
public ToggleBreakpointActivationCommand(EObject selectedElement) {
super("Toggle breakpoint activation", TransactionUtil.getEditingDomain(selectedElement), selectedElement); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleBreakpointCommand.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleBreakpointCommand.java
similarity index 95%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleBreakpointCommand.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleBreakpointCommand.java
index f088ddf..ada7b97 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleBreakpointCommand.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleBreakpointCommand.java
@@ -14,7 +14,7 @@
* Pauline DEVILLe (CEA LIST ) - Bug 546467
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.commands;
+package org.eclipse.papyrus.moka.ui.breakpoint.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
@@ -35,7 +35,7 @@
/**
* Command to toggle a breakpoint
*/
-public class ToggleBreakpointCommand extends AbstractTracepointCommand {
+public class ToggleBreakpointCommand extends AbstractTraceAndDebugCommand {
public ToggleBreakpointCommand(EObject selectedElement) {
super("Toggle Breakpoint", TransactionUtil.getEditingDomain(selectedElement), selectedElement); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleTracepointActivationCommand.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleTracepointActivationCommand.java
similarity index 94%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleTracepointActivationCommand.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleTracepointActivationCommand.java
index 55505e3..78a4b40 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleTracepointActivationCommand.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleTracepointActivationCommand.java
@@ -14,7 +14,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.commands;
+package org.eclipse.papyrus.moka.ui.breakpoint.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
@@ -24,7 +24,7 @@
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-public class ToggleTracepointActivationCommand extends AbstractTracepointCommand {
+public class ToggleTracepointActivationCommand extends AbstractTraceAndDebugCommand {
public ToggleTracepointActivationCommand(EObject selectedElement) {
super("Toggle tracepoint activation", TransactionUtil.getEditingDomain(selectedElement), selectedElement); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleTracepointCommand.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleTracepointCommand.java
similarity index 93%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleTracepointCommand.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleTracepointCommand.java
index 5be4a7a..af0453a 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/ToggleTracepointCommand.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/ToggleTracepointCommand.java
@@ -13,7 +13,7 @@
* Ansgar Radermacher (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.commands;
+package org.eclipse.papyrus.moka.ui.breakpoint.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IMarker;
@@ -28,7 +28,7 @@
import org.eclipse.papyrus.moka.tracepoint.service.TracepointConstants;
-public class ToggleTracepointCommand extends AbstractTracepointCommand {
+public class ToggleTracepointCommand extends AbstractTraceAndDebugCommand {
public ToggleTracepointCommand(EObject selectedElement) {
super("Toggle tracepoint", TransactionUtil.getEditingDomain(selectedElement), selectedElement); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/TracepointPropertiesCommand.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/TracepointPropertiesCommand.java
similarity index 94%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/TracepointPropertiesCommand.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/TracepointPropertiesCommand.java
index 35992fc..381cc45 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/commands/TracepointPropertiesCommand.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/commands/TracepointPropertiesCommand.java
@@ -14,7 +14,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.commands;
+package org.eclipse.papyrus.moka.ui.breakpoint.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IMarker;
@@ -30,8 +30,7 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
-
-public class TracepointPropertiesCommand extends AbstractTracepointCommand {
+public class TracepointPropertiesCommand extends AbstractTraceAndDebugCommand {
public TracepointPropertiesCommand(EObject selectedElement) {
super("Tracepoint properties", TransactionUtil.getEditingDomain(selectedElement), selectedElement); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/AbstractCommandHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/AbstractTraceAndDebugCommandHandler.java
similarity index 75%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/AbstractCommandHandler.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/AbstractTraceAndDebugCommandHandler.java
index faf75e0..9ae42b7 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/AbstractCommandHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/AbstractTraceAndDebugCommandHandler.java
@@ -13,12 +13,11 @@
* Ansgar Radermacher (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.handler;
+package org.eclipse.papyrus.moka.ui.breakpoint.handlers;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
@@ -29,7 +28,6 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
import org.eclipse.ui.PlatformUI;
@@ -44,7 +42,7 @@
*
* </pre>
*/
-public abstract class AbstractCommandHandler extends AbstractHandler {
+public abstract class AbstractTraceAndDebugCommandHandler extends MokaAbstractHandler {
/**
* <pre>
@@ -60,38 +58,6 @@
/**
* <pre>
- * Get the selected element, the first selected element if several are selected or null
- * if no selection or the selection is not an {@link EObject}.
- *
- * @return selected {@link EObject} or null
- * </pre>
- *
- */
- protected EObject getSelectedElement() {
- EObject eObject = null;
- Object selection = null;
-
- // Get current selection
- selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
-
- // Get first element if the selection is an IStructuredSelection
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- selection = structuredSelection.getFirstElement();
- }
-
- // Treat non-null selected object (try to adapt and return EObject)
- if (selection != null) {
- Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(selection);
- if (businessObject instanceof EObject) {
- eObject = (EObject) businessObject;
- }
- }
- return eObject;
- }
-
- /**
- * <pre>
* Parse current selection and extract the list of {@link EObject} from
* this selection.
*
diff --git a/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/MokaAbstractHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/MokaAbstractHandler.java
index d37ad26..7a92698 100644
--- a/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/MokaAbstractHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/MokaAbstractHandler.java
@@ -23,7 +23,7 @@
import org.eclipse.ui.PlatformUI;
/**
- * An abstract handler, used as a basis for ToggleBreakpointActivationHandler, and ToggleBreakpointHandler.
+ * An abstract handler, used as a basis for DebugAsHandler, and RunAsHandler.
*
*/
public abstract class MokaAbstractHandler extends AbstractHandler {
diff --git a/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointActivationHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointActivationHandler.java
index e7941af..1ff5196 100644
--- a/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointActivationHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointActivationHandler.java
@@ -10,63 +10,25 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * CEA LIST - Initial API and implementation
+ * Ansgar Radermacher (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
+
package org.eclipse.papyrus.moka.ui.breakpoint.handlers;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.core.Activator;
-import org.eclipse.papyrus.moka.debug.breakpoint.MokaBreakpoint;
-import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.moka.ui.breakpoint.commands.ToggleBreakpointActivationCommand;
/**
- * An handler for managing activation/deactivation of a Moka Breakpoint
+ * An handler for managing activation/deactivation of a Breakpoint
*
*/
-public class ToggleBreakpointActivationHandler extends MokaAbstractHandler implements IHandler {
+public class ToggleBreakpointActivationHandler extends AbstractTraceAndDebugCommandHandler {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- EObject selectedElement = this.getSelectedElement();
- String selectedElementURI = EcoreUtil.getURI(selectedElement).toString();
- if (selectedElement != null) {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = breakpointManager.getBreakpoints(MokaConstants.MOKA_DEBUG_MODEL_ID);
- IBreakpoint alreadyDefinedBreakpoint = null;
- for (int i = 0; i < breakpoints.length && alreadyDefinedBreakpoint == null; i++) {
- MokaBreakpoint breakpoint = (MokaBreakpoint) breakpoints[i];
- EObject eObjectOfBreakpoint = breakpoint.getModelElement();
- if (eObjectOfBreakpoint != null && EcoreUtil.getURI(eObjectOfBreakpoint).toString().equals(selectedElementURI)) {
- alreadyDefinedBreakpoint = breakpoint;
- }
- }
-
- if (alreadyDefinedBreakpoint != null) {
- try {
- boolean enabledOrDisabled = !alreadyDefinedBreakpoint.isEnabled();
- alreadyDefinedBreakpoint.setEnabled(enabledOrDisabled);
- DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(alreadyDefinedBreakpoint);
- } catch (CoreException e) {
- Activator.log.error(e);
- }
- }
- return null;
- }
-
- return null;
+ @Override
+ protected Command getCommand() {
+ return new GMFtoEMFCommandWrapper(new ToggleBreakpointActivationCommand(getSelectedElement()));
}
}
diff --git a/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointHandler.java
index 3082738..7b79a8c 100644
--- a/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleBreakpointHandler.java
@@ -10,70 +10,24 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * CEA LIST - Initial API and implementation
+ * Ansgar Radermacher (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.moka.ui.breakpoint.handlers;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EValidator;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.core.Activator;
-import org.eclipse.papyrus.moka.debug.breakpoint.MokaBreakpoint;
-import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.moka.ui.breakpoint.commands.ToggleBreakpointCommand;
/**
- * A handler for managing creation/destruction of a Moka Breakpoint
+ * A handler for managing creation/destruction of a Breakpoint
*
*/
-public class ToggleBreakpointHandler extends MokaAbstractHandler implements IHandler {
+public class ToggleBreakpointHandler extends AbstractTraceAndDebugCommandHandler {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- EObject selectedElement = this.getSelectedElement();
- String selectedElementURI = EcoreUtil.getURI(selectedElement).toString();
- if (selectedElement != null) {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = breakpointManager.getBreakpoints(MokaConstants.MOKA_DEBUG_MODEL_ID);
- IBreakpoint alreadyDefinedBreakpoint = null;
- for (int i = 0; i < breakpoints.length && alreadyDefinedBreakpoint == null; i++) {
- MokaBreakpoint breakpoint = (MokaBreakpoint) breakpoints[i];
- String eObjectOfBreakpointUri = null;
- try {
- eObjectOfBreakpointUri = (String) breakpoint.getMarker().getAttribute(EValidator.URI_ATTRIBUTE);
- } catch (CoreException e) {
- Activator.log.error(e);
- }
- if (eObjectOfBreakpointUri.equals(selectedElementURI)) {
- alreadyDefinedBreakpoint = breakpoint;
- }
- }
- try {
- if (alreadyDefinedBreakpoint != null) {
- breakpointManager.removeBreakpoint(alreadyDefinedBreakpoint, true);
- } else {
- MokaBreakpoint breakpoint = new MokaBreakpoint();
- breakpoint.toggleBreakpoint(selectedElement);
- breakpointManager.addBreakpoint(breakpoint);
- }
- } catch (CoreException e) {
- Activator.log.error(e);
- }
- return null;
- }
-
- return null;
+ @Override
+ protected Command getCommand() {
+ return new GMFtoEMFCommandWrapper(new ToggleBreakpointCommand(getSelectedElement()));
}
}
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleTracepointActivationHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleTracepointActivationHandler.java
similarity index 80%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleTracepointActivationHandler.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleTracepointActivationHandler.java
index 4f37fa9..9113ed5 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleTracepointActivationHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleTracepointActivationHandler.java
@@ -14,16 +14,16 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.handler;
+package org.eclipse.papyrus.moka.ui.breakpoint.handlers;
import org.eclipse.emf.common.command.Command;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.moka.tracepoint.service.commands.ToggleTracepointActivationCommand;
+import org.eclipse.papyrus.moka.ui.breakpoint.commands.ToggleTracepointActivationCommand;
/**
* Handler for toggling tracepoint activation. Delegates to associated command
*/
-public class ToggleTracepointActivationHandler extends AbstractCommandHandler {
+public class ToggleTracepointActivationHandler extends AbstractTraceAndDebugCommandHandler {
@Override
protected Command getCommand() {
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleTracepointHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleTracepointHandler.java
similarity index 81%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleTracepointHandler.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleTracepointHandler.java
index c682087..8dd78f3 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/ToggleTracepointHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/ToggleTracepointHandler.java
@@ -14,18 +14,18 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.handler;
+package org.eclipse.papyrus.moka.ui.breakpoint.handlers;
import org.eclipse.emf.common.command.Command;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.moka.tracepoint.service.commands.ToggleTracepointCommand;
+import org.eclipse.papyrus.moka.ui.breakpoint.commands.ToggleTracepointCommand;
/**
* Handler for toggling a tracepoint. Delegates to associated command
*
* @author Ansgar Radermacher (CEA LIST)
*/
-public class ToggleTracepointHandler extends AbstractCommandHandler {
+public class ToggleTracepointHandler extends AbstractTraceAndDebugCommandHandler {
@Override
protected Command getCommand() {
diff --git a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/TracepointPropertiesHandler.java b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/TracepointPropertiesHandler.java
similarity index 68%
rename from plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/TracepointPropertiesHandler.java
rename to plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/TracepointPropertiesHandler.java
index d836021..f18db4b 100644
--- a/plugins/org.eclipse.papyrus.moka.tracepoint.service/src/org/eclipse/papyrus/moka/tracepoint/service/handler/TracepointPropertiesHandler.java
+++ b/plugins/org.eclipse.papyrus.moka.ui/src/org/eclipse/papyrus/moka/ui/breakpoint/handlers/TracepointPropertiesHandler.java
@@ -14,20 +14,31 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.tracepoint.service.handler;
+package org.eclipse.papyrus.moka.ui.breakpoint.handlers;
import org.eclipse.emf.common.command.Command;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.moka.tracepoint.service.commands.TracepointPropertiesCommand;
+import org.eclipse.papyrus.moka.tracepoint.service.TraceMechanism;
+import org.eclipse.papyrus.moka.ui.breakpoint.commands.TracepointPropertiesCommand;
/**
* Handler for changing the properties of a tracepoint. Delegates to associated command
*/
-public class TracepointPropertiesHandler extends AbstractCommandHandler {
+public class TracepointPropertiesHandler extends AbstractTraceAndDebugCommandHandler {
@Override
protected Command getCommand() {
// not useful to cache command, since selected element may change
return new GMFtoEMFCommandWrapper(new TracepointPropertiesCommand(getSelectedElement()));
}
+
+ @Override
+ public boolean isEnabled() {
+ boolean result = super.isEnabled();
+
+ result &= TraceMechanism.getTraceMechanisms().isEmpty() == false;
+
+ return result;
+ }
+
}