Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2016-05-26 11:44:25 +0000
committerGerrit Code Review @ Eclipse.org2016-05-27 14:07:02 +0000
commit291c79f868c691c03d0a1688e6c3c6929b0cc019 (patch)
tree02a530ac8dc370edcce4f0923851c593a3f75e0c /plugins/uml
parentc7f605b127748ccab1139c5fb22a141ed33251e4 (diff)
downloadorg.eclipse.papyrus-291c79f868c691c03d0a1688e6c3c6929b0cc019.tar.gz
org.eclipse.papyrus-291c79f868c691c03d0a1688e6c3c6929b0cc019.tar.xz
org.eclipse.papyrus-291c79f868c691c03d0a1688e6c3c6929b0cc019.zip
Bug 487862 - [Composite] InnerPort Allow port creation on port
- change the provide condition to allow only - on diagram based on Composite - on semantic Port Change-Id: I65935e3d678375510cfe826884417bec92bfc66c Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/InnerPortViewProvider.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/InnerPortViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/InnerPortViewProvider.java
index 127059b9b64..14e79018e0a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/InnerPortViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/InnerPortViewProvider.java
@@ -21,16 +21,20 @@ import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOpera
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.providers.CustomAbstractViewProvider;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.BehaviorPortEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLViewProvider;
+import org.eclipse.uml2.uml.Port;
/**
* Provide views to create innerPort in Composite diagram
*/
public class InnerPortViewProvider extends CustomAbstractViewProvider implements IViewProvider {
+
private UMLViewProvider umlViewProvider = new UMLViewProvider();
/**
@@ -41,9 +45,18 @@ public class InnerPortViewProvider extends CustomAbstractViewProvider implements
*/
@Override
protected boolean provides(CreateNodeViewOperation operation) {
- if (super.provides(operation)) {
- String semanticHint = operation.getSemanticHint();
- return BehaviorPortEditPart.VISUAL_ID.equals(semanticHint) || PortEditPart.VISUAL_ID.equals(semanticHint);
+ // check that view container element is a PORT
+ View containerView = operation.getContainerView();
+ if (containerView != null){
+ ViewPrototype viewPrototype = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(containerView.getDiagram());
+ // Check the type of diagram derived from composite to avoid contamination
+ if (CompositeStructureDiagramEditPart.MODEL_ID.equals(viewPrototype.getImplementation())){
+ EObject element = containerView.getElement();
+ if (element instanceof Port){
+ String semanticHint = operation.getSemanticHint();
+ return BehaviorPortEditPart.VISUAL_ID.equals(semanticHint) || PortEditPart.VISUAL_ID.equals(semanticHint);
+ }
+ }
}
return false;
}

Back to the top