Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2018-11-09 10:42:18 -0500
committervincent lorenzo2018-11-12 04:40:05 -0500
commit107a1006ef6e98b337055b3d31a0c1d8c78b40b9 (patch)
tree81d72ad550b462f623034f0a98ae7dbc45192089
parent67ef742e9b4e87e458d6024a366d682951ee870a (diff)
downloadorg.eclipse.papyrus-107a1006ef6e98b337055b3d31a0c1d8c78b40b9.tar.gz
org.eclipse.papyrus-107a1006ef6e98b337055b3d31a0c1d8c78b40b9.tar.xz
org.eclipse.papyrus-107a1006ef6e98b337055b3d31a0c1d8c78b40b9.zip
Bug 483573 - [Component diagram] Show/Hide related links should be done for Connector
Change-Id: I03a5cb50b408a7bc74eb346ff3c37ce9d0a5ca45 Signed-off-by: ashatilov <shatilov@montages.com> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/ShowHideRelatedLinkEditPolicy.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/parts/CustomUMLDiagramUpdater.java85
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/pom.xml13
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java3
6 files changed, 159 insertions, 6 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
index e48c1609fde..243e35e7ea8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
@@ -81,7 +81,7 @@ Require-Bundle: org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
-Bundle-Version: 3.1.0.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.component; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/ShowHideRelatedLinkEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/ShowHideRelatedLinkEditPolicy.java
new file mode 100644
index 00000000000..c04f57d6533
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/ShowHideRelatedLinkEditPolicy.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2018 CEA LIST.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.component.custom.edit.policies;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure;
+import org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractUMLShowHideRelatedLinkEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.custom.parts.CustomUMLDiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+
+/**
+ * Show Hide link editpolicy for Component Diagram
+ *
+ * @since 3.2
+ */
+public class ShowHideRelatedLinkEditPolicy extends AbstractUMLShowHideRelatedLinkEditPolicy {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param host
+ */
+ public ShowHideRelatedLinkEditPolicy() {
+ super();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public DiagramUpdater getDiagramUpdater() {
+ return CustomUMLDiagramUpdater.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IDiagramInformationProviderEditPolicy#getDiagramStructure()
+ *
+ * @return
+ */
+
+ @Override
+ public DiagramStructure getDiagramStructure() {
+ return UMLVisualIDRegistry.TYPED_INSTANCE;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/parts/CustomUMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/parts/CustomUMLDiagramUpdater.java
new file mode 100644
index 00000000000..0fcbd2e828a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/parts/CustomUMLDiagramUpdater.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.component.custom.parts;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorEditPart;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLLinkDescriptor;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This class provides incoming links logic for port/connector and property/connector pairs
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=483573
+ * @since 3.2
+ */
+public class CustomUMLDiagramUpdater extends UMLDiagramUpdater {
+
+ public static final CustomUMLDiagramUpdater INSTANCE = new CustomUMLDiagramUpdater();
+
+ private CustomUMLDiagramUpdater() {
+ super();
+ }
+
+ @Override
+ public List<UMLLinkDescriptor> getPort_Shape_IncomingLinks(View view) {
+ Port modelElement = (Port) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
+ result.addAll(super.getPort_Shape_IncomingLinks(view));
+ result.addAll(getIncomingFeatureModelFacetLinks_Connector_Edge(modelElement, crossReferencer));
+ return result;
+ }
+
+ @Override
+ public List<UMLLinkDescriptor> getProperty_Shape_IncomingLinks(View view) {
+ Property modelElement = (Property) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
+ result.addAll(super.getProperty_Shape_IncomingLinks(view));
+ result.addAll(getIncomingFeatureModelFacetLinks_Connector_Edge(modelElement, crossReferencer));
+ return result;
+ }
+
+ protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Connector_Edge(Element target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getConnectorEnd_Role()) {
+ continue;
+ }
+ ConnectorEnd source = (ConnectorEnd) setting.getEObject();
+ Connector connector = (Connector) source.eContainer();
+ List<ConnectorEnd> ends = connector.getEnds();
+ if (ends == null || ends.size() != 2) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(ends.get(0).getRole(), ends.get(1).getRole(), connector, UMLElementTypes.Connector_Edge, ConnectorEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen
index 1493544ee95..052b926d0c1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen
@@ -40,6 +40,10 @@
xsi:type="gmfgen:CustomBehaviour"
key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AbstractShowHideRelatedLinkEditPolicy.SHOW_HIDE_RELATED_LINK_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.ShowHideRelatedLinkEditPolicy"/>
<domainDiagramElement
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
<childNodes
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/pom.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/pom.xml
index d0e34eaa43a..ca26cc5c461 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/pom.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/pom.xml
@@ -1,11 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.eclipse.papyrus</groupId>
- <artifactId>org.eclipse.papyrus.uml-diagrams</artifactId>
- <version>0.0.1-SNAPSHOT</version>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.uml-diagrams</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.diagram.component</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java
index 90bb3a23c41..ed068f59fc3 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java
@@ -16,10 +16,12 @@ package org.eclipse.papyrus.uml.diagram.component.edit.parts;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AbstractShowHideRelatedLinkEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
import org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.ShowHideRelatedLinkEditPolicy;
/**
* @generated
@@ -58,6 +60,7 @@ public class ComponentDiagramEditPart extends PapyrusDiagramEditPart {
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ModelCanonicalEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(AbstractShowHideRelatedLinkEditPolicy.SHOW_HIDE_RELATED_LINK_ROLE, new ShowHideRelatedLinkEditPolicy());
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
}

Back to the top