Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/part/DiagramEditorContextMenuProvider.java')
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/part/DiagramEditorContextMenuProvider.java81
1 files changed, 81 insertions, 0 deletions
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/part/DiagramEditorContextMenuProvider.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/part/DiagramEditorContextMenuProvider.java
new file mode 100644
index 00000000000..ab9f55b0d22
--- /dev/null
+++ b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/part/DiagramEditorContextMenuProvider.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2009 ATOS ORIGIN.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan FAURE (ATOS ORIGIN) tristan.faure@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.internalblock.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart part;
+
+ /**
+ * @generated
+ */
+ private DeleteElementAction deleteAction;
+
+ /**
+ * @generated
+ */
+ public DiagramEditorContextMenuProvider(IWorkbenchPart part, EditPartViewer viewer) {
+ super(part, viewer);
+ this.part = part;
+ deleteAction = new DeleteElementAction(part);
+ deleteAction.init();
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ if (deleteAction != null) {
+ deleteAction.dispose();
+ deleteAction = null;
+ }
+ super.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public void buildContextMenu(final IMenuManager menu) {
+ getViewer().flush();
+ try {
+ TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()).runExclusive(
+ new Runnable() {
+
+ public void run() {
+ ContributionItemService.getInstance().contributeToPopupMenu(
+ DiagramEditorContextMenuProvider.this, part);
+ menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
+ menu.appendToGroup("editGroup", deleteAction);
+ }
+ });
+ } catch (Exception e) {
+ InternalBlockDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
+ }
+ }
+}

Back to the top