Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-02-19 16:57:34 +0000
committerChristian W. Damus2014-02-19 16:57:34 +0000
commitc20177d7125bfd25226ee2be05576700fc19f6e6 (patch)
tree27604c042176024151e71f8893246668d472523d
parent26f9d8a58476df4b5ad71a8ab92827ae96cc1750 (diff)
parent643fc0ead955300ed91372d2c334a8e3dd783a36 (diff)
downloadorg.eclipse.papyrus-c20177d7125bfd25226ee2be05576700fc19f6e6.tar.gz
org.eclipse.papyrus-c20177d7125bfd25226ee2be05576700fc19f6e6.tar.xz
org.eclipse.papyrus-c20177d7125bfd25226ee2be05576700fc19f6e6.zip
Merge remote-tracking branch 'origin/master'
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java64
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java38
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java44
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java11
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java10
7 files changed, 111 insertions, 76 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css
index 8e651a55605..6ac50b4d5c2 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css
@@ -123,3 +123,6 @@ ParametricDiagram [appliedStereotypes~=ConstraintProperty] {
elementIcon:false;
}
+Label {
+ elementIcon: false;
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java
index 8c916fd9450..b9b684d1143 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -56,13 +56,13 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
super.refresh();
IFigure figure = this.getFigure();
Object model = this.getModel();
- if (figure instanceof PapyrusEdgeFigure && model instanceof Connector) {
- Connector connector = (Connector) model;
- PapyrusEdgeFigure edge = (PapyrusEdgeFigure) figure;
- String lineStyle = extract((StringValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), LINE_STYLE));
- int lineDashLength = extract((IntValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_LENGTH));
- int lineDashGap = extract((IntValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_GAP));
- if (lineStyle != null) {
+ if(figure instanceof PapyrusEdgeFigure && model instanceof Connector) {
+ Connector connector = (Connector)model;
+ PapyrusEdgeFigure edge = (PapyrusEdgeFigure)figure;
+ String lineStyle = extract((StringValueStyle)connector.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), LINE_STYLE));
+ int lineDashLength = extract((IntValueStyle)connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_LENGTH));
+ int lineDashGap = extract((IntValueStyle)connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_GAP));
+ if(lineStyle != null) {
setupLineStyle(edge, lineStyle, connector.getLineWidth(), lineDashLength, lineDashGap);
} else {
edge.resetStyle();
@@ -72,13 +72,13 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
* Extracts the primitive value from the given style
- *
+ *
* @param style
- * The style
+ * The style
* @return The primitive value
*/
private String extract(StringValueStyle style) {
- if (style == null || style.getStringValue() == null || style.getStringValue().isEmpty()) {
+ if(style == null || style.getStringValue() == null || style.getStringValue().isEmpty()) {
return null;
}
return style.getStringValue();
@@ -86,13 +86,13 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
* Extracts the primitive value from the given style
- *
+ *
* @param style
- * The style
+ * The style
* @return The primitive value
*/
private int extract(IntValueStyle style) {
- if (style == null) {
+ if(style == null) {
return 0;
}
return style.getIntValue();
@@ -100,37 +100,37 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
* Setups the line style of the edge according to the given CSS style
- *
+ *
* @param edge
- * The shape to setup
+ * The shape to setup
* @param style
- * The CSS style
+ * The CSS style
* @param originalWidth
- * Original width of the connector
+ * Original width of the connector
* @param lineDashLength
- * Length of the dashes
+ * Length of the dashes
* @param lineDashGap
- * Length of the gap between dashes
+ * Length of the gap between dashes
*/
private void setupLineStyle(PapyrusEdgeFigure edge, String style, int originalWidth, int lineDashLength, int lineDashGap) {
- if ("none".equals(style)) {
+ if("none".equals(style)) {
edge.resetStyle();
} else {
- if ("hidden".equals(style)) {
+ if("hidden".equals(style)) {
edge.setLineStyle(Graphics.LINE_SOLID);
edge.setLineWidth(0);
edge.setVisible(false);
- } else if ("dotted".equals(style)) {
+ } else if("dotted".equals(style)) {
edge.setLineStyle(Graphics.LINE_DOT);
edge.setLineWidth(originalWidth);
- } else if ("dashed".equals(style)) {
+ } else if("dashed".equals(style)) {
edge.setLineStyle(Graphics.LINE_CUSTOM);
edge.setLineWidth(originalWidth);
- edge.setLineDash(new int[] { lineDashLength, lineDashGap });
- } else if ("solid".equals(style)) {
+ edge.setLineDash(new int[]{ lineDashLength, lineDashGap });
+ } else if("solid".equals(style)) {
edge.setLineStyle(Graphics.LINE_SOLID);
edge.setLineWidth(originalWidth);
- } else if ("double".equals(style)) {
+ } else if("double".equals(style)) {
edge.setLineWidth(originalWidth * 2);
}
}
@@ -139,9 +139,9 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart#createDefaultEditPolicies()
- *
+ *
*/
@Override
protected void createDefaultEditPolicies() {
@@ -149,4 +149,10 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new PapyrusConnectionEndEditPolicy());
}
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLineWidth();
+ installRouter();
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java
index 87d508506f5..aa77b8fa7f1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java
@@ -86,24 +86,26 @@ public class XYLayoutWithConstrainedResizedEditPolicy extends XYLayoutEditPolicy
double spacing = drep.getGridSpacing();
final double max_value = spacing * 20;
final SnapToHelper helper = (SnapToHelper)getHost().getAdapter(SnapToHelper.class);
- final LayoutHelper layoutHelper = new LayoutHelper();
- while(add < max_value) {//we define a max value to do test
- Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
- LOCAL_BOUNDS.translate(add, add);
- Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
- final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
- resultRect.setWidth(-1);
- resultRect.setHeight(-1);
- PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
- helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
- final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
- if(couldBeSnaped) {
- if(pt.equals(resultRect.getLocation())) {
- rect.setLocation(resultRect.getLocation());
- break;
- } else {
- add += spacing;
- continue;
+ if(helper != null) {
+ final LayoutHelper layoutHelper = new LayoutHelper();
+ while(add < max_value) {//we define a max value to do test
+ Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
+ LOCAL_BOUNDS.translate(add, add);
+ Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
+ final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
+ resultRect.setWidth(-1);
+ resultRect.setHeight(-1);
+ PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
+ helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
+ final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
+ if(couldBeSnaped) {
+ if(pt.equals(resultRect.getLocation())) {
+ rect.setLocation(resultRect.getLocation());
+ break;
+ } else {
+ add += spacing;
+ continue;
+ }
}
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
index 29bf93747f3..2ad1e4c7118 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
@@ -40,8 +40,6 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.XYLayoutWithConstra
*/
public class DefaultXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEditPolicy {
- protected double spacing = 80;
-
/**
* Called in response to a <tt>REQ_CREATE</tt> request. Returns a command
* to set each created element bounds and auto-size properties.
@@ -64,33 +62,35 @@ public class DefaultXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEdi
while(iter.hasNext()) {
CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
Rectangle rect = getBoundsOffest(req, BOUNDS, viewDescriptor);
-
+
//see bug 427129: Figures newly created via the palette should be snapped to grid if "snap to grid" is activated
if(couldBeSnaped) {
//this code fix the bug in some case...
int add = 0;
DiagramRootEditPart drep = (DiagramRootEditPart)getHost().getRoot();
double spacing = drep.getGridSpacing();
- final double max_value = spacing*20;
+ final double max_value = spacing * 20;
final SnapToHelper helper = (SnapToHelper)getHost().getAdapter(SnapToHelper.class);
- final LayoutHelper layoutHelper = new LayoutHelper();
- while(add < max_value) {//we define a max value to do test
- Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
- LOCAL_BOUNDS.translate(add, add);
- Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
- final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
- resultRect.setWidth(-1);
- resultRect.setHeight(-1);
- PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
- helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
- final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
- if(couldBeSnaped) {
- if(pt.equals(resultRect.getLocation())) {
- rect.setLocation(resultRect.getLocation());
- break;
- } else {
- add +=spacing;
- continue;
+ if(helper != null) {
+ final LayoutHelper layoutHelper = new LayoutHelper();
+ while(add < max_value) {//we define a max value to do test
+ Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
+ LOCAL_BOUNDS.translate(add, add);
+ Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
+ final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
+ resultRect.setWidth(-1);
+ resultRect.setHeight(-1);
+ PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
+ helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
+ final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
+ if(couldBeSnaped) {
+ if(pt.equals(resultRect.getLocation())) {
+ rect.setLocation(resultRect.getLocation());
+ break;
+ } else {
+ add += spacing;
+ continue;
+ }
}
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
index 78884083e9f..90763608a57 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
@@ -19,10 +19,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
import org.eclipse.papyrus.sysml.blocks.BindingConnector;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
import org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure;
-import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
-import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.Element;
public class ConnectorEditPart extends AbstractElementLinkEditPart {
@@ -85,6 +82,7 @@ public class ConnectorEditPart extends AbstractElementLinkEditPart {
/**
* Creates figure for this edit part.
*/
+ @Override
protected Connection createConnectionFigure() {
return new ConnectorEdgeFigure();
}
@@ -92,17 +90,22 @@ public class ConnectorEditPart extends AbstractElementLinkEditPart {
/**
* Creates primary shape for this edit part.
*/
+ @Override
public ConnectorEdgeFigure getPrimaryShape() {
return (ConnectorEdgeFigure)getFigure();
}
@Override
protected void refreshLineWidth() {
- if (org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication((Element)resolveSemanticElement(), BindingConnector.class) != null) {
- setLineWidth(2);
+ int width = getLineWidth();
+ if(width < 1) {
+ width = 1;
}
- else {
- setLineWidth(1);
+
+ if(org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication((Element)resolveSemanticElement(), BindingConnector.class) != null) {
+ setLineWidth(width * 2);
+ } else {
+ setLineWidth(width);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
index db0db81e772..b85fe5f0f3d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
@@ -309,4 +309,15 @@ public abstract class UMLConnectionNodeEditPart extends ConnectionEditPart imple
return out;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ if(width < 0) {
+ width = 1;
+ }
+ getPrimaryShape().setLineWidth(width);
+ }
+
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
index 8843c04ca19..94f5a7a61cc 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
@@ -65,6 +65,9 @@ public class StereotypeModelElement extends EMFModelElement {
public IObservable doGetObservable(String propertyPath) {
FeaturePath featurePath = getFeaturePath(propertyPath);
EStructuralFeature feature = getFeature(featurePath);
+ if(feature == null) {
+ return super.doGetObservable(propertyPath);
+ }
if(feature.getEType() instanceof EDataType && !(feature.getEType() instanceof EEnum)) {
if(feature.getUpperBound() == 1) {
@@ -89,6 +92,9 @@ public class StereotypeModelElement extends EMFModelElement {
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
+ if(feature == null) {
+ return super.getLabelProvider(propertyPath);
+ }
if(feature.getEType() instanceof EEnum) {
return super.getLabelProvider(propertyPath);
}
@@ -102,6 +108,10 @@ public class StereotypeModelElement extends EMFModelElement {
public IStaticContentProvider getContentProvider(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
+ if(feature == null) {
+ return super.getContentProvider(propertyPath);
+ }
+
return new UMLContentProvider(source, feature, stereotype);
}
}

Back to the top