Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCéline Janssens2015-02-23 10:54:33 +0000
committerCéline Janssens2015-05-06 13:12:47 +0000
commit7d79f366cef733c758d3d21b02103f52eb7c8eec (patch)
treea73df70f298f17d7630cac101808b99b9e4269fe /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse
parentdb0a842e0e90d28754bfc88acd19743223515cc9 (diff)
downloadorg.eclipse.papyrus-7d79f366cef733c758d3d21b02103f52eb7c8eec.tar.gz
org.eclipse.papyrus-7d79f366cef733c758d3d21b02103f52eb7c8eec.tar.xz
org.eclipse.papyrus-7d79f366cef733c758d3d21b02103f52eb7c8eec.zip
Bug 460356: [Stereotype Display] Objective 4c. Display properties into a
comment thanks to CSS. - Refactor EditPolicies - Add creation of Stereotype Structure at the ASLabelDisplayEditPolicy - creation of Comment with new Structure as a copy of the Compartment. - Comment Compartment Displayed and deleted - Small refactor - Default display: All is displayed everywhere by Default Change-Id: Ief7bf1d8b8cbffa8301b0e342c7f26d5c66941b5 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=460356 Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/OneTopLineResizableBorder.java46
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java26
2 files changed, 50 insertions, 22 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/OneTopLineResizableBorder.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/OneTopLineResizableBorder.java
index b9c24c67419..ad9adb3856e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/OneTopLineResizableBorder.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/OneTopLineResizableBorder.java
@@ -121,7 +121,7 @@ public class OneTopLineResizableBorder extends OneLineBorder {
// get the length of the line according to the corner
int length = getLineLength(figure);
- tempRect.width = (int) (length);
+ tempRect.width = (length);
// if the length is forced or a ratio is applied
if (forcedLength != -1) {
@@ -179,29 +179,31 @@ public class OneTopLineResizableBorder extends OneLineBorder {
SVGNodePlateFigure mainFigure = FigureUtils.findParentFigureInstance(figure, SVGNodePlateFigure.class);
// Get the connection anchor
- ConnectionAnchor connectionAnchor = ((SVGNodePlateFigure) mainFigure).getConnectionAnchor("");
- if (connectionAnchor instanceof SlidableRoundedRectangleAnchor && !(mainFigure.getBounds().equals(new Rectangle()))) {
- // Calculate the length off the border thanks the SlidableRoundedRectangleAnchor
- Rectangle rect = figure.getBounds().getCopy();
- figure.translateToAbsolute(rect);
-
- Point locationLeft = ((SlidableRoundedRectangleAnchor) connectionAnchor).getLocation(rect.getTopLeft().translate(rect.width / 2, 0), rect.getTopLeft());
- Point locationRight = ((SlidableRoundedRectangleAnchor) connectionAnchor).getLocation(rect.getTopLeft().translate(rect.width / 2, 0), rect.getTopRight());
-
- if (locationLeft != null && locationRight != null) {
-
- rect.width = locationRight.x - locationLeft.x;
- // translate the length according to the zoom
- figure.translateToRelative(rect);
- length = rect.width;
-
- // set the position at the figure bounds.x to the position on x of the left location
- // TODO: don't do it on a getLenght method.
- figure.translateToRelative(locationLeft);
- tempRect.x = locationLeft.x;
+ if (mainFigure != null) {
+ ConnectionAnchor connectionAnchor = mainFigure.getConnectionAnchor("");
+ if (connectionAnchor instanceof SlidableRoundedRectangleAnchor && !(mainFigure.getBounds().equals(new Rectangle()))) {
+ // Calculate the length off the border thanks the SlidableRoundedRectangleAnchor
+ Rectangle rect = figure.getBounds().getCopy();
+ figure.translateToAbsolute(rect);
+
+ Point locationLeft = ((SlidableRoundedRectangleAnchor) connectionAnchor).getLocation(rect.getTopLeft().translate(rect.width / 2, 0), rect.getTopLeft());
+ Point locationRight = ((SlidableRoundedRectangleAnchor) connectionAnchor).getLocation(rect.getTopLeft().translate(rect.width / 2, 0), rect.getTopRight());
+
+ if (locationLeft != null && locationRight != null) {
+
+ rect.width = locationRight.x - locationLeft.x;
+ // translate the length according to the zoom
+ figure.translateToRelative(rect);
+ length = rect.width;
+
+ // set the position at the figure bounds.x to the position on x of the left location
+ // TODO: don't do it on a getLenght method.
+ figure.translateToRelative(locationLeft);
+ tempRect.x = locationLeft.x;
+ }
}
}
- return (int) (length);
+ return (length);
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java
index 6fd7c06a7df..bc476fb091e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
import org.eclipse.gmf.runtime.notation.IntValueStyle;
import org.eclipse.gmf.runtime.notation.NamedStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
@@ -339,6 +340,31 @@ public class NotationUtils {
}
/**
+ * Gets the EObject value from a NamedStyle property.
+ *
+ * @param view
+ * the view
+ * @param property
+ * the property
+ * @param defaultValue
+ * the default value
+ * @return the EObject
+ */
+ public static EObject getEObjectValue(View view, String property, EObject defaultValue) {
+ EObject value = defaultValue;
+ EClass eObjectValueStyle = NotationPackage.eINSTANCE.getEObjectValueStyle();
+
+ if (eObjectValueStyle != null) {
+ NamedStyle style = view.getNamedStyle(eObjectValueStyle, property);
+ if (style instanceof EObjectValueStyle) {
+ value = ((EObjectValueStyle) style).getEObjectValue();
+ }
+ }
+ return value;
+ }
+
+
+ /**
* Get the list as a String list and convert it to Int list
*
* @param model

Back to the top