Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Dumoulin2014-03-27 16:28:35 +0000
committerCedric Dumoulin2014-03-28 13:04:08 +0000
commitd0c48f36d606940386cd3967a1200957fbab8cf5 (patch)
treeff4cbcb3265bafe153f3c219269dc10d8078925e /extraplugins/layers/org.eclipse.papyrus.layers.stackmodel
parent524605b42813e5b6ed0c3e71718275fb849d5b57 (diff)
downloadorg.eclipse.papyrus-d0c48f36d606940386cd3967a1200957fbab8cf5.tar.gz
org.eclipse.papyrus-d0c48f36d606940386cd3967a1200957fbab8cf5.tar.xz
org.eclipse.papyrus-d0c48f36d606940386cd3967a1200957fbab8cf5.zip
330199 [Layers] - Use FillStyle, FontStyle, LineStyle instead of
Notation concepts to set layer properties values. Also improve Attach Views dialog. It filter (a little bit) more UML elements.
Diffstat (limited to 'extraplugins/layers/org.eclipse.papyrus.layers.stackmodel')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FillPropertySetterImpl.java26
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FontPropertySetterImpl.java31
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LinePropertySetterImpl.java39
3 files changed, 63 insertions, 33 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FillPropertySetterImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FillPropertySetterImpl.java
index 3bb2a133063..4015dd483ab 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FillPropertySetterImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FillPropertySetterImpl.java
@@ -13,7 +13,8 @@
package org.eclipse.papyrus.layers.stackmodel.layers.impl;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.FillStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.layers.FillInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.FillPropertySetter;
@@ -61,13 +62,24 @@ public class FillPropertySetterImpl extends PropertySetterImpl implements FillPr
@Override
public void setValue(View view, TypeInstance value) {
+ // Try to get the FontStyle object to modify
+ FillStyle style;
+ if(view instanceof FillStyle) {
+ // Try directly (case of Shape ...)
+ style = (FillStyle)view;
+ }
+ else {
+ // Try as additionnal style
+ style = (FillStyle)view.getStyle(NotationPackage.eINSTANCE.getFillStyle() );
+ }
- FillInstance fillValue = (FillInstance)value;
-
- if(view instanceof Shape) {
- Shape shape = (Shape)view;
- shape.setFillColor(fillValue.getFillColor().getValue());
- shape.setTransparency(fillValue.getTransparency());
+ // Set values
+ if( style != null ) {
+
+ FillInstance fillValue = (FillInstance)value;
+
+ style.setFillColor(fillValue.getFillColor().getValue());
+ style.setTransparency(fillValue.getTransparency());
}
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FontPropertySetterImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FontPropertySetterImpl.java
index 10621cbbacc..1a2a2c63df3 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FontPropertySetterImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/FontPropertySetterImpl.java
@@ -13,7 +13,8 @@
package org.eclipse.papyrus.layers.stackmodel.layers.impl;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.layers.FontInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.FontPropertySetter;
@@ -60,17 +61,25 @@ public class FontPropertySetterImpl extends PropertySetterImpl implements FontPr
@Override
public void setValue(View view, TypeInstance value) {
-
- FontInstance lineValue = (FontInstance)value;
+ // Try to get the FontStyle object to modify
+ FontStyle style;
+ if(view instanceof FontStyle) {
+ // Try directly (case of Shape ...)
+ style = (FontStyle)view;
+ }
+ else {
+ // Try as additionnal style
+ style = (FontStyle)view.getStyle(NotationPackage.eINSTANCE.getFontStyle() );
+ }
- if(view instanceof Shape) {
- Shape shape = (Shape)view;
-
-
- shape.setFontColor(lineValue.getFontColor());
- shape.setFontName(lineValue.getFontName());
- shape.setFontHeight(lineValue.getFontHeigh());
- shape.setBold(lineValue.isBold());
+ // Set values
+ if( style != null ) {
+ FontInstance lineValue = (FontInstance)value;
+
+ style.setFontColor(lineValue.getFontColor());
+ style.setFontName(lineValue.getFontName());
+ style.setFontHeight(lineValue.getFontHeigh());
+ style.setBold(lineValue.isBold());
}
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LinePropertySetterImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LinePropertySetterImpl.java
index 1977e3d0965..c5186d6ce4c 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LinePropertySetterImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LinePropertySetterImpl.java
@@ -13,8 +13,9 @@
package org.eclipse.papyrus.layers.stackmodel.layers.impl;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.LineStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
import org.eclipse.papyrus.layers.stackmodel.layers.LineInstance;
@@ -60,21 +61,29 @@ public class LinePropertySetterImpl extends PropertySetterImpl implements LinePr
*/
@Override
public void setValue(View view, TypeInstance value) {
-
-
- LineInstance lineValue = (LineInstance)value;
-
- if(view instanceof Shape) {
- Shape shape = (Shape)view;
- shape.setLineColor(lineValue.getLineColor());
- shape.setLineWidth(lineValue.getLineWith());
+
+
+ // Try to get the FontStyle object to modify
+ LineStyle style;
+ if(view instanceof FontStyle) {
+ // Try directly (case of Shape ...)
+ style = (LineStyle)view;
+ }
+ else {
+ // Try as additionnal style
+ style = (LineStyle)view.getStyle(NotationPackage.eINSTANCE.getLineStyle() );
}
- else if (view instanceof Connector) {
- Connector shape = (Connector)view;
- shape.setLineColor(lineValue.getLineColor());
- shape.setLineWidth(lineValue.getLineWith());
+
+ // Set values
+ if( style != null ) {
+
+
+ LineInstance lineValue = (LineInstance)value;
+
+ style.setLineColor(lineValue.getLineColor());
+ style.setLineWidth(lineValue.getLineWith());
}
-
+
}
} //LinePropertySetterImpl

Back to the top