Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2022-01-26 16:28:25 +0000
committerPatrick Tessier2022-01-28 17:56:04 +0000
commit13eae9635eec680ec415ef66dd3b3752766c04f9 (patch)
tree9573dea897fb5769a4d7d11906ca572b1d089837 /plugins
parentb34cdd3ffb5fe1dfda19365d9dac80e5ef01ac01 (diff)
downloadorg.eclipse.papyrus-13eae9635eec680ec415ef66dd3b3752766c04f9.tar.gz
org.eclipse.papyrus-13eae9635eec680ec415ef66dd3b3752766c04f9.tar.xz
org.eclipse.papyrus-13eae9635eec680ec415ef66dd3b3752766c04f9.zip
Bug 577822 - [Diagram][Menu] The menu declared for Papyrus GMF Diagram
are also visible/active on Sirius Diagram and it should not - Hide the menu - Hide the toolbar - the visibleWhen condition is done on selection in order to be properly refreshed Change-Id: Ibf6fc1561c47d98bcd90941d4a61b62285d47b41 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml26
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/internal/common/expressions/PapyrusGMFDiagramTester.java66
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml195
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/pom.xml2
5 files changed, 201 insertions, 90 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index fd848859279..84919191723 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -43,14 +43,17 @@
label="Refresh"
style="push"
tooltip="Refresh the current diagram">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ <visibleWhen>
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
+ </and>
</visibleWhen>
</command>
</menuContribution>
@@ -220,6 +223,13 @@
properties="canDelete,isSemanticDeletion"
type="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
</propertyTester>
+ <propertyTester
+ class="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester"
+ id="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester"
+ namespace="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester"
+ properties="isPapyrusGMFDiagramActive"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
</extension>
<extension
point="org.eclipse.ui.menus">
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/internal/common/expressions/PapyrusGMFDiagramTester.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/internal/common/expressions/PapyrusGMFDiagramTester.java
new file mode 100644
index 00000000000..776ba74e5b6
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/internal/common/expressions/PapyrusGMFDiagramTester.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2021 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.ui.util.EditorHelper;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * This tester is used to check if the current Editor is a Papyrus GMF diagram (and not a papyrus Sirius Diagram) (see bug 577822)
+ */
+public class PapyrusGMFDiagramTester extends PropertyTester {
+
+ /**
+ * this property is used to know is the current Editor is a Papyrus GMF diagram (and not a papyrus Sirius Diagram)
+ */
+ private static final String IS_PAPYRUS_GMF_DIAGRAM_ACTIVE = "isPapyrusGMFDiagramActive";//$NON-NLS-1$
+
+
+ /**
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ *
+ * @param receiver
+ * @param property
+ * @param args
+ * @param expectedValue
+ * @return
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (IS_PAPYRUS_GMF_DIAGRAM_ACTIVE.equals(property) && receiver instanceof IStructuredSelection && expectedValue instanceof Boolean) {
+ return expectedValue.equals(isPapyrusGMFDiagramActive());
+ }
+ return false;
+ }
+
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the current active editor represents a Papyrus GMF Editor
+ */
+ private final boolean isPapyrusGMFDiagramActive() {
+ IEditorPart editorPart = EditorHelper.getCurrentEditor();
+ // this code also should work when the SynchronizableGmfDiagramEditor is not embedded in the IMultiDiagramEditor
+ if (editorPart instanceof IMultiDiagramEditor) {
+ editorPart = ((IMultiDiagramEditor) editorPart).getActiveEditor();
+ }
+ return editorPart instanceof SynchronizableGmfDiagramEditor;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF
index b566df1ad9f..c1f7c2bda2c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF
@@ -25,7 +25,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)",
org.eclipse.uml2.uml.editor;bundle-version="[5.5.0,6.0.0)"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 3.0.0.qualifier
+Bundle-Version: 3.0.100.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.uml.diagram.menu.Activator
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
index f5322b31ed9..e82ea048453 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
@@ -32,12 +32,16 @@
label="&amp;Diagram"
tooltip="Diagram Menu">
<visibleWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
+ </and>
</visibleWhen>
</menu>
</menuContribution>
@@ -207,12 +211,14 @@
tooltip="Line Style Action">
<visibleWhen>
<and>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -229,11 +235,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -250,11 +258,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -267,11 +277,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -284,11 +296,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -301,11 +315,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -318,11 +334,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -335,11 +353,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -352,11 +372,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -373,10 +395,12 @@
<visibleWhen
checkEnabled="false">
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
</with>
</visibleWhen>
</command>
@@ -387,12 +411,14 @@
tooltip="Auto Size">
<visibleWhen>
<and>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -405,11 +431,13 @@
<visibleWhen>
<and>
<with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</command>
@@ -419,22 +447,29 @@
<visibleWhen
checkEnabled="false">
<and>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
</and>
</visibleWhen>
</dynamic>
- <visibleWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="false"
+ property="org.eclipse.papyrus.infra.gmfdiag.internal.common.expressions.PapyrusGMFDiagramTester.isPapyrusGMFDiagramActive"
+ value="true">
+ </test>
+ </with>
+ </and>
</visibleWhen>
</toolbar>
</menuContribution>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/pom.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/pom.xml
index d2ca70dad93..287d17915b8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/pom.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.diagram.menu</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file

Back to the top