Skip to main content
summaryrefslogtreecommitdiffstats
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
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')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/ConnectorItemProvider.java7
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java10
-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
5 files changed, 76 insertions, 37 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/ConnectorItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/ConnectorItemProvider.java
index 3a77c8cee0f..35ed7558ec6 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/ConnectorItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/ConnectorItemProvider.java
@@ -12,6 +12,7 @@ package org.eclipse.papyrus.layers.notationmodel.edit;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.gmf.runtime.notation.Connector;
import org.eclipse.gmf.runtime.notation.Shape;
@@ -20,7 +21,7 @@ import org.eclipse.gmf.runtime.notation.Shape;
* @author cedric dumoulin
*
*/
-public class ConnectorItemProvider extends org.eclipse.gmf.runtime.notation.provider.ShapeItemProvider {
+public class ConnectorItemProvider extends org.eclipse.gmf.runtime.notation.provider.ConnectorItemProvider {
protected AdapterFactory domainAdapterFactory;
@@ -46,7 +47,7 @@ public class ConnectorItemProvider extends org.eclipse.gmf.runtime.notation.prov
public String getText(Object object) {
// System.err.println("getText()");
- Shape shape = (Shape)object;
+ Connector shape = (Connector)object;
Object domainObject = shape.getElement();
if( domainObject != null) {
@@ -70,7 +71,7 @@ public class ConnectorItemProvider extends org.eclipse.gmf.runtime.notation.prov
@Override
public Object getImage(Object object) {
// System.err.println("getImage()");
- Shape shape = (Shape)object;
+ Connector shape = (Connector)object;
Object domainObject = shape.getElement();
if( domainObject != null) {
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java
index 389576a0765..78dcf57e572 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java
@@ -13,7 +13,6 @@ package org.eclipse.papyrus.layers.notationmodel.edit;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.AdapterFactory;
-
/**
* A ProviderAdapterFactory for notations elements in Layers.
* The associated providers allows to render notation elements as UML elements.
@@ -62,4 +61,13 @@ public class NotationItemProviderAdapterFactory extends org.eclipse.gmf.runtime.
return shapeItemProvider;
}
+
+ @Override
+ public Adapter createConnectorAdapter() {
+ if (connectorItemProvider == null) {
+ connectorItemProvider = new ConnectorItemProvider(this, domainAdapterFactory);
+ }
+
+ return connectorItemProvider;
+ }
}
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