Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-02-11 02:48:20 +0000
committerGerrit Code Review @ Eclipse.org2016-02-12 15:31:41 +0000
commitecd4928b327f5561364c5068c9ff5f1668e92d13 (patch)
tree7c34f46cf82a1d65ac753fa92c2a5d55371b8dba /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu
parent751a204d74e15eb2db6b41c937691fc56dcc1252 (diff)
downloadorg.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.tar.gz
org.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.tar.xz
org.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Factor UI dependencies out of the UML Element Types bundle. This includes moving some advices that interact with the user into a new org.eclipse.papyrus.uml.service.types.ui bundle. Pull up the PasteCommandService and IPasteCommandProvider API into the Infra Diagram layer where the extension point is defined. Deprecate the old API in the UML layer. Introduce a service for participation of languages in CSS styling: * styling reset actions in the Reset Style command * access to semantic model classes and properties to make available to CSS Factor PapyrusObservableValue and cohorts out of the UML Tools bundle into the Infra Layer for more general reuse and to relieve the Diagram Infrastructure layer of UML dependencies. The old API remains as deprecated. Remove the Infra Diagram Layer dependency on UML Layer for property testers governing deletion in the diagram. Includes introduction of a new IGraphicalDeletionHelper OSGi service for delegation of the determination of whether an element can be deleted from the diagram and replacement of the XML expression properties * org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion * org.eclipse.papyrus.uml.diagram.common.isReadOnly by * org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion * org.eclipse.papyrus.infra.gmfdiag.common.canDelete (where the latter is the negation of the property that it supersedes) Extract UML dependencies from the Diagram Outline and CSS Editor bundles. Remove unused MDTUtil APIs that referenced a UML-specific annotation. Move the Diagram Infrastructure CSS Palette bundle into the UML layer because it serves to provide extensions on the Palette Service, which is an overtly UML-specific capability. All client APIs for the Properties View are moved from org.eclipse.papyrus.views.properties bundle to a new org.eclipse.papyrus.infra.properties.ui bundle. This includes renaming of: * extension points * label-provider contexts * XWT namespaces Add an "all UI tests" suite. Define a componentized hierarchical build layout of the main plug-ins Change-Id: I43f8f3644857a18b69715f5a2f1da9b1cf286d67
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml20
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/pom.xml10
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/utils/DeleteActionUtil.java89
3 files changed, 27 insertions, 92 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml
index 6d20aba9451..8effc6acf2e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml
@@ -86,7 +86,7 @@
</visibleWhen>
</command>
<command
- commandId="org.eclipse.papyrus.uml.diagram.common.commands.DeleteFromDiagram"
+ commandId="org.eclipse.papyrus.infra.gmfdiag.menu.DeleteFromDiagram"
icon="icons/obj16/eraser.gif"
label="Delete From diagram"
style="push">
@@ -297,7 +297,7 @@
value="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
</instanceof>
<test
- property="org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion"
+ property="org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion"
value="true">
</test>
</iterate>
@@ -325,12 +325,12 @@
value="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
</instanceof>
<test
- property="org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion"
+ property="org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion"
value="false">
</test>
<test
- property="org.eclipse.papyrus.uml.diagram.common.isReadOnly"
- value="false">
+ property="org.eclipse.papyrus.infra.gmfdiag.common.canDelete"
+ value="true">
</test>
</iterate>
</with>
@@ -339,7 +339,7 @@
</handler>
<handler
class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.DeleteFromDiagramCommandHandler"
- commandId="org.eclipse.papyrus.uml.diagram.common.commands.DeleteFromDiagram">
+ commandId="org.eclipse.papyrus.infra.gmfdiag.menu.DeleteFromDiagram">
<activeWhen>
<and>
<with
@@ -429,7 +429,7 @@
<command
categoryId="org.eclipse.papyrus.editor.category"
description="Delete the selection from diagram"
- id="org.eclipse.papyrus.uml.diagram.common.commands.DeleteFromDiagram"
+ id="org.eclipse.papyrus.infra.gmfdiag.menu.DeleteFromDiagram"
name="Delete From Diagram Command">
</command>
<command
@@ -488,7 +488,7 @@
sequence="M1+M2+X">
</key>
<key
- commandId="org.eclipse.papyrus.uml.diagram.common.commands.DeleteFromDiagram"
+ commandId="org.eclipse.papyrus.infra.gmfdiag.menu.DeleteFromDiagram"
contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M2+DEL">
@@ -505,7 +505,7 @@
ifEmpty="false"
operator="and">
<test
- property="org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion"
+ property="org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion"
value="true">
</test>
<instanceof
@@ -518,7 +518,7 @@
ifEmpty="false"
operator="and">
<test
- property="org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion"
+ property="org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion"
value="false">
</test>
<instanceof
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/pom.xml
index c767a686584..c4bf565cb19 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/pom.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/pom.xml
@@ -2,13 +2,11 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>org.eclipse.papyrus.releng</artifactId>
- <groupId>org.eclipse.papyrus</groupId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../../../../releng/main</relativePath>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.gmfdiag.menu</artifactId>
- <groupId>org.eclipse.papyrus</groupId>
<version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
-</project> \ No newline at end of file
+</project>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/utils/DeleteActionUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/utils/DeleteActionUtil.java
index 5aa5b2e2a6d..ac29e833a43 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/utils/DeleteActionUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/utils/DeleteActionUtil.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,8 +8,8 @@
*
* Contributors:
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
- * Christian W. Damus - bug 459566
- * Christian W. Damus - bug 463846
+ * Christian W. Damus - bugs 459566, 463846, 485220
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.menu.utils;
@@ -31,15 +31,8 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
-import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
-
-import com.google.common.base.Optional;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
/**
* Utility class to manage delete action in GMF Diagram context.
@@ -62,42 +55,12 @@ public final class DeleteActionUtil {
* @param editPart
* the edit part
* @return true, if is semantic deletion
+ *
+ * @deprecated Use the {@link DiagramEditPartsUtil#isSemanticDeletion(IGraphicalEditPart)} API, instead
*/
+ @Deprecated
public static boolean isSemanticDeletion(IGraphicalEditPart editPart) {
- boolean isSemanticDeletion = false;
- TransactionalEditingDomain editingDomain = null;
-
- // Get Editing Domain
- try {
- editingDomain = ServiceUtilsForEditPart.getInstance().getTransactionalEditingDomain(editPart);
- } catch (ServiceException e) {
-
- }
-
- if (editingDomain != null) {
-
- IReadOnlyHandler2 readOnly = ReadOnlyManager.getReadOnlyHandler(editingDomain);
- EObject semantic = EMFHelper.getEObject(editPart);
- View graphical = NotationHelper.findView(editPart);
-
- isSemanticDeletion = !(semantic == null || semantic == graphical || semantic.eContainer() == null);
-
-
- if (isSemanticDeletion && readOnly != null) {
- // Is the semantic element read-only?
- Optional<Boolean> result = readOnly.isReadOnly(ReadOnlyAxis.anyAxis(), semantic);
- if (!result.or(false) && (graphical != null)) {
- // Or, if not, is the graphical element read-only?
- result = readOnly.isReadOnly(ReadOnlyAxis.anyAxis(), graphical);
- }
-
- // Are both the semantic and graphical elements writable?
- isSemanticDeletion = !result.or(false);
- }
- }
-
-
- return isSemanticDeletion;
+ return DiagramEditPartsUtil.isSemanticDeletion(editPart);
}
/**
@@ -106,40 +69,14 @@ public final class DeleteActionUtil {
* @param editPart
* the edit part
* @return true, if this is a read only element.
+ *
+ * @deprecated Use the {@link DiagramEditPartsUtil#isReadOnly(IGraphicalEditPart)} API, instead
*/
+ @Deprecated
public static boolean isReadOnly(final IGraphicalEditPart editPart) {
- boolean isReadOnly = true;
- TransactionalEditingDomain editingDomain = null;
-
- // Get Editing Domain
- try {
- editingDomain = ServiceUtilsForEditPart.getInstance().getTransactionalEditingDomain(editPart);
- } catch (ServiceException e) {
- // Do nothing
- }
-
- if (null != editingDomain) {
-
- final IReadOnlyHandler2 readOnly = ReadOnlyManager.getReadOnlyHandler(editingDomain);
- final EObject semantic = EMFHelper.getEObject(editPart);
- final View graphical = NotationHelper.findView(editPart);
-
- if (null != readOnly && null != semantic) {
- // Is the semantic element read-only?
- Optional<Boolean> result = readOnly.isReadOnly(ReadOnlyAxis.anyAxis(), semantic);
- isReadOnly = result.get();
-
- if (!isReadOnly && (graphical != null)) {
- // Or, if not, is the graphical element read-only?
- result = readOnly.isReadOnly(ReadOnlyAxis.anyAxis(), graphical);
- isReadOnly = result.get();
- }
- }
- }
-
- return isReadOnly;
+ return DiagramEditPartsUtil.isReadOnly(editPart);
}
-
+
/**
* Gets the delete from model command.
*

Back to the top