summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Le Guennec2014-03-13 10:52:06 (EDT)
committerVincent Lorenzo2014-03-13 10:52:06 (EDT)
commit553f8efafc6a2d4f02e08186cfa7812105ad59bf (patch)
tree5601fcdef6d89fbe94928311436bae199a15212d
parent2b0d2af622c6482b4a6109d12463c28f1374588a (diff)
downloadorg.eclipse.papyrus-553f8efafc6a2d4f02e08186cfa7812105ad59bf.zip
org.eclipse.papyrus-553f8efafc6a2d4f02e08186cfa7812105ad59bf.tar.gz
org.eclipse.papyrus-553f8efafc6a2d4f02e08186cfa7812105ad59bf.tar.bz2
429962: [All diagrams] Show/Hide related links only works for Connectors.
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java7
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/ShowHideRelatedLinkEditPolicy.java8
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java4
3 files changed, 10 insertions, 9 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java
index 9cc52bc..201a305 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/AbstractShowHideRelatedLinkEditPolicy.java
@@ -67,6 +67,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.Domain2Notation;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.Element;
/**
@@ -527,7 +528,7 @@ public abstract class AbstractShowHideRelatedLinkEditPolicy extends AbstractEdit
Set<View> targetViewList = domain2NotationMap.get(descriptor.getDestination());
for (View targetView : targetViewList) {
- if (canDisplayExistingLinkBetweenViews((Connector) linkToShow, sourceView, targetView)){
+ if (canDisplayExistingLinkBetweenViews((Element) linkToShow, sourceView, targetView)){
EditPart sourceEditPart = getEditPartFromView(sourceView);
EditPart targetEditPart = getEditPartFromView(targetView);
@@ -562,12 +563,12 @@ public abstract class AbstractShowHideRelatedLinkEditPolicy extends AbstractEdit
/**
* Can display existing link between views.
*
- * @param connector the connector
+ * @param element the element represented by the link
* @param sourceView the source view
* @param targetView the target view
* @return true, if successful
*/
- public boolean canDisplayExistingLinkBetweenViews(final Connector connector, final View sourceView, final View targetView) {
+ public boolean canDisplayExistingLinkBetweenViews(final Element element, final View sourceView, final View targetView) {
return true;
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/ShowHideRelatedLinkEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/ShowHideRelatedLinkEditPolicy.java
index 3c373c1..56beb25 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/ShowHideRelatedLinkEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/ShowHideRelatedLinkEditPolicy.java
@@ -45,6 +45,7 @@ import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
import org.eclipse.uml2.uml.ConnectableElement;
import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.ConnectorEnd;
+import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.TypedElement;
@@ -280,7 +281,7 @@ public class ShowHideRelatedLinkEditPolicy extends AbstractUMLShowHideRelatedLin
final Set<View> linkSet = domain2NotationMap.get(linkToShow);
- CompositeCommand compositeCommand = new CompositeCommand("Restor All Related Links");
+ CompositeCommand compositeCommand = new CompositeCommand("Restore All Related Links");
for (View sourceView : sourceViewList) {
for (View targetView : targetViewList) {
if (canDisplayExistingLinkBetweenViews((Connector) linkToShow, sourceView, targetView)){
@@ -342,9 +343,8 @@ public class ShowHideRelatedLinkEditPolicy extends AbstractUMLShowHideRelatedLin
*/
@Override
- public boolean canDisplayExistingLinkBetweenViews(final Connector connector, final View sourceView, final View targetView) {
- ConnectorUtils connectorUtils = new ConnectorUtils();
- return connectorUtils.canDisplayExistingConnectorBetweenViewsAccordingToNestedPaths(connector, sourceView, targetView);
+ public boolean canDisplayExistingLinkBetweenViews(final Element element, final View sourceView, final View targetView) {
+ return (element instanceof Connector) && ConnectorUtils.canDisplayExistingConnectorBetweenViewsAccordingToNestedPaths((Connector) element, sourceView, targetView);
}
/**
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java
index 4033a75..af7de2b 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/utils/ConnectorUtils.java
@@ -300,7 +300,7 @@ public class ConnectorUtils extends org.eclipse.papyrus.uml.service.types.utils.
* @return true, if successful
* <code>true</code> if displaying the existing connector between this source and this target view is correct
*/
- public final boolean canDisplayExistingConnectorBetweenViewsAccordingToNestedPaths(final Connector connector, final View sourceView, final View targetView) {
+ public static boolean canDisplayExistingConnectorBetweenViewsAccordingToNestedPaths(final Connector connector, final View sourceView, final View targetView) {
ConnectorUtils utils = new ConnectorUtils();
final List<Property> sourcePath = utils.getNestedPropertyPath(sourceView, targetView);
final List<Property> targetPath = utils.getNestedPropertyPath(targetView, sourceView);
@@ -325,7 +325,7 @@ public class ConnectorUtils extends org.eclipse.papyrus.uml.service.types.utils.
* @return true, if successful
* true if the end has as nested path THE wanted path
*/
- protected boolean haveSamePath(final List<Property> wantedPath, final ConnectorEnd end) {
+ protected static boolean haveSamePath(final List<Property> wantedPath, final ConnectorEnd end) {
Stereotype ste = end.getAppliedStereotype("SysML::Blocks::NestedConnectorEnd");//$NON-NLS-1$
if(ste != null) {
final NestedConnectorEnd nestedConnectorEnd = (NestedConnectorEnd)end.getStereotypeApplication(ste);