Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2016-05-11 11:24:47 +0000
committerGerrit Code Review @ Eclipse.org2016-05-26 08:41:24 +0000
commitc35076dc3e1ee6ab19c2daa6f71d990d1b798450 (patch)
tree28704c2bb96bb475150e30c48d3061f6fa5a9ddd /plugins/infra/gmfdiag
parente6450f0d3364d2ee0e84a35e5216d67d9af731bf (diff)
downloadorg.eclipse.papyrus-c35076dc3e1ee6ab19c2daa6f71d990d1b798450.tar.gz
org.eclipse.papyrus-c35076dc3e1ee6ab19c2daa6f71d990d1b798450.tar.xz
org.eclipse.papyrus-c35076dc3e1ee6ab19c2daa6f71d990d1b798450.zip
bug 492522: [All Diagrams] Delete from model on comment links does not
work (does a delete from diagram) bug 439317: [All Diagrams] Delete from model on contraint links and constraints specification links does not work (do a delete from diagram) new deprecated class : org.eclipse.papyrus.uml.diagram.common.editpolicies.ContextLinkSemanticEditPolicy I remove it from the installed editpolicy for Class, Profile and StateMachine diagrams - add tests about comment link deletion for ClassDiagram, CompositeDiagram and ComponentDiagram Change-Id: I0be833fe18d751bf4873b6e09962b8878b3d010c Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultSemanticEditPolicy.java33
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java10
2 files changed, 39 insertions, 4 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultSemanticEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultSemanticEditPolicy.java
index 7a8c3e7e238..251d9bfff56 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultSemanticEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultSemanticEditPolicy.java
@@ -9,7 +9,7 @@
* Contributors:
*
* CEA LIST - Initial API and implementation
- *
+ * Vincent Lorenzo - bug 492522
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
@@ -36,7 +36,9 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Connector;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants;
@@ -81,6 +83,33 @@ public class DefaultSemanticEditPolicy extends SemanticEditPolicy {
return semanticCommand;
}
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy#completeRequest(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ protected IEditCommandRequest completeRequest(IEditCommandRequest request) {
+ IEditCommandRequest result = super.completeRequest(request);
+ if (result instanceof DestroyReferenceRequest) {
+ if (null == ((IGraphicalEditPart) getHost()).resolveSemanticElement()) {
+ if (getHost() instanceof ConnectionEditPart) {
+ ConnectionEditPart ep = (ConnectionEditPart) getHost();
+ if (ep.isSemanticConnection()) {
+ Object model = ep.getModel();
+ if (model instanceof Connector) {
+ String type = ((Connector) model).getType();
+ if (type != null) {
+ result.setParameter(RequestParameterConstants.VIEW_VISUAL_ID, type);
+ }
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
if (req instanceof CreateRelationshipRequest) {
@@ -145,7 +174,7 @@ public class DefaultSemanticEditPolicy extends SemanticEditPolicy {
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return getDestroyReferenceCommand(req, null);
+ return getDestroyReferenceCommand(req, req.getContainer());
}
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req, Object context) {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java
index 1e701af7a6d..c5842ade5a7 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bugs 433206, 473148, 485220
- *
+ * Vincent Lorenzo - bug 492522
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.utils;
@@ -59,6 +59,7 @@ 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.editpart.ConnectionEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
@@ -938,7 +939,12 @@ public class DiagramEditPartsUtil {
View graphical = NotationHelper.findView(editPart);
isSemanticDeletion = !(semantic == null || semantic == graphical || semantic.eContainer() == null);
-
+ // add a test to fix for bug 492522
+ if (!isSemanticDeletion) {
+ if (editPart instanceof ConnectionEditPart) {
+ isSemanticDeletion = ((ConnectionEditPart) editPart).isSemanticConnection();
+ }
+ }
if (isSemanticDeletion && readOnly != null) {
// Is the semantic element read-only?

Back to the top