Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradaussy2012-04-16 13:17:22 +0000
committeradaussy2012-04-16 13:17:22 +0000
commit1672528fa5c42466fa4849af35c453a3ba69d8ce (patch)
tree642fd9c7bf275d8763bc452918ac2c24b9346215
parentfbe58b623519a6459c543f0d9b94c34c3db88756 (diff)
downloadorg.eclipse.papyrus-1672528fa5c42466fa4849af35c453a3ba69d8ce.tar.gz
org.eclipse.papyrus-1672528fa5c42466fa4849af35c453a3ba69d8ce.tar.xz
org.eclipse.papyrus-1672528fa5c42466fa4849af35c453a3ba69d8ce.zip
Bug 376703 - [Block Definition Diagram] Blocks should have a compartment to display flow properties.
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java15
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java15
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/FlowPropertyEditHelperAdvice.java18
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/FlowSpecificationMatcher.java10
4 files changed, 34 insertions, 24 deletions
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java
index 0dbe2ef0795..4bbf1b66c34 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java
@@ -55,12 +55,15 @@ public class ConnectorLinkLabelSourceMultiplicityEditPart extends AbstractElemen
*/
@Override
public EObject getParserElement() {
- Connector connector = (Connector)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((connector != null) && (connector.getEnds().size() == 2)) {
- return connector.getEnds().get(0);
+ EObject resolveSemanticElement = resolveSemanticElement();
+ if(resolveSemanticElement instanceof Connector) {
+ Connector connector = (Connector)resolveSemanticElement;
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((connector != null) && (connector.getEnds().size() == 2)) {
+ return connector.getEnds().get(0);
+ }
}
}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java
index 3fd14dcb2c8..a2ec038d299 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java
@@ -55,12 +55,15 @@ public class ConnectorLinkLabelTargetMultiplicityEditPart extends AbstractElemen
*/
@Override
public EObject getParserElement() {
- Connector connector = (Connector)resolveSemanticElement();
- if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
- View owner = ViewUtil.getContainerView(getNotationView());
-
- if((connector != null) && (connector.getEnds().size() == 2)) {
- connector.getEnds().get(1);
+ EObject resolveSemanticElement = resolveSemanticElement();
+ if(resolveSemanticElement instanceof Connector) {
+ Connector connector = (Connector)resolveSemanticElement;
+ if((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) {
+ View owner = ViewUtil.getContainerView(getNotationView());
+
+ if((connector != null) && (connector.getEnds().size() == 2)) {
+ return connector.getEnds().get(0);
+ }
}
}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/FlowPropertyEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/FlowPropertyEditHelperAdvice.java
index e529fa0c6f1..301dbfa20b4 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/FlowPropertyEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/FlowPropertyEditHelperAdvice.java
@@ -70,9 +70,21 @@ public class FlowPropertyEditHelperAdvice extends AbstractStereotypedElementEdit
Element contextElement = (Element)editContextRequest.getEditContext();
IElementMatcher matcher = new FlowSpecificationMatcher();
- if(!matcher.matches(contextElement)) {
- isApproved = false;
- }
+
+ if (contextElement instanceof org.eclipse.uml2.uml.Class){
+ /*
+ * This deals with the case of flow properties being added to a block.
+ */
+ org.eclipse.uml2.uml.Class element = (org.eclipse.uml2.uml.Class) contextElement;
+ if(ElementUtil.getStereotypeApplication(element, Block.class) != null) {
+ isApproved = true;
+ }
+ } else {
+
+ if(!matcher.matches(contextElement)) {
+ isApproved = false;
+ }
+ }
}
}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/FlowSpecificationMatcher.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/FlowSpecificationMatcher.java
index b3fbd4be8e3..fdac8b2f484 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/FlowSpecificationMatcher.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/FlowSpecificationMatcher.java
@@ -33,15 +33,7 @@ public class FlowSpecificationMatcher implements IElementMatcher {
if(ElementUtil.getStereotypeApplication(element, FlowSpecification.class) != null) {
isFlowSpec = true;
}
- } else if (eObject instanceof org.eclipse.uml2.uml.Class){
- /*
- * This deals with the case of flow properties being added to a block.
- */
- org.eclipse.uml2.uml.Class element = (org.eclipse.uml2.uml.Class) eObject;
- if(ElementUtil.getStereotypeApplication(element, Block.class) != null) {
- isFlowSpec = true;
- }
- }
+ }
return isFlowSpec;
}

Back to the top