diff options
116 files changed, 2447 insertions, 2717 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF index b55f19113d8..4443574fcbb 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="0.9.0", org.eclipse.emf.databinding;bundle-version="1.2.0", org.eclipse.gmf.runtime.notation;bundle-version="1.5.0", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.9.0" + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.9.0", + org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="0.9.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi new file mode 100644 index 00000000000..f704718e972 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="ASCII"?>
+<environment:Environment
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
+ <modelElementFactories
+ name="CSS CustomStyle Factory"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement.CSSModelElementFactory"/>
+</environment:Environment>
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx index a4f5ab667b9..f87bc61bd11 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx @@ -59,19 +59,19 @@ <properties name="cssStyle" label="CSS Style"/>
</elements>
<elements name="DiagramStyle" supertypes="//@dataContexts.0/@elements.0">
- <properties name="styleSheets" label="Diagram style sheets" multiplicity="-1" description="The style sheets associated to this diagram"/>
+ <properties name="css_stylesheets" label="Diagram style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to this diagram"/>
</elements>
- <elements name="ModelStyleSheet">
- <properties name="stylesheets" label="Model style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to the model"/>
- </elements>
- <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/environment.xmi#//@modelElementFactories.0"/>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi#//@modelElementFactories.0"/>
</dataContexts>
- <dataContexts name="modelstylesheets" label="ModelCSS">
+ <dataContexts name="modelstylesheets" label="StyleSheets">
<elements name="StyleSheetReference">
- <properties name="path" description="The path to the external style sheet"/>
+ <properties name="path" label="Path" description="The path to the external style sheet"/>
</elements>
<elements name="EmbeddedStyleSheet">
- <properties name="content" description="The style sheet contents"/>
+ <properties name="content" label="Contents" description="The style sheet contents"/>
+ </elements>
+ <elements name="ModelStyleSheet">
+ <properties name="stylesheets" label="Model style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to the model"/>
</elements>
<modelElementFactory href="ppe:/environment/org.eclipse.papyrus.views.properties/model/Environment.xmi#//@modelElementFactories.0"/>
</dataContexts>
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt index 9d79d2cb904..8ed072b9db5 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+<Composite xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
xmlns:x="http://www.eclipse.org/xwt">
<Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
- <ppe:MultiString input="{Binding}" property="CSS:PapyrusCSSStyle:cssClass"></ppe:MultiString>
<ppe:StringMultiline input="{Binding}"
property="CSS:PapyrusCSSStyle:cssStyle"></ppe:StringMultiline>
</Composite>
\ No newline at end of file diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt index 97c4e5d0bb7..cc3fec7e89f 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?>
<Composite
xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns="http://www.eclipse.org/xwt/presentation" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt">
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns="http://www.eclipse.org/xwt/presentation">
<Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
@@ -10,9 +10,7 @@ <Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
- <ppe:MultiStringFile input="{Binding}"
- property="CSS:DiagramStyle:styleSheets"></ppe:MultiStringFile>
<ppe:MultiReference input="{Binding}"
- property="modelstylesheets:ModelStyleSheet:stylesheets"></ppe:MultiReference>
+ property="CSS:DiagramStyle:css_stylesheets"></ppe:MultiReference>
</Composite>
</Composite>
\ No newline at end of file diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleEmbeddedStyleSheet.xwt b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleEmbeddedStyleSheet.xwt index 96ad9fbcf6c..76d6487605a 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleEmbeddedStyleSheet.xwt +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleEmbeddedStyleSheet.xwt @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:x="http://www.eclipse.org/xwt" xmlns="http://www.eclipse.org/xwt/presentation"
+<Composite xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets">
+ xmlns:x="http://www.eclipse.org/xwt">
<Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
@@ -9,7 +10,7 @@ <Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
- <ppe:StringFileSelector property="modelstylesheets:EmbeddedStyleSheet:content"
- input="{Binding}"></ppe:StringFileSelector>
+ <ppe:StringMultiline input="{Binding}"
+ property="modelstylesheets:EmbeddedStyleSheet:content"></ppe:StringMultiline>
</Composite>
</Composite>
\ No newline at end of file diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt index 2449ac11937..19b0c478456 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?>
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt">
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout">
<Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStyleSheetReference.xwt b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStyleSheetReference.xwt index 9174af1d61e..524c62ef4aa 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStyleSheetReference.xwt +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStyleSheetReference.xwt @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:x="http://www.eclipse.org/xwt"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:x="http://www.eclipse.org/xwt"
xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns="http://www.eclipse.org/xwt/presentation">
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets">
<Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
@@ -10,7 +10,7 @@ <Composite.layout>
<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
- <ppe:StringFileSelector property="modelstylesheets:StyleSheetReference:path"
- input="{Binding}"></ppe:StringFileSelector>
+ <ppe:StringFileSelector input="{Binding}"
+ property="modelstylesheets:StyleSheetReference:path"></ppe:StringFileSelector>
</Composite>
</Composite>
\ No newline at end of file diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml index 9271bb607cc..448f5a2791e 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml @@ -11,7 +11,7 @@ <extension
point="org.eclipse.papyrus.views.properties.environment">
<environment
- environmentModel="model/environment.xmi">
+ environmentModel="model/Environment.xmi">
</environment>
</extension>
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/StyleSheetFactory.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/StyleSheetFactory.java new file mode 100644 index 00000000000..9c7373c4486 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/StyleSheetFactory.java @@ -0,0 +1,53 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.creation;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheetsPackage;
+import org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * A Factory for creating StyleSheets directly in the resource. It is not
+ * contained in an EObject.
+ *
+ * @author Camille Letavernier
+ */
+public class StyleSheetFactory extends EcorePropertyEditorFactory {
+
+ protected View context;
+
+ public StyleSheetFactory(View context) {
+ super(NotationPackage.eINSTANCE.getEObjectListValueStyle_EObjectListValue());
+ this.type = ModelStyleSheetsPackage.eINSTANCE.getStyleSheet();
+ this.context = context;
+ }
+
+ @Override
+ protected EObject createObjectInDifferentContainer(Control widget) {
+ //The EObject is simply created ; it isn't stored anywhere (yet)
+ //@see #validateObjects(Collection)
+ return simpleCreateObject(widget);
+ }
+
+ /**
+ * Return the objects as-is. The factory is not responsible for storing them
+ */
+ @Override
+ public Collection<Object> validateObjects(Collection<Object> objectsToValidate) {
+ return objectsToValidate;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/AddAllCSSStyleSheetCommand.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/AddAllCSSStyleSheetCommand.java new file mode 100644 index 00000000000..71039dc892c --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/AddAllCSSStyleSheetCommand.java @@ -0,0 +1,65 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.AddAllCustomStyleListValueCommand;
+
+
+public class AddAllCSSStyleSheetCommand extends AddAllCustomStyleListValueCommand {
+
+ protected final Set<EObject> createdEObjects = new HashSet<EObject>();
+
+ public AddAllCSSStyleSheetCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature, Collection<?> values, int index) {
+ super(domain, view, styleName, styleClass, styleFeature, values, index);
+ }
+
+ public AddAllCSSStyleSheetCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature feature, Collection<?> values) {
+ super(domain, view, styleName, styleClass, feature, values);
+ }
+
+ @Override
+ public void execute() {
+ for(Object value : values) {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ if(eObject.eResource() == null) {
+ view.eResource().getContents().add(eObject);
+ createdEObjects.add(eObject);
+ }
+ }
+ }
+ super.execute();
+ }
+
+ @Override
+ public void undo() {
+ for(Object value : values) {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ if(createdEObjects.contains(eObject)) {
+ eObject.eResource().getContents().remove(eObject);
+ }
+ }
+ }
+ super.undo();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/AddCSSStyleSheetCommand.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/AddCSSStyleSheetCommand.java new file mode 100644 index 00000000000..017bece70f2 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/AddCSSStyleSheetCommand.java @@ -0,0 +1,61 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.AddCustomStyleListValueCommand;
+
+
+public class AddCSSStyleSheetCommand extends AddCustomStyleListValueCommand implements Command {
+
+ protected boolean createdEObject = false;
+
+ public AddCSSStyleSheetCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature, Object value) {
+ super(domain, view, styleName, styleClass, styleFeature, value);
+ }
+
+ public AddCSSStyleSheetCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature, Object value, int index) {
+ super(domain, view, styleName, styleClass, styleFeature, value, index);
+ }
+
+ @Override
+ public void execute() {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ if(eObject.eResource() == null) {
+ view.eResource().getContents().add(eObject);
+ createdEObject = true;
+ }
+ }
+
+ super.execute();
+ }
+
+ @Override
+ public void undo() {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ if(createdEObject) {
+ eObject.eResource().getContents().remove(eObject);
+ }
+ }
+ super.undo();
+ }
+
+
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/DiagramStyleSheetObservableList.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/DiagramStyleSheetObservableList.java new file mode 100644 index 00000000000..780b8e258f8 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/DiagramStyleSheetObservableList.java @@ -0,0 +1,75 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomEObjectStyleObservableList;
+
+/**
+ * An ObservableList for manipulating CSS StyleSheets in a Diagram. The styleSheets
+ * are stored in the view's Resource, and added as a CustomStyle (GMF NamedStyle)
+ * in the view. When the last reference to a CSS Stylesheet is removed, it is
+ * removed from the view's resource.
+ *
+ * A Stylesheet will only be deleted if it is contained in the same resource as
+ * the argument View (A Model B referencing a StyleSheet from a Model A cannot
+ * delete it).
+ *
+ *
+ * @author Camille Letavernier
+ */
+public class DiagramStyleSheetObservableList extends CustomEObjectStyleObservableList {
+
+ public DiagramStyleSheetObservableList(View view, EditingDomain domain, String styleName) {
+ super(view, domain, styleName);
+ }
+
+ @Override
+ public Command getAddCommand(int index, Object value) {
+ return new AddCSSStyleSheetCommand(domain, view, styleName, eClass, feature, value, index);
+ }
+
+ @Override
+ public Command getAddCommand(Object value) {
+ return new AddCSSStyleSheetCommand(domain, view, styleName, eClass, feature, value);
+ }
+
+ @Override
+ public Command getAddAllCommand(Collection<?> values) {
+ return new AddAllCSSStyleSheetCommand(domain, view, styleName, eClass, feature, values);
+ }
+
+ @Override
+ public Command getAddAllCommand(int index, Collection<?> values) {
+ return new AddAllCSSStyleSheetCommand(domain, view, styleName, eClass, feature, values, index);
+ }
+
+ @Override
+ public Command getRemoveCommand(Object value) {
+ return new RemoveCSSStyleSheetCommand(domain, view, styleName, eClass, feature, value);
+ }
+
+ @Override
+ public Command getRemoveAllCommand(Collection<?> values) {
+ return new RemoveAllCSSStyleSheetValueCommand(domain, view, styleName, eClass, feature, values);
+ }
+
+ @Override
+ public Command getSetCommand(int index, Object value) {
+ return new SetCSSStyleSheetCommand(domain, view, styleName, eClass, feature, index, value);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/RemoveAllCSSStyleSheetValueCommand.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/RemoveAllCSSStyleSheetValueCommand.java new file mode 100644 index 00000000000..e0abbbef56d --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/RemoveAllCSSStyleSheetValueCommand.java @@ -0,0 +1,69 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.RemoveAllCustomStyleListValueCommand;
+
+
+public class RemoveAllCSSStyleSheetValueCommand extends RemoveAllCustomStyleListValueCommand {
+
+ protected final Set<EObject> deletedEObjects = new HashSet<EObject>();
+
+ public RemoveAllCSSStyleSheetValueCommand(EditingDomain domain, View view, String styleName, EClass eClass, EStructuralFeature feature, Collection<?> values) {
+ super(domain, view, styleName, eClass, feature, values);
+ }
+
+ @Override
+ public void execute() {
+ for(Object value : values) {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ Map<EObject, Collection<EStructuralFeature.Setting>> references = EcoreUtil.CrossReferencer.find(Collections.singletonList(eObject));
+ //We're removing the last reference to this styleSheet (Only if the stylesheet is contained
+ //in the same resource as the view referencing it... We don't modify external models)
+ if(references.size() == 1 && eObject.eResource() == view.eResource()) {
+ deletedEObjects.add(eObject);
+ eObject.eResource().getContents().remove(eObject);
+ }
+ }
+ }
+
+ super.execute();
+ }
+
+ @Override
+ public void undo() {
+ for(Object value : values) {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ if(deletedEObjects.contains(eObject)) {
+ //We destroyed the StyleSheet EObject: recreate it in its previous resource
+ view.eResource().getContents().add(eObject);
+ }
+ }
+ }
+ super.undo();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/RemoveCSSStyleSheetCommand.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/RemoveCSSStyleSheetCommand.java new file mode 100644 index 00000000000..161a3b9a145 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/RemoveCSSStyleSheetCommand.java @@ -0,0 +1,61 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.RemoveCustomStyleListValueCommand;
+
+
+public class RemoveCSSStyleSheetCommand extends RemoveCustomStyleListValueCommand {
+
+ protected Resource previousResource;
+
+ public RemoveCSSStyleSheetCommand(EditingDomain domain, View view, String styleName, EClass eClass, EStructuralFeature feature, Object value) {
+ super(domain, view, styleName, eClass, feature, value);
+ }
+
+ @Override
+ public void execute() {
+ if(value instanceof EObject) {
+ EObject eObject = (EObject)value;
+ Map<EObject, Collection<EStructuralFeature.Setting>> references = EcoreUtil.CrossReferencer.find(Collections.singletonList(eObject));
+ //We're removing the last reference to this styleSheet (Only if the stylesheet is contained
+ //in the same resource as the view referencing it... We don't modify external models)
+ if(references.size() == 1 && eObject.eResource() == view.eResource()) {
+ previousResource = eObject.eResource();
+ eObject.eResource().getContents().remove(eObject);
+ }
+ }
+
+ super.execute();
+ }
+
+ @Override
+ public void undo() {
+ //We destroyed the StyleSheet EObject: recreate it in its previous resource
+ if(previousResource != null) {
+ previousResource.getContents().add((EObject)value);
+ }
+ super.undo();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/SetCSSStyleSheetCommand.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/SetCSSStyleSheetCommand.java new file mode 100644 index 00000000000..f9925577cc8 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/databinding/SetCSSStyleSheetCommand.java @@ -0,0 +1,45 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.SetCustomStyleListValueCommand;
+
+//TODO: This a remove & add command
+//This command is currently never called in Papyrus
+//See DiagramStyleSheetObservableList#getSetCommand(int, Object)
+public class SetCSSStyleSheetCommand extends SetCustomStyleListValueCommand {
+
+ public SetCSSStyleSheetCommand(EditingDomain domain, View view, String styleName, EClass eClass, EStructuralFeature feature, int index, Object value) {
+ super(domain, view, styleName, eClass, feature, index, value);
+ //TODO: implement execute & undo
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void execute() {
+ //TODO: Check whether we're removing an element. If so, remove it (And delete it, eventually).
+ //In any case, create the new element and add it in the resource. Keep track of each.
+ super.execute();
+ }
+
+ @Override
+ public void undo() {
+ //TODO: If an element has been removed, recreate it and add it in the view's resource
+ //Remove the newly created element
+ super.undo();
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java new file mode 100644 index 00000000000..518ac583d3b --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java @@ -0,0 +1,69 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSAnnotations;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.creation.StyleSheetFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding.DiagramStyleSheetObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.provider.CSSStyleSheetContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.provider.CSSStyleSheetLabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.CustomStyleModelElement;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+
+
+public class CSSModelElement extends CustomStyleModelElement {
+
+ public CSSModelElement(View source, DataContextElement context) {
+ super(source, context);
+ }
+
+ public CSSModelElement(View source, EditingDomain domain, DataContextElement element) {
+ super(source, domain, element);
+ }
+
+ @Override
+ public ReferenceValueFactory getValueFactory(String propertyPath) {
+ if(CSSAnnotations.CSS_DIAGRAM_STYLESHEETS_KEY.equals(propertyPath)) {
+ return new StyleSheetFactory((View)this.source);
+ }
+
+ return super.getValueFactory(propertyPath);
+ }
+
+ @Override
+ public IObservable doGetObservable(String propertyPath) {
+ if(CSSAnnotations.CSS_DIAGRAM_STYLESHEETS_KEY.equals(propertyPath)) {
+ return new DiagramStyleSheetObservableList((View)source, domain, propertyPath);
+ }
+ return super.doGetObservable(propertyPath);
+ }
+
+ @Override
+ public ILabelProvider getLabelProvider(String propertyPath) {
+ if(CSSAnnotations.CSS_DIAGRAM_STYLESHEETS_KEY.equals(propertyPath)) {
+ return new CSSStyleSheetLabelProvider();
+ }
+ return super.getLabelProvider(propertyPath);
+ }
+
+ @Override
+ public IStaticContentProvider getContentProvider(String propertyPath) {
+ return new CSSStyleSheetContentProvider(source);
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElementFactory.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElementFactory.java new file mode 100644 index 00000000000..d71749709c0 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElementFactory.java @@ -0,0 +1,42 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.Activator;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
+
+
+public class CSSModelElementFactory implements ModelElementFactory {
+
+ public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
+ View view = NotationHelper.findView(sourceElement);
+ if(view == null) {
+ Activator.log.warn("The selected element cannot be resolved to a GMF View");
+ return null;
+ }
+
+ EditingDomain domain = EMFHelper.resolveEditingDomain(view);
+
+ if(domain == null) {
+ return new CSSModelElement(view, context);
+ } else {
+ return new CSSModelElement(view, domain, context);
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSStyleSheetContentProvider.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSStyleSheetContentProvider.java new file mode 100644 index 00000000000..a5f51a81a99 --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSStyleSheetContentProvider.java @@ -0,0 +1,65 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.provider;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
+
+
+public class CSSStyleSheetContentProvider extends EMFContentProvider {
+
+ private EObject context;
+
+ public CSSStyleSheetContentProvider(EObject sourceEObject) {
+ super(sourceEObject, ModelStyleSheetsPackage.eINSTANCE.getModelStyleSheets_Stylesheets());
+ this.context = sourceEObject;
+ }
+
+ /**
+ * Returns the content provider associated to feature being edited
+ *
+ * @param editedEObject
+ * The object being edited
+ * @param feature
+ * The object's feature being edited
+ * @return
+ * A content provider returning all the values valid for the given feature
+ */
+ @Override
+ protected IStructuredContentProvider getSemanticProvider(EObject editedEObject, EStructuralFeature feature) {
+
+ return new AbstractStaticContentProvider() {
+
+ public Object[] getElements() {
+ List<Object> result = new LinkedList<Object>();
+ for(Resource resource : CSSStyleSheetContentProvider.this.context.eResource().getResourceSet().getResources()) {
+ for(Object object : resource.getContents()) {
+ if(object instanceof StyleSheet) {
+ result.add(object);
+ }
+ }
+ }
+ return result.toArray();
+ }
+ };
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSStyleSheetLabelProvider.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSStyleSheetLabelProvider.java new file mode 100644 index 00000000000..1ddeeb3277f --- /dev/null +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSStyleSheetLabelProvider.java @@ -0,0 +1,30 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.provider;
+
+import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheetReference;
+
+
+public class CSSStyleSheetLabelProvider extends EMFLabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if(element instanceof StyleSheetReference) {
+ return ((StyleSheetReference)element).getPath();
+ } else if(element instanceof EmbeddedStyleSheet) {
+ return "EmbeddedStyleSheet";
+ }
+ return super.getText(element);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF index 5e4a2100168..cbf7fa8bfc0 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.9.0", org.eclipse.gmf.runtime.notation.edit;bundle-version="1.4.0", org.eclipse.papyrus.infra.core;bundle-version="0.9.0", - org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.9.0" + org.eclipse.papyrus.infra.emf.appearance;bundle-version="0.9.0", + org.eclipse.papyrus.infra.tools;bundle-version="0.9.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.papyrus.infra.gmfdiag.css, diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/model/ModelStyleSheets.ecore b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/model/ModelStyleSheets.ecore index d3ce2874f7e..9a441a75567 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/model/ModelStyleSheets.ecore +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/model/ModelStyleSheets.ecore @@ -6,7 +6,7 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="stylesheets" upperBound="-1"
eType="#//StyleSheet" containment="true"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="StyleSheet" abstract="true"/>
+ <eClassifiers xsi:type="ecore:EClass" name="StyleSheet" abstract="true" interface="true"/>
<eClassifiers xsi:type="ecore:EClass" name="StyleSheetReference" eSuperTypes="#//StyleSheet">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="path" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/resources/papyrus_theme.css b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/resources/papyrus_theme.css index 9812e06765d..5b3caeb77a6 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/resources/papyrus_theme.css +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/resources/papyrus_theme.css @@ -94,9 +94,4 @@ Constraint { Package {
fillColor: white;
}
-
-.external { /* Elements tagged as external (ie. imported) */
- fillColor: rgb(255, 192, 192);
- qualifiedNameDepth: full;
-}
\ No newline at end of file diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBooleanListValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBooleanListValueStyleImpl.java deleted file mode 100644 index d30271da794..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBooleanListValueStyleImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.BooleanListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSBooleanListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSBooleanListValueStyleDelegate; - -public class CSSBooleanListValueStyleImpl extends BooleanListValueStyleImpl implements CSSBooleanListValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSBooleanListValueStyle booleanListValueStyle; - - protected CSSBooleanListValueStyle getBooleanListValueStyle() { - if(booleanListValueStyle == null) { - booleanListValueStyle = new CSSBooleanListValueStyleDelegate(this, getEngine()); - } - return booleanListValueStyle; - } - - protected ExtendedCSSEngine getEngine() { - if(engine == null) { - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView() { - EObject parent = eContainer(); - while(!(parent instanceof View) && parent != null) { - parent = parent.eContainer(); - } - - if(parent != null) { - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName() { - java.lang.String value = super.getName(); - - if(ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)) { - return value; - } else { - return getBooleanListValueStyle().getCSSName(); - } - } - - public EList getCSSBooleanListValue() { - EList value = super.getBooleanListValue(); - - if(ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getBooleanListValueStyle_BooleanListValue(), value)) { - return value; - } else { - return getBooleanListValueStyle().getCSSBooleanListValue(); - } - } - - - @Override - public java.lang.String getName() { - //return super.getName(); - return getCSSName(); - } - - @Override - public EList getBooleanListValue() { - //return super.getBooleanListValue(); - return getCSSBooleanListValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value) { - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBooleanValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBooleanValueStyleImpl.java deleted file mode 100644 index 463c2c69f30..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBooleanValueStyleImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.BooleanValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSBooleanValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSBooleanValueStyleDelegate; - -public class CSSBooleanValueStyleImpl extends BooleanValueStyleImpl implements CSSBooleanValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSBooleanValueStyle booleanValueStyle; - - protected CSSBooleanValueStyle getBooleanValueStyle() { - if(booleanValueStyle == null) { - booleanValueStyle = new CSSBooleanValueStyleDelegate(this, getEngine()); - } - return booleanValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getBooleanValueStyle().getCSSName(); - } - } - - public boolean isCSSBooleanValue(){ - boolean value = super.isBooleanValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getBooleanValueStyle_BooleanValue(), value)){ - return value; - } else { - return getBooleanValueStyle().isCSSBooleanValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public boolean isBooleanValue(){ - //return super.isBooleanValue(); - return isCSSBooleanValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - @Override - public void setBooleanValue(boolean value){ - super.setBooleanValue(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getBooleanValueStyle_BooleanValue(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDoubleListValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDoubleListValueStyleImpl.java deleted file mode 100644 index e12c0235a80..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDoubleListValueStyleImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.DoubleListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSDoubleListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSDoubleListValueStyleDelegate; - -public class CSSDoubleListValueStyleImpl extends DoubleListValueStyleImpl implements CSSDoubleListValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSDoubleListValueStyle doubleListValueStyle; - - protected CSSDoubleListValueStyle getDoubleListValueStyle() { - if(doubleListValueStyle == null) { - doubleListValueStyle = new CSSDoubleListValueStyleDelegate(this, getEngine()); - } - return doubleListValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getDoubleListValueStyle().getCSSName(); - } - } - - public EList getCSSDoubleListValue(){ - EList value = super.getDoubleListValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getDoubleListValueStyle_DoubleListValue(), value)){ - return value; - } else { - return getDoubleListValueStyle().getCSSDoubleListValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public EList getDoubleListValue(){ - //return super.getDoubleListValue(); - return getCSSDoubleListValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDoubleValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDoubleValueStyleImpl.java deleted file mode 100644 index 33291745e97..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDoubleValueStyleImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.DoubleValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSDoubleValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSDoubleValueStyleDelegate; - -public class CSSDoubleValueStyleImpl extends DoubleValueStyleImpl implements CSSDoubleValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSDoubleValueStyle doubleValueStyle; - - protected CSSDoubleValueStyle getDoubleValueStyle() { - if(doubleValueStyle == null) { - doubleValueStyle = new CSSDoubleValueStyleDelegate(this, getEngine()); - } - return doubleValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getDoubleValueStyle().getCSSName(); - } - } - - public double getCSSDoubleValue(){ - double value = super.getDoubleValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getDoubleValueStyle_DoubleValue(), value)){ - return value; - } else { - return getDoubleValueStyle().getCSSDoubleValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public double getDoubleValue(){ - //return super.getDoubleValue(); - return getCSSDoubleValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - @Override - public void setDoubleValue(double value){ - super.setDoubleValue(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getDoubleValueStyle_DoubleValue(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEObjectListValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEObjectListValueStyleImpl.java deleted file mode 100644 index 806a70cc13b..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEObjectListValueStyleImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.EObjectListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSEObjectListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSEObjectListValueStyleDelegate; - -public class CSSEObjectListValueStyleImpl extends EObjectListValueStyleImpl implements CSSEObjectListValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSEObjectListValueStyle eObjectListValueStyle; - - protected CSSEObjectListValueStyle getEObjectListValueStyle() { - if(eObjectListValueStyle == null) { - eObjectListValueStyle = new CSSEObjectListValueStyleDelegate(this, getEngine()); - } - return eObjectListValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getEObjectListValueStyle().getCSSName(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEObjectValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEObjectValueStyleImpl.java deleted file mode 100644 index 889730a87ac..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEObjectValueStyleImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.EObjectValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSEObjectValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSEObjectValueStyleDelegate; - -public class CSSEObjectValueStyleImpl extends EObjectValueStyleImpl implements CSSEObjectValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSEObjectValueStyle eObjectValueStyle; - - protected CSSEObjectValueStyle getEObjectValueStyle() { - if(eObjectValueStyle == null) { - eObjectValueStyle = new CSSEObjectValueStyleDelegate(this, getEngine()); - } - return eObjectValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getEObjectValueStyle().getCSSName(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSIntListValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSIntListValueStyleImpl.java deleted file mode 100644 index 9836c2b0648..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSIntListValueStyleImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.IntListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSIntListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSIntListValueStyleDelegate; - -public class CSSIntListValueStyleImpl extends IntListValueStyleImpl implements CSSIntListValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSIntListValueStyle intListValueStyle; - - protected CSSIntListValueStyle getIntListValueStyle() { - if(intListValueStyle == null) { - intListValueStyle = new CSSIntListValueStyleDelegate(this, getEngine()); - } - return intListValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getIntListValueStyle().getCSSName(); - } - } - - public EList getCSSIntListValue(){ - EList value = super.getIntListValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getIntListValueStyle_IntListValue(), value)){ - return value; - } else { - return getIntListValueStyle().getCSSIntListValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public EList getIntListValue(){ - //return super.getIntListValue(); - return getCSSIntListValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSIntValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSIntValueStyleImpl.java deleted file mode 100644 index 340ff6a7c20..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSIntValueStyleImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.IntValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSIntValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSIntValueStyleDelegate; - -public class CSSIntValueStyleImpl extends IntValueStyleImpl implements CSSIntValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSIntValueStyle intValueStyle; - - protected CSSIntValueStyle getIntValueStyle() { - if(intValueStyle == null) { - intValueStyle = new CSSIntValueStyleDelegate(this, getEngine()); - } - return intValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getIntValueStyle().getCSSName(); - } - } - - public int getCSSIntValue(){ - int value = super.getIntValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getIntValueStyle_IntValue(), value)){ - return value; - } else { - return getIntValueStyle().getCSSIntValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public int getIntValue(){ - //return super.getIntValue(); - return getCSSIntValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - @Override - public void setIntValue(int value){ - super.setIntValue(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getIntValueStyle_IntValue(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSListValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSListValueStyleImpl.java deleted file mode 100644 index fd2748e8e7b..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSListValueStyleImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.ListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSListValueStyleDelegate; - -public class CSSListValueStyleImpl extends ListValueStyleImpl implements CSSListValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSListValueStyle listValueStyle; - - protected CSSListValueStyle getListValueStyle() { - if(listValueStyle == null) { - listValueStyle = new CSSListValueStyleDelegate(this, getEngine()); - } - return listValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getListValueStyle().getCSSName(); - } - } - - public EList getCSSRawValuesList(){ - EList value = super.getRawValuesList(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getListValueStyle_RawValuesList(), value)){ - return value; - } else { - return getListValueStyle().getCSSRawValuesList(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public EList getRawValuesList(){ - //return super.getRawValuesList(); - return getCSSRawValuesList(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java index 40171e0c281..28fe6143d1d 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java @@ -433,7 +433,9 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl super.eUnset(featureId); EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(this, feature); + if(feature != null) { + ForceValueHelper.unsetValue(this, feature); + } } public boolean showElementIcon() { diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSSingleValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSSingleValueStyleImpl.java deleted file mode 100644 index 81f009b03b5..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSSingleValueStyleImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.SingleValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSSingleValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSSingleValueStyleDelegate; - -public class CSSSingleValueStyleImpl extends SingleValueStyleImpl implements CSSSingleValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSSingleValueStyle singleValueStyle; - - protected CSSSingleValueStyle getSingleValueStyle() { - if(singleValueStyle == null) { - singleValueStyle = new CSSSingleValueStyleDelegate(this, getEngine()); - } - return singleValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getSingleValueStyle().getCSSName(); - } - } - - public java.lang.String getCSSRawValue(){ - java.lang.String value = super.getRawValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getSingleValueStyle_RawValue(), value)){ - return value; - } else { - return getSingleValueStyle().getCSSRawValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public java.lang.String getRawValue(){ - //return super.getRawValue(); - return getCSSRawValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - @Override - public void setRawValue(java.lang.String value){ - super.setRawValue(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getSingleValueStyle_RawValue(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSStringListValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSStringListValueStyleImpl.java deleted file mode 100644 index c9413124a1f..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSStringListValueStyleImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.StringListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSStringListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSStringListValueStyleDelegate; - -public class CSSStringListValueStyleImpl extends StringListValueStyleImpl implements CSSStringListValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSStringListValueStyle stringListValueStyle; - - protected CSSStringListValueStyle getStringListValueStyle() { - if(stringListValueStyle == null) { - stringListValueStyle = new CSSStringListValueStyleDelegate(this, getEngine()); - } - return stringListValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getStringListValueStyle().getCSSName(); - } - } - - public EList getCSSStringListValue(){ - EList value = super.getStringListValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getStringListValueStyle_StringListValue(), value)){ - return value; - } else { - return getStringListValueStyle().getCSSStringListValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public EList getStringListValue(){ - //return super.getStringListValue(); - return getCSSStringListValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSStringValueStyleImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSStringValueStyleImpl.java deleted file mode 100644 index dbc3e4cfc0d..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSStringValueStyleImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.gmf.runtime.notation.impl.StringValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSStringValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSStringValueStyleDelegate; - -public class CSSStringValueStyleImpl extends StringValueStyleImpl implements CSSStringValueStyle { - - protected ExtendedCSSEngine engine; - - private CSSStringValueStyle stringValueStyle; - - protected CSSStringValueStyle getStringValueStyle() { - if(stringValueStyle == null) { - stringValueStyle = new CSSStringValueStyleDelegate(this, getEngine()); - } - return stringValueStyle; - } - - protected ExtendedCSSEngine getEngine(){ - if (engine == null){ - engine = ((CSSDiagramImpl)findView().getDiagram()).getEngine(); - } - return engine; - } - - protected View findView(){ - EObject parent = eContainer(); - while (! (parent instanceof View) && parent != null){ - parent = parent.eContainer(); - } - - if (parent != null){ - return (View)parent; - } - - return null; - } - - - ////////////////////////////////////////// - // Forwards accesses to CSS properties // - ////////////////////////////////////////// - - - public java.lang.String getCSSName(){ - java.lang.String value = super.getName(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getNamedStyle_Name(), value)){ - return value; - } else { - return getStringValueStyle().getCSSName(); - } - } - - public java.lang.String getCSSStringValue(){ - java.lang.String value = super.getStringValue(); - - if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getStringValueStyle_StringValue(), value)){ - return value; - } else { - return getStringValueStyle().getCSSStringValue(); - } - } - - - @Override - public java.lang.String getName(){ - //return super.getName(); - return getCSSName(); - } - - @Override - public java.lang.String getStringValue(){ - //return super.getStringValue(); - return getCSSStringValue(); - } - - - - //////////////////////////////////////////////// - // Implements a setter for each CSS property // - //////////////////////////////////////////////// - - @Override - public void setName(java.lang.String value){ - super.setName(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getNamedStyle_Name(); - ForceValueHelper.setValue(findView(), feature, value); - } - - @Override - public void setStringValue(java.lang.String value){ - super.setStringValue(value); - - EStructuralFeature feature = NotationPackage.eINSTANCE.getStringValueStyle_StringValue(); - ForceValueHelper.setValue(findView(), feature, value); - } - - ////////////////////////////////// - // Implements the unset method // - ////////////////////////////////// - - @Override - public void eUnset(int featureId) { - super.eUnset(featureId); - - EStructuralFeature feature = eDynamicFeature(featureId); - ForceValueHelper.unsetValue(findView(), feature); - } - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java index ae804dc14d2..8de955093ed 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java @@ -14,8 +14,6 @@ package org.eclipse.papyrus.infra.gmfdiag.css.factory; import org.eclipse.gmf.runtime.notation.ArrowStyle; import org.eclipse.gmf.runtime.notation.BasicCompartment; import org.eclipse.gmf.runtime.notation.BasicSemanticCompartment; -import org.eclipse.gmf.runtime.notation.BooleanListValueStyle; -import org.eclipse.gmf.runtime.notation.BooleanValueStyle; import org.eclipse.gmf.runtime.notation.ByteArrayValueStyle; import org.eclipse.gmf.runtime.notation.CanonicalStyle; import org.eclipse.gmf.runtime.notation.Compartment; @@ -26,11 +24,7 @@ import org.eclipse.gmf.runtime.notation.DescriptionStyle; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.DiagramLinkStyle; import org.eclipse.gmf.runtime.notation.DiagramStyle; -import org.eclipse.gmf.runtime.notation.DoubleListValueStyle; -import org.eclipse.gmf.runtime.notation.DoubleValueStyle; import org.eclipse.gmf.runtime.notation.DrawerStyle; -import org.eclipse.gmf.runtime.notation.EObjectListValueStyle; -import org.eclipse.gmf.runtime.notation.EObjectValueStyle; import org.eclipse.gmf.runtime.notation.FillStyle; import org.eclipse.gmf.runtime.notation.FilteringStyle; import org.eclipse.gmf.runtime.notation.FontStyle; @@ -38,12 +32,9 @@ import org.eclipse.gmf.runtime.notation.GuideStyle; import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle; import org.eclipse.gmf.runtime.notation.ImageBufferStyle; import org.eclipse.gmf.runtime.notation.ImageStyle; -import org.eclipse.gmf.runtime.notation.IntListValueStyle; -import org.eclipse.gmf.runtime.notation.IntValueStyle; import org.eclipse.gmf.runtime.notation.LineStyle; import org.eclipse.gmf.runtime.notation.LineTypeStyle; import org.eclipse.gmf.runtime.notation.ListCompartment; -import org.eclipse.gmf.runtime.notation.ListValueStyle; import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle; import org.eclipse.gmf.runtime.notation.NamedStyle; import org.eclipse.gmf.runtime.notation.PageStyle; @@ -53,19 +44,14 @@ import org.eclipse.gmf.runtime.notation.RoutingStyle; import org.eclipse.gmf.runtime.notation.SemanticListCompartment; import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.ShapeStyle; -import org.eclipse.gmf.runtime.notation.SingleValueStyle; import org.eclipse.gmf.runtime.notation.SortingStyle; import org.eclipse.gmf.runtime.notation.StandardDiagram; -import org.eclipse.gmf.runtime.notation.StringListValueStyle; -import org.eclipse.gmf.runtime.notation.StringValueStyle; import org.eclipse.gmf.runtime.notation.TextStyle; import org.eclipse.gmf.runtime.notation.TitleStyle; import org.eclipse.gmf.runtime.notation.impl.NotationFactoryImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSArrowStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSBasicCompartmentImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSBasicSemanticCompartmentImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSBooleanListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSBooleanValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSByteArrayValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSCanonicalStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSCompartmentImpl; @@ -75,11 +61,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.CSSDataTypeStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSDescriptionStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSDiagramLinkStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSDiagramStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSDoubleListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSDoubleValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSDrawerStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSEObjectListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSEObjectValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSFillStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSFilteringStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSFontStyleImpl; @@ -87,12 +69,9 @@ import org.eclipse.papyrus.infra.gmfdiag.css.CSSGuideStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSHintedDiagramLinkStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSImageBufferStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSImageStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSIntListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSIntValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSLineStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSLineTypeStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSListCompartmentImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSListValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSMultiDiagramLinkStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSNamedStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSPageStyleImpl; @@ -102,11 +81,8 @@ import org.eclipse.papyrus.infra.gmfdiag.css.CSSRoutingStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSSemanticListCompartmentImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSShapeImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSShapeStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSSingleValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSSortingStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSStandardDiagramImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSStringListValueStyleImpl; -import org.eclipse.papyrus.infra.gmfdiag.css.CSSStringValueStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSTextStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.CSSTitleStyleImpl; import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl; @@ -116,249 +92,188 @@ public class CSSNotationFactory extends NotationFactoryImpl { public static CSSNotationFactory eINSTANCE = new CSSNotationFactory(); @Override - public Diagram createDiagram(){ + public Diagram createDiagram() { return new CSSDiagramImpl(); } - @Override - public FillStyle createFillStyle() { + public FillStyle createFillStyle() { return new CSSFillStyleImpl(); } - + @Override - public LineStyle createLineStyle() { + public LineStyle createLineStyle() { return new CSSLineStyleImpl(); } - + @Override - public FontStyle createFontStyle() { + public FontStyle createFontStyle() { return new CSSFontStyleImpl(); } - + @Override - public TitleStyle createTitleStyle() { + public TitleStyle createTitleStyle() { return new CSSTitleStyleImpl(); } - + @Override - public SortingStyle createSortingStyle() { + public SortingStyle createSortingStyle() { return new CSSSortingStyleImpl(); } - + @Override - public DescriptionStyle createDescriptionStyle() { + public DescriptionStyle createDescriptionStyle() { return new CSSDescriptionStyleImpl(); } - + @Override - public RoutingStyle createRoutingStyle() { + public RoutingStyle createRoutingStyle() { return new CSSRoutingStyleImpl(); } - + @Override - public CanonicalStyle createCanonicalStyle() { + public CanonicalStyle createCanonicalStyle() { return new CSSCanonicalStyleImpl(); } - + @Override - public ShapeStyle createShapeStyle() { + public ShapeStyle createShapeStyle() { return new CSSShapeStyleImpl(); } - + @Override - public ConnectorStyle createConnectorStyle() { + public ConnectorStyle createConnectorStyle() { return new CSSConnectorStyleImpl(); } - + @Override - public PageStyle createPageStyle() { + public PageStyle createPageStyle() { return new CSSPageStyleImpl(); } - + @Override - public DrawerStyle createDrawerStyle() { + public DrawerStyle createDrawerStyle() { return new CSSDrawerStyleImpl(); } - + @Override - public GuideStyle createGuideStyle() { + public GuideStyle createGuideStyle() { return new CSSGuideStyleImpl(); } - + @Override - public FilteringStyle createFilteringStyle() { + public FilteringStyle createFilteringStyle() { return new CSSFilteringStyleImpl(); } - + @Override - public DiagramStyle createDiagramStyle() { + public DiagramStyle createDiagramStyle() { return new CSSDiagramStyleImpl(); } - + @Override - public ImageStyle createImageStyle() { + public ImageStyle createImageStyle() { return new CSSImageStyleImpl(); } - + @Override - public ImageBufferStyle createImageBufferStyle() { + public ImageBufferStyle createImageBufferStyle() { return new CSSImageBufferStyleImpl(); } - + @Override - public PropertiesSetStyle createPropertiesSetStyle() { + public PropertiesSetStyle createPropertiesSetStyle() { return new CSSPropertiesSetStyleImpl(); } - - @Override - public SingleValueStyle createSingleValueStyle() { - return new CSSSingleValueStyleImpl(); - } - - @Override - public ListValueStyle createListValueStyle() { - return new CSSListValueStyleImpl(); - } - + @Override - public NamedStyle createNamedStyle() { + public NamedStyle createNamedStyle() { return new CSSNamedStyleImpl(); } - + @Override - public DataTypeStyle createDataTypeStyle() { + public DataTypeStyle createDataTypeStyle() { return new CSSDataTypeStyleImpl(); } - - @Override - public IntValueStyle createIntValueStyle() { - return new CSSIntValueStyleImpl(); - } - - @Override - public IntListValueStyle createIntListValueStyle() { - return new CSSIntListValueStyleImpl(); - } - - @Override - public BooleanValueStyle createBooleanValueStyle() { - return new CSSBooleanValueStyleImpl(); - } - - @Override - public DoubleValueStyle createDoubleValueStyle() { - return new CSSDoubleValueStyleImpl(); - } - - @Override - public DoubleListValueStyle createDoubleListValueStyle() { - return new CSSDoubleListValueStyleImpl(); - } - - @Override - public StringValueStyle createStringValueStyle() { - return new CSSStringValueStyleImpl(); - } - - @Override - public StringListValueStyle createStringListValueStyle() { - return new CSSStringListValueStyleImpl(); - } - - @Override - public EObjectValueStyle createEObjectValueStyle() { - return new CSSEObjectValueStyleImpl(); - } - - @Override - public EObjectListValueStyle createEObjectListValueStyle() { - return new CSSEObjectListValueStyleImpl(); - } - + @Override - public ByteArrayValueStyle createByteArrayValueStyle() { + public ByteArrayValueStyle createByteArrayValueStyle() { return new CSSByteArrayValueStyleImpl(); } - - @Override - public BooleanListValueStyle createBooleanListValueStyle() { - return new CSSBooleanListValueStyleImpl(); - } - + @Override - public HintedDiagramLinkStyle createHintedDiagramLinkStyle() { + public HintedDiagramLinkStyle createHintedDiagramLinkStyle() { return new CSSHintedDiagramLinkStyleImpl(); } - + @Override - public DiagramLinkStyle createDiagramLinkStyle() { + public DiagramLinkStyle createDiagramLinkStyle() { return new CSSDiagramLinkStyleImpl(); } - + @Override - public MultiDiagramLinkStyle createMultiDiagramLinkStyle() { + public MultiDiagramLinkStyle createMultiDiagramLinkStyle() { return new CSSMultiDiagramLinkStyleImpl(); } - + @Override - public TextStyle createTextStyle() { + public TextStyle createTextStyle() { return new CSSTextStyleImpl(); } - + @Override - public LineTypeStyle createLineTypeStyle() { + public LineTypeStyle createLineTypeStyle() { return new CSSLineTypeStyleImpl(); } - + @Override - public ArrowStyle createArrowStyle() { + public ArrowStyle createArrowStyle() { return new CSSArrowStyleImpl(); } - + @Override - public Shape createShape() { + public Shape createShape() { return new CSSShapeImpl(); } - + @Override - public Compartment createCompartment() { + public Compartment createCompartment() { return new CSSCompartmentImpl(); } - + @Override - public ListCompartment createListCompartment() { + public ListCompartment createListCompartment() { return new CSSListCompartmentImpl(); } - + @Override - public Connector createConnector() { + public Connector createConnector() { return new CSSConnectorImpl(); } - + @Override - public StandardDiagram createStandardDiagram() { + public StandardDiagram createStandardDiagram() { return new CSSStandardDiagramImpl(); } - + @Override - public BasicCompartment createBasicCompartment() { + public BasicCompartment createBasicCompartment() { return new CSSBasicCompartmentImpl(); } - + @Override - public BasicSemanticCompartment createBasicSemanticCompartment() { + public BasicSemanticCompartment createBasicSemanticCompartment() { return new CSSBasicSemanticCompartmentImpl(); } - + @Override - public SemanticListCompartment createSemanticListCompartment() { + public SemanticListCompartment createSemanticListCompartment() { return new CSSSemanticListCompartmentImpl(); } - + @Override - public RoundedCornersStyle createRoundedCornersStyle() { + public RoundedCornersStyle createRoundedCornersStyle() { return new CSSRoundedCornersStyleImpl(); } - + } diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/ModelStyleSheetsPackage.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/ModelStyleSheetsPackage.java index ab81c0fcbf1..17c16b5ce6f 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/ModelStyleSheetsPackage.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/ModelStyleSheetsPackage.java @@ -98,10 +98,10 @@ public interface ModelStyleSheetsPackage extends EPackage { int MODEL_STYLE_SHEETS_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 1;
/**
- * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.impl.StyleSheetImpl <em>Style Sheet</em>}' class.
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet <em>Style Sheet</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.impl.StyleSheetImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet
* @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.impl.ModelStyleSheetsPackageImpl#getStyleSheet()
* @generated
*/
@@ -287,10 +287,10 @@ public interface ModelStyleSheetsPackage extends EPackage { EReference MODEL_STYLE_SHEETS__STYLESHEETS = eINSTANCE.getModelStyleSheets_Stylesheets();
/**
- * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.impl.StyleSheetImpl <em>Style Sheet</em>}' class.
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet <em>Style Sheet</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.impl.StyleSheetImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet
* @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.impl.ModelStyleSheetsPackageImpl#getStyleSheet()
* @generated
*/
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/StyleSheet.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/StyleSheet.java index 5433b1893ea..67bca2f9ddb 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/StyleSheet.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/StyleSheet.java @@ -15,7 +15,7 @@ import org.eclipse.emf.ecore.EObject; *
*
* @see org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheetsPackage#getStyleSheet()
- * @model abstract="true"
+ * @model interface="true" abstract="true"
* @generated
*/
public interface StyleSheet extends EObject {
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/EmbeddedStyleSheetImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/EmbeddedStyleSheetImpl.java index b945e244cd9..116ac79b92d 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/EmbeddedStyleSheetImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/EmbeddedStyleSheetImpl.java @@ -12,6 +12,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.EmbeddedStyleSheet;
import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheetsPackage;
@@ -28,7 +29,8 @@ import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheetsPa *
* @generated
*/
-public class EmbeddedStyleSheetImpl extends StyleSheetImpl implements EmbeddedStyleSheet {
+public class EmbeddedStyleSheetImpl extends
+EObjectImpl implements EmbeddedStyleSheet {
/**
* The default value of the '{@link #getContent() <em>Content</em>}' attribute.
* <!-- begin-user-doc -->
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/ModelStyleSheetsPackageImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/ModelStyleSheetsPackageImpl.java index 5b11a9a5fe4..c254bbd5cab 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/ModelStyleSheetsPackageImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/ModelStyleSheetsPackageImpl.java @@ -262,7 +262,7 @@ public class ModelStyleSheetsPackageImpl extends EPackageImpl implements ModelSt initEClass(modelStyleSheetsEClass, ModelStyleSheets.class, "ModelStyleSheets", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getModelStyleSheets_Stylesheets(), this.getStyleSheet(), null, "stylesheets", null, 0, -1, ModelStyleSheets.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(styleSheetEClass, StyleSheet.class, "StyleSheet", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEClass(styleSheetEClass, StyleSheet.class, "StyleSheet", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(styleSheetReferenceEClass, StyleSheetReference.class, "StyleSheetReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getStyleSheetReference_Path(), theEcorePackage.getEString(), "path", null, 1, 1, StyleSheetReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/StyleSheetReferenceImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/StyleSheetReferenceImpl.java index 9cca0da7b0a..4b181e3e169 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/StyleSheetReferenceImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/modelstylesheets/impl/StyleSheetReferenceImpl.java @@ -12,6 +12,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheetsPackage;
import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheetReference;
@@ -28,7 +29,8 @@ import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheetReferenc *
* @generated
*/
-public class StyleSheetReferenceImpl extends StyleSheetImpl implements StyleSheetReference {
+public class StyleSheetReferenceImpl extends
+EObjectImpl implements StyleSheetReference {
/**
* The default value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSBooleanValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSBooleanValueStyle.java deleted file mode 100644 index 965de48b1df..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSBooleanValueStyle.java +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSBooleanValueStyle extends CSSNamedStyle{ - - public boolean isCSSBooleanValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSDoubleListValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSDoubleListValueStyle.java deleted file mode 100644 index 0e1e9798ce4..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSDoubleListValueStyle.java +++ /dev/null @@ -1,20 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - -import org.eclipse.emf.common.util.EList; - -public interface CSSDoubleListValueStyle extends CSSNamedStyle{ - - public EList getCSSDoubleListValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSDoubleValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSDoubleValueStyle.java deleted file mode 100644 index 937d3e87eb6..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSDoubleValueStyle.java +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSDoubleValueStyle extends CSSNamedStyle{ - - public double getCSSDoubleValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSEObjectListValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSEObjectListValueStyle.java deleted file mode 100644 index 8c46df5d84b..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSEObjectListValueStyle.java +++ /dev/null @@ -1,18 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSEObjectListValueStyle extends CSSNamedStyle{ - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSEObjectValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSEObjectValueStyle.java deleted file mode 100644 index f028e22ca86..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSEObjectValueStyle.java +++ /dev/null @@ -1,18 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSEObjectValueStyle extends CSSNamedStyle{ - - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSIntListValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSIntListValueStyle.java deleted file mode 100644 index aa7f438274f..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSIntListValueStyle.java +++ /dev/null @@ -1,20 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - -import org.eclipse.emf.common.util.EList; - -public interface CSSIntListValueStyle extends CSSNamedStyle{ - - public EList getCSSIntListValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSIntValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSIntValueStyle.java deleted file mode 100644 index 0e0d791f82a..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSIntValueStyle.java +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSIntValueStyle extends CSSNamedStyle{ - - public int getCSSIntValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSListValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSListValueStyle.java deleted file mode 100644 index a71ecc65890..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSListValueStyle.java +++ /dev/null @@ -1,20 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - -import org.eclipse.emf.common.util.EList; - -public interface CSSListValueStyle extends CSSNamedStyle, CSSDataTypeStyle{ - - public EList getCSSRawValuesList(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSSingleValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSSingleValueStyle.java deleted file mode 100644 index b666af0888e..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSSingleValueStyle.java +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSSingleValueStyle extends CSSNamedStyle, CSSDataTypeStyle{ - - public java.lang.String getCSSRawValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSStringListValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSStringListValueStyle.java deleted file mode 100644 index d649eb1b8fb..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSStringListValueStyle.java +++ /dev/null @@ -1,20 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - -import org.eclipse.emf.common.util.EList; - -public interface CSSStringListValueStyle extends CSSNamedStyle{ - - public EList getCSSStringListValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSStringValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSStringValueStyle.java deleted file mode 100644 index 1119a976c56..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSStringValueStyle.java +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - - -public interface CSSStringValueStyle extends CSSNamedStyle{ - - public java.lang.String getCSSStringValue(); - -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSBooleanListValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSBooleanListValueStyleDelegate.java deleted file mode 100644 index 7f84db4066d..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSBooleanListValueStyleDelegate.java +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.gmf.runtime.notation.BooleanListValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSBooleanListValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSBooleanListValueStyleDelegate implements CSSBooleanListValueStyle { - - private BooleanListValueStyle booleanListValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSBooleanListValueStyleDelegate(BooleanListValueStyle booleanListValueStyle, ExtendedCSSEngine engine) { - this.booleanListValueStyle = booleanListValueStyle; - this.engine = engine; - this.element = engine.getElement(this.booleanListValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName() { - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public EList getCSSBooleanListValue() { - CSSValue cssValue = engine.retrievePropertyValue(element, "booleanListValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getBooleanListValueStyle_BooleanListValue().getDefaultValue(); - return (EList)defaultValue; - } - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSBooleanValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSBooleanValueStyleDelegate.java deleted file mode 100644 index f323975caba..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSBooleanValueStyleDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.BooleanValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSBooleanValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSBooleanValueStyleDelegate implements CSSBooleanValueStyle{ - - private BooleanValueStyle booleanValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSBooleanValueStyleDelegate(BooleanValueStyle booleanValueStyle, ExtendedCSSEngine engine){ - this.booleanValueStyle = booleanValueStyle; - this.engine = engine; - this.element = engine.getElement(this.booleanValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public boolean isCSSBooleanValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "booleanValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getBooleanValueStyle_BooleanValue().getDefaultValue(); - return (Boolean)defaultValue; - } - return (Boolean)engine.convert(cssValue, Boolean.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSDoubleListValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSDoubleListValueStyleDelegate.java deleted file mode 100644 index d8f0473e435..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSDoubleListValueStyleDelegate.java +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.gmf.runtime.notation.DoubleListValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSDoubleListValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSDoubleListValueStyleDelegate implements CSSDoubleListValueStyle{ - - private DoubleListValueStyle doubleListValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSDoubleListValueStyleDelegate(DoubleListValueStyle doubleListValueStyle, ExtendedCSSEngine engine){ - this.doubleListValueStyle = doubleListValueStyle; - this.engine = engine; - this.element = engine.getElement(this.doubleListValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public EList getCSSDoubleListValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "doubleListValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getDoubleListValueStyle_DoubleListValue().getDefaultValue(); - return (EList)defaultValue; - } - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSDoubleValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSDoubleValueStyleDelegate.java deleted file mode 100644 index 3f230a0ede5..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSDoubleValueStyleDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.DoubleValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSDoubleValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSDoubleValueStyleDelegate implements CSSDoubleValueStyle{ - - private DoubleValueStyle doubleValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSDoubleValueStyleDelegate(DoubleValueStyle doubleValueStyle, ExtendedCSSEngine engine){ - this.doubleValueStyle = doubleValueStyle; - this.engine = engine; - this.element = engine.getElement(this.doubleValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public double getCSSDoubleValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "doubleValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getDoubleValueStyle_DoubleValue().getDefaultValue(); - return (Double)defaultValue; - } - return (Double)engine.convert(cssValue, Double.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSEObjectListValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSEObjectListValueStyleDelegate.java deleted file mode 100644 index 7d758207683..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSEObjectListValueStyleDelegate.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.EObjectListValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSEObjectListValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSEObjectListValueStyleDelegate implements CSSEObjectListValueStyle{ - - private EObjectListValueStyle eObjectListValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSEObjectListValueStyleDelegate(EObjectListValueStyle eObjectListValueStyle, ExtendedCSSEngine engine){ - this.eObjectListValueStyle = eObjectListValueStyle; - this.engine = engine; - this.element = engine.getElement(this.eObjectListValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSEObjectValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSEObjectValueStyleDelegate.java deleted file mode 100644 index 4666f4cdbcc..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSEObjectValueStyleDelegate.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.EObjectValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSEObjectValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSEObjectValueStyleDelegate implements CSSEObjectValueStyle{ - - private EObjectValueStyle eObjectValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSEObjectValueStyleDelegate(EObjectValueStyle eObjectValueStyle, ExtendedCSSEngine engine){ - this.eObjectValueStyle = eObjectValueStyle; - this.engine = engine; - this.element = engine.getElement(this.eObjectValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSIntListValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSIntListValueStyleDelegate.java deleted file mode 100644 index 9e29d557416..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSIntListValueStyleDelegate.java +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.gmf.runtime.notation.IntListValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSIntListValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSIntListValueStyleDelegate implements CSSIntListValueStyle{ - - private IntListValueStyle intListValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSIntListValueStyleDelegate(IntListValueStyle intListValueStyle, ExtendedCSSEngine engine){ - this.intListValueStyle = intListValueStyle; - this.engine = engine; - this.element = engine.getElement(this.intListValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public EList getCSSIntListValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "intListValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getIntListValueStyle_IntListValue().getDefaultValue(); - return (EList)defaultValue; - } - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSIntValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSIntValueStyleDelegate.java deleted file mode 100644 index 3ff680bd9b8..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSIntValueStyleDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.IntValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSIntValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSIntValueStyleDelegate implements CSSIntValueStyle{ - - private IntValueStyle intValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSIntValueStyleDelegate(IntValueStyle intValueStyle, ExtendedCSSEngine engine){ - this.intValueStyle = intValueStyle; - this.engine = engine; - this.element = engine.getElement(this.intValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public int getCSSIntValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "intValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getIntValueStyle_IntValue().getDefaultValue(); - return (Integer)defaultValue; - } - return (Integer)engine.convert(cssValue, Integer.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSListValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSListValueStyleDelegate.java deleted file mode 100644 index db42e0f0e5c..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSListValueStyleDelegate.java +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.gmf.runtime.notation.ListValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSListValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSListValueStyleDelegate implements CSSListValueStyle{ - - private ListValueStyle listValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSListValueStyleDelegate(ListValueStyle listValueStyle, ExtendedCSSEngine engine){ - this.listValueStyle = listValueStyle; - this.engine = engine; - this.element = engine.getElement(this.listValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public EList getCSSRawValuesList(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "rawValuesList"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getListValueStyle_RawValuesList().getDefaultValue(); - return (EList)defaultValue; - } - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSSingleValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSSingleValueStyleDelegate.java deleted file mode 100644 index 6c0f78fae5f..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSSingleValueStyleDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.SingleValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSSingleValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSSingleValueStyleDelegate implements CSSSingleValueStyle{ - - private SingleValueStyle singleValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSSingleValueStyleDelegate(SingleValueStyle singleValueStyle, ExtendedCSSEngine engine){ - this.singleValueStyle = singleValueStyle; - this.engine = engine; - this.element = engine.getElement(this.singleValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public java.lang.String getCSSRawValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "rawValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getSingleValueStyle_RawValue().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSStringListValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSStringListValueStyleDelegate.java deleted file mode 100644 index 26ef117eaca..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSStringListValueStyleDelegate.java +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.StringListValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSStringListValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSStringListValueStyleDelegate implements CSSStringListValueStyle{ - - private StringListValueStyle stringListValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSStringListValueStyleDelegate(StringListValueStyle stringListValueStyle, ExtendedCSSEngine engine){ - this.stringListValueStyle = stringListValueStyle; - this.engine = engine; - this.element = engine.getElement(this.stringListValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public EList getCSSStringListValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "stringListValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getStringListValueStyle_StringListValue().getDefaultValue(); - return (EList)defaultValue; - } - return null; - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSStringValueStyleDelegate.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSStringValueStyleDelegate.java deleted file mode 100644 index 8967f509e2a..00000000000 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSStringValueStyleDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style.impl; - -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.StringValueStyle; -import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; -import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSStringValueStyle; -import org.w3c.dom.Element; -import org.w3c.dom.css.CSSValue; - -@SuppressWarnings("restriction") -public class CSSStringValueStyleDelegate implements CSSStringValueStyle{ - - private StringValueStyle stringValueStyle; - - private ExtendedCSSEngine engine; - - private Element element; - - public CSSStringValueStyleDelegate(StringValueStyle stringValueStyle, ExtendedCSSEngine engine){ - this.stringValueStyle = stringValueStyle; - this.engine = engine; - this.element = engine.getElement(this.stringValueStyle); - } - - //////////////////////////////////////////////// - // Implements a getter for each CSS property // - //////////////////////////////////////////////// - - public java.lang.String getCSSName(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "name"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getNamedStyle_Name().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } - - public java.lang.String getCSSStringValue(){ - CSSValue cssValue = engine.retrievePropertyValue(element, "stringValue"); - if(cssValue == null) { - Object defaultValue = NotationPackage.eINSTANCE.getStringValueStyle_StringValue().getDefaultValue(); - return (String)defaultValue; - } - return (String)engine.convert(cssValue, String.class, null); - } -} diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java index 78955709441..a458cbdd849 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java @@ -17,6 +17,7 @@ import static org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSAnnotations.CSS_ import static org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSAnnotations.CSS_GMF_STYLE_KEY;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -25,14 +26,20 @@ import java.util.Map; import org.eclipse.e4.ui.css.core.dom.ElementAdapter;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.StringListValueStyle;
+import org.eclipse.gmf.runtime.notation.StringValueStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.SemanticElementHelper;
+import org.eclipse.papyrus.infra.tools.util.ListHelper;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -99,7 +106,8 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList { }
public static String getCSSClass(EObject sourceElement) {
- return getCSSValue(sourceElement, CSS_GMF_CLASS_KEY);
+ List<String> allClasses = getCSSValues(sourceElement, CSS_GMF_CLASS_KEY);
+ return ListHelper.deepToString(allClasses, " "); //$NON-NLS-1$
}
public static String getCSSStyle(EObject sourceElement) {
@@ -115,25 +123,42 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList { }
private static String getCSSValue(EObject sourceElement, String key) {
- EModelElement modelElement = findModelElement(sourceElement);
- EAnnotation annotation = getStyleAnnotation(modelElement);
- if(annotation == null) {
+ StringValueStyle style = (StringValueStyle)findStyle(sourceElement, key, NotationPackage.eINSTANCE.getStringValueStyle());
+ if(style == null) {
return null;
}
- return annotation.getDetails().get(key);
+ return style.getStringValue();
}
- private static EModelElement findModelElement(EObject sourceElement) {
+ private static List<String> getCSSValues(EObject sourceElement, String key) {
+ StringListValueStyle style = (StringListValueStyle)findStyle(sourceElement, key, NotationPackage.eINSTANCE.getStringListValueStyle());
+ if(style == null) {
+ return Collections.emptyList();
+ }
+
+ return style.getStringListValue();
+ }
+
+ private static NamedStyle findStyle(EObject sourceElement, String key, EClass type) {
+ View view = findView(sourceElement);
+ if(view == null) {
+ return null;
+ }
+
+ return view.getNamedStyle(type, key);
+ }
+
+ private static View findView(EObject sourceElement) {
if(sourceElement == null) {
return null;
}
- if(sourceElement instanceof EModelElement) {
- return (EModelElement)sourceElement;
+ if(sourceElement instanceof View) {
+ return (View)sourceElement;
}
- return findModelElement(sourceElement.eContainer());
+ return findView(sourceElement.eContainer());
}
public GMFElementAdapter(View view, ExtendedCSSEngine engine) {
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java index 9afb4a38ed4..9a5560eac51 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java @@ -38,7 +38,7 @@ public class BaseCSSEngine extends ExtendedCSSEngineImpl { public static ExtendedCSSEngine instance = new BaseCSSEngine();
- //Unsupported operations. The WorkspaceCSSEngine should never be used directly.
+ //Unsupported operations. The BaseCSSEngine should never be used directly.
@Override
public Element getElement(Object node) {
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java index 40782936641..cbeb5dfe86b 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java @@ -11,29 +11,51 @@ *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.engine;
+import java.io.IOException;
+import java.net.URL;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.SemanticElementHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
import org.w3c.dom.Element;
@SuppressWarnings("restriction")
public class DiagramCSSEngine extends ExtendedCSSEngineImpl {
- private Diagram diagram;
+ private CSSDiagram diagram;
- public DiagramCSSEngine(ExtendedCSSEngine parent, Diagram diagram) {
+ public DiagramCSSEngine(ExtendedCSSEngine parent, CSSDiagram diagram) {
super(parent);
this.diagram = diagram;
setElementProvider(new GMFElementProvider());
+ for(StyleSheet styleSheet : diagram.getStyleSheets()) {
+ addStyleSheet(styleSheet);
+ }
+ }
+
+ @Override
+ protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
+ String path = styleSheet.getPath();
+ if(path.startsWith("/")) {
+ path = "platform:/plugin" + path;
+ } else {
+ URI uri = URI.createURI(styleSheet.getPath());
+ uri = uri.resolve(diagram.eResource().getURI());
+ path = uri.toString();
+ }
+ URL url = new URL(path);
+ parseStyleSheet(url.openStream());
}
/**
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java index b6e1b95309e..cb7830a4d0b 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java @@ -16,29 +16,25 @@ import java.net.URL; import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.papyrus.infra.gmfdiag.css.listener.StyleSheetChangeListener;
import org.eclipse.papyrus.infra.gmfdiag.css.lists.ExtendedStyleSheetList;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet;
import org.w3c.dom.css.CSSValue;
@SuppressWarnings("restriction")
public interface ExtendedCSSEngine extends LazyCSSEngine, CSSEngine {
/**
- * Adds a stylesheet from a given URL.
- * The kind of stylesheet (CSS vs CSSX) is determined according to the
- * file's extension (Standard parser for CSS, extended parser for CSSX)
+ * Adds a stylesheet from a given StyleSheet model.
*
* @param inputURL
*/
- public void addStyleSheet(URL inputURL);
+ public void addStyleSheet(StyleSheet styleSheet);
/**
* Adds a stylesheet from a given URL.
- * If extended is true, the CSSX parser will be used. Otherwise,
- * the standard CSS parser is used.
*
* @param inputURL
- * @param extended
*/
- public void addStyleSheet(URL inputURL, boolean extended);
+ public void addStyleSheet(URL inputURL);
/**
* Resets the CSS cache
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java index 4c6995482bb..183342b3138 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java @@ -12,6 +12,8 @@ package org.eclipse.papyrus.infra.gmfdiag.css.engine;
import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;
@@ -28,7 +30,6 @@ import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter; import org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine;
import org.eclipse.e4.ui.css.core.impl.sac.CSSConditionFactoryImpl;
import org.eclipse.e4.ui.css.core.impl.sac.CSSSelectorFactoryImpl;
-import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.BooleanConverter;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.ColorToGMFConverter;
import org.eclipse.papyrus.infra.gmfdiag.css.converters.IntegerConverter;
@@ -36,11 +37,15 @@ import org.eclipse.papyrus.infra.gmfdiag.css.converters.StringConverter; import org.eclipse.papyrus.infra.gmfdiag.css.engine.enginecopy.ExtendedViewCSSImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.listener.StyleSheetChangeListener;
import org.eclipse.papyrus.infra.gmfdiag.css.lists.ExtendedStyleSheetList;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheetReference;
import org.w3c.css.sac.ConditionFactory;
import org.w3c.dom.Element;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.CSSValue;
import org.w3c.dom.css.ViewCSS;
+import org.w3c.dom.stylesheets.StyleSheetList;
/**
* Base implementation for a hierarchic, lazy CSS Engine.
@@ -66,7 +71,12 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements /**
* Owned stylesheets
*/
- private final List<URL> styleSheets = new LinkedList<URL>();
+ private final List<StyleSheet> styleSheets = new LinkedList<StyleSheet>();
+
+ /**
+ * Owned stylesheets, by URL
+ */
+ private final List<URL> styleSheetURLs = new LinkedList<URL>();
public ExtendedCSSEngineImpl() {
this(null);
@@ -93,6 +103,8 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements this.registerCSSValueConverter(new IntegerConverter());
this.registerCSSValueConverter(new StringConverter());
this.registerCSSValueConverter(new BooleanConverter());
+
+ setErrorHandler(new GMFErrorHandler());
}
/**
@@ -137,11 +149,13 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements return declarationsCache.get(element);
}
- /**
- * {@inheritDoc}
- */
- public void addStyleSheet(URL styleSheetURL) {
- styleSheets.add(styleSheetURL);
+ public void addStyleSheet(StyleSheet styleSheet) {
+ styleSheets.add(styleSheet);
+ reset();
+ }
+
+ public void addStyleSheet(URL styleSheet) {
+ styleSheetURLs.add(styleSheet);
reset();
}
@@ -174,15 +188,47 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements }
private void parseStyleSheets() {
- for(URL styleSheetURL : styleSheets) {
+ for(URL styleSheet : styleSheetURLs) {
+ try {
+ parseStyleSheet(styleSheet.openStream());
+ } catch (IOException ex) {
+ handleExceptions(ex);
+ }
+ }
+ for(StyleSheet styleSheet : styleSheets) {
try {
- parseStyleSheet(styleSheetURL.openStream());
+ if(styleSheet instanceof EmbeddedStyleSheet) {
+ parseStyleSheet((EmbeddedStyleSheet)styleSheet);
+ } else if(styleSheet instanceof StyleSheetReference) {
+ parseStyleSheet((StyleSheetReference)styleSheet);
+ }
} catch (IOException ex) {
- Activator.log.error("Cannot parse styleSheet at URL : " + styleSheetURL, ex);
+ handleExceptions(ex);
}
}
}
+ /**
+ * @see #addStyleSheet(StyleSheet)
+ */
+ private void parseStyleSheet(EmbeddedStyleSheet styleSheet) throws IOException {
+ Reader reader = new StringReader(styleSheet.getContent());
+ parseStyleSheet(reader);
+ }
+
+ /**
+ * @see #addStyleSheet(StyleSheet)
+ */
+ protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
+ String path = styleSheet.getPath();
+ if(path.startsWith("/")) {
+ path = "platform:/resource" + path;
+ }
+
+ URL url = new URL(path);
+ parseStyleSheet(url.openStream());
+ }
+
@Override
public CSSParser makeCSSParser() {
//TODO : Extended parser (CSSX)
@@ -231,10 +277,11 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements public ExtendedStyleSheetList getAllStylesheets() {
if(styleSheetsList == null) {
parseStyleSheets();
- styleSheetsList = new ExtendedStyleSheetList(getDocumentCSS().getStyleSheets());
+ styleSheetsList = new ExtendedStyleSheetList();
if(parent != null) {
- styleSheetsList.addAll(parent.getAllStylesheets());
+ styleSheetsList.addAll((StyleSheetList)parent.getAllStylesheets());
}
+ styleSheetsList.addAll(getDocumentCSS().getStyleSheets());
}
return styleSheetsList;
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java index 5a35c9c3d4f..a8e5c5dbb56 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java @@ -11,7 +11,18 @@ *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.engine;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.e4.ui.css.core.dom.IElementProvider;
+import org.eclipse.e4.ui.css.core.engine.CSSElementContext;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.ModelStyleSheets;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheetReference;
+import org.w3c.dom.Element;
@SuppressWarnings("restriction")
public class ModelCSSEngine extends ExtendedCSSEngineImpl {
@@ -21,5 +32,49 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl { public ModelCSSEngine(Resource model) {
super(WorkspaceCSSEngine.instance);
this.model = model;
+ for(EObject eObject : model.getContents()) {
+ if(eObject instanceof ModelStyleSheets) {
+ ModelStyleSheets styleSheets = (ModelStyleSheets)eObject;
+ for(StyleSheet styleSheet : styleSheets.getStylesheets()) {
+ addStyleSheet(styleSheet);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
+ String path = styleSheet.getPath();
+ if(path.startsWith("/")) {
+ path = "platform:/plugin" + path;
+ } else {
+ URI uri = URI.createURI(styleSheet.getPath());
+ uri = uri.resolve(model.getURI());
+ path = uri.toString();
+ }
+ URL url = new URL(path);
+ parseStyleSheet(url.openStream());
+ }
+
+ //Unsupported operations. The ModelCSSEngine should not be used directly.
+
+ @Override
+ public Element getElement(Object node) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IElementProvider getElementProvider() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setElementProvider(IElementProvider elementProvider) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public CSSElementContext getCSSElementContext(Object node) {
+ throw new UnsupportedOperationException();
}
}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java index 4d565bbee8c..14c628ad355 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java @@ -32,6 +32,8 @@ public class WorkspaceCSSEngine extends ExtendedCSSEngineImpl { private WorkspaceCSSEngine() {
super(BaseCSSEngine.instance);
try {
+ //TODO: Use an extension point to register themes
+ //TODO: Use a Preference page to select a theme
addStyleSheet(new URL("platform:/plugin/" + Activator.PLUGIN_ID + "/resources/papyrus_theme.css"));
} catch (MalformedURLException ex) {
Activator.log.error(ex);
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java index 0aa6acf6f59..367100010cb 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java @@ -46,7 +46,8 @@ public class ExtendedViewCSSImpl implements ViewCSS { /**
* {@inheritDoc}
*
- * Implementation based on {@link ViewCSSImpl#getComputedStyle(Element, String)} The base implementations returns the first CSSStyleDeclaration.
+ * Implementation based on {@link ViewCSSImpl#getComputedStyle(Element, String)}.
+ * The base implementations returns the first CSSStyleDeclaration.
*
* When a StyleDeclaration is found in a StyleSheet, it is added to a list of declarations.
* Then, these declarations are merged
@@ -59,7 +60,7 @@ public class ExtendedViewCSSImpl implements ViewCSS { //Stylesheets
for(StyleSheet styleSheet : styleSheetList) {
- List<StyleWrapper> styleWrappers = getStyleWrappers((CSSStyleSheet)styleSheet, elt, pseudo);
+ List<StyleWrapper> styleWrappers = getStyleWrappers((CSSStyleSheet)styleSheet, elt, pseudo, declarations.size());
declarations.addAll(styleWrappers);
}
@@ -92,11 +93,10 @@ public class ExtendedViewCSSImpl implements ViewCSS { *
* Returns the StyleWrappers instead of a StyleDeclaration
*/
- private List<StyleWrapper> getStyleWrappers(CSSStyleSheet styleSheet, Element elt, String pseudoElt) {
+ private List<StyleWrapper> getStyleWrappers(CSSStyleSheet styleSheet, Element elt, String pseudoElt, int position) {
List<StyleWrapper> styleDeclarations = new ArrayList<StyleWrapper>();
CSSRuleList ruleList = styleSheet.getCssRules();
int length = ruleList.getLength();
- int position = 0;
for(int i = 0; i < length; i++) {
CSSRule rule = ruleList.item(i);
switch(rule.getType()) {
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java index 2e71ddfcc91..0f8abdc840d 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/SemanticElementHelper.java @@ -24,21 +24,28 @@ public class SemanticElementHelper { * The result element can also be a Diagram
*/
public static EObject findSemanticElement(EObject notationElement) {
+ if (notationElement == null){
+ return null;
+ }
if(notationElement instanceof Diagram) {
return notationElement;
}
+ if(notationElement instanceof View) {
+ View view = (View)notationElement;
+ EObject semanticElement = view.getElement();
+ if(semanticElement != null) {
+ return semanticElement;
+ }
+ //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
+ //e.g. : Links in UML
+ return view;
+ }
- EObject currentElement = notationElement;
+ EObject currentElement = notationElement.eContainer();
do {
if(currentElement instanceof View) {
- View view = (View)currentElement;
- if(view.getElement() != null) {
- return view.getElement();
- }
- //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
- //e.g. : Links in UML
- return view;
+ return findSemanticElement(currentElement);
}
currentElement = currentElement.eContainer();
} while(currentElement != null);
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java index 390d9a3efd9..ae28bf25a59 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java @@ -27,9 +27,7 @@ public class ExtendedStyleSheetList extends LinkedList<StyleSheet> implements St }
public ExtendedStyleSheetList(StyleSheetList listToCopy) {
- for(int i = 0; i < listToCopy.getLength(); i++) {
- add(listToCopy.item(i));
- }
+ addAll(listToCopy);
}
public ExtendedStyleSheetList(Collection<? extends StyleSheet> listToCopy) {
@@ -44,4 +42,10 @@ public class ExtendedStyleSheetList extends LinkedList<StyleSheet> implements St return get(index);
}
+ public void addAll(StyleSheetList styleSheets) {
+ for(int i = 0; i < styleSheets.getLength(); i++) {
+ add(styleSheets.item(i));
+ }
+ }
+
}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java index 352e6d30ad9..05141e43bea 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java @@ -31,7 +31,7 @@ public interface CSSAnnotations { /**
* The Diagram Stylesheets key
*/
- public static final Object CSS_DIAGRAM_STYLESHEETS_KEY = "styleSheets"; //$NON-NLS-1$
+ public static final String CSS_DIAGRAM_STYLESHEETS_KEY = "css_stylesheets"; //$NON-NLS-1$
/**
* The name of the EAnnotation containing css informations
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSBooleanListValueStyle.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java index 333f2109049..d04ca9d457c 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSBooleanListValueStyle.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java @@ -1,20 +1,24 @@ -/***************************************************************************** - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.gmfdiag.css.style; - -import org.eclipse.emf.common.util.EList; - -public interface CSSBooleanListValueStyle extends CSSNamedStyle{ - - public EList getCSSBooleanListValue(); - -} +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.notation;
+
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet;
+
+
+
+public interface CSSDiagram extends Diagram {
+
+ public List<StyleSheet> getStyleSheets();
+}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java index fd9cc1f3c5c..67c43b0391d 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java @@ -11,12 +11,18 @@ *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.css.notation; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.gmf.runtime.notation.EObjectListValueStyle; +import org.eclipse.gmf.runtime.notation.NamedStyle; import org.eclipse.gmf.runtime.notation.impl.DiagramImpl; import org.eclipse.papyrus.infra.gmfdiag.css.engine.DiagramCSSEngine; import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; +import org.eclipse.papyrus.infra.gmfdiag.css.modelstylesheets.StyleSheet; import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResource; -public class CSSDiagramImpl extends DiagramImpl { +public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram { protected ExtendedCSSEngine engine; @@ -34,4 +40,30 @@ public class CSSDiagramImpl extends DiagramImpl { return null; } + public List<StyleSheet> getStyleSheets() { + List<StyleSheet> result = new LinkedList<StyleSheet>(); + + for(Object styleObject : getStyles()) { + if(styleObject instanceof NamedStyle) { + + NamedStyle style = (NamedStyle)styleObject; + + if(CSSAnnotations.CSS_DIAGRAM_STYLESHEETS_KEY.equals(style.getName())) { + if(style instanceof EObjectListValueStyle) { + + EObjectListValueStyle stylesheetsStyle = (EObjectListValueStyle)style; + + for(Object eObjectValue : stylesheetsStyle.getEObjectListValue()) { + if(eObjectValue instanceof StyleSheet) { + result.add((StyleSheet)eObjectValue); + } + } + } + } + } + } + + return result; + } + } diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java index 5366062ac87..588602a1498 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java @@ -17,6 +17,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResource;
/**
* This helper handles the EAnnotation used to distinguish between an EMF
@@ -69,8 +70,8 @@ public class ForceValueHelper { }
private static boolean isCSSView(View view) {
- return false;
- // return view != null && view.eResource() instanceof CSSNotationResource;
+ // return false;
+ return view != null && view.eResource() instanceof CSSNotationResource;
}
private static boolean equals(Object value1, Object value2) {
@@ -86,6 +87,10 @@ public class ForceValueHelper { return;
}
+ if(feature == null) {
+ return;
+ }
+
//Remove the annotation which forces the value, if needed
String annotationKey = feature.getName();
@@ -104,13 +109,12 @@ public class ForceValueHelper { }
public static boolean isSet(View annotationContext, EObject style, EStructuralFeature feature, Object value) {
- boolean defaultIsSet = style.eIsSet(feature);
if(!isCSSView(annotationContext)) {
//Do not contaminate non-Papyrus models
return true;
}
- if(!defaultIsSet) {
+ if(!style.eIsSet(feature)) {
return false;
}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java index 3c4bd5aa3cb..5369cd89c64 100644 --- a/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java +++ b/incoming/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java @@ -23,10 +23,12 @@ public class CSSNotationResource extends GMFResource { public CSSNotationResource(URI uri) {
super(uri);
- engine = new ModelCSSEngine(this);
}
public ExtendedCSSEngine getEngine() {
+ if(engine == null) {
+ engine = new ModelCSSEngine(this);
+ }
return engine;
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java index a94c345801a..dc2f6e4c1b2 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.core.databinding.observable.list.ObservableList;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.command.StrictCompoundCommand;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.command.AddCommand;
@@ -98,7 +97,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener return;
}
- CompoundCommand compoundCommand = new StrictCompoundCommand() {
+ CompoundCommand compoundCommand = new CompoundCommand() {
@Override
public void execute() {
@@ -117,6 +116,19 @@ public class EMFObservableList extends ObservableList implements ICommitListener super.redo();
refreshCacheList();
}
+
+ @Override
+ protected boolean prepare() {
+ if(commandList.isEmpty()) {
+ return false;
+ } else {
+ //We only test the first command, as the following ones might depend
+ //on the first command's execution. StrictCompoundCommands don't seem
+ //to be compatible with emf transaction (execute() is called by
+ //canExecute(), before the transaction is started)
+ return commandList.get(0).canExecute();
+ }
+ }
};
for(Command cmd : commands) {
@@ -131,6 +143,14 @@ public class EMFObservableList extends ObservableList implements ICommitListener * Refresh the cached list by copying the real list
*/
protected void refreshCacheList() {
+ if(isDisposed()) {
+ //This observable can be disposed, but the commands might still be
+ //in the command stack. Undo() or Redo() will call this method, which
+ //should be ignored. The command should probably not call refresh directly ;
+ //we should have listeners on the concrete list... but it is not necessarily
+ //observable
+ return;
+ }
wrappedList.clear();
wrappedList.addAll(concreteList);
fireListChange(null);
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java index 0bfe953ee4b..30f8d76208b 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java @@ -12,6 +12,7 @@ package org.eclipse.papyrus.infra.emf.databinding;
import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.databinding.EObjectObservableValue;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -70,7 +71,7 @@ public class EMFObservableValue extends EObjectObservableValue { value = eObject;
}
- SetCommand command = getSetCommand(value);
+ Command command = getSetCommand(value);
domain.getCommandStack().execute(command);
}
@@ -82,7 +83,7 @@ public class EMFObservableValue extends EObjectObservableValue { * @return
* The Set command used to edit the value
*/
- protected SetCommand getSetCommand(Object value) {
+ protected Command getSetCommand(Object value) {
return new SetCommand(domain, eObject, eStructuralFeature, value);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java index f771f3ffb4d..02048f7eb7d 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java @@ -12,6 +12,7 @@ package org.eclipse.papyrus.infra.gmfdiag.common.helper;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
/**
@@ -38,6 +39,10 @@ public class NotationHelper { if(adapter != null) {
return (View)adapter;
}
+ adapter = adaptable.getAdapter(EObject.class);
+ if(adapter instanceof View) {
+ return (View)adapter;
+ }
}
return null;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF index 4632849b758..69252d4cbc2 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/META-INF/MANIFEST.MF @@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.emf;bundle-version="0.9.0",
org.eclipse.papyrus.uml.tools;bundle-version="0.9.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.constraints;bundle-version="0.9.0"
+ org.eclipse.papyrus.infra.constraints;bundle-version="0.9.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.9.0"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.9.0.qualifier
@@ -26,3 +27,5 @@ Bundle-ManifestVersion: 2 Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.properties.Activator
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.properties;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom,
+ org.eclipse.papyrus.infra.gmfdiag.properties.modelelement
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi index 491515a84cd..89a03a34c7c 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi @@ -1,12 +1,21 @@ <?xml version="1.0" encoding="ASCII"?>
-<environment:Environment xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
- <modelElementFactories name="GMF Notation"
- factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.NotationModelElementFactory" />
- <constraintTypes label="GMF Notation Constraint"
- constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.GMFNotationConstraint" />
- <constraintTypes label="HasEditPolicy"
- constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.HasEditPolicy" />
- <constraintTypes label="isGMFEditPart"
- constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsEditPartConstraint" />
+<environment:Environment
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
+ <constraintTypes
+ label="GMF Notation Constraint"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.GMFNotationConstraint"/>
+ <constraintTypes
+ label="HasEditPolicy"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.HasEditPolicy"/>
+ <constraintTypes
+ label="isGMFEditPart"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsEditPartConstraint"/>
+ <modelElementFactories
+ name="GMF Notation"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.NotationModelElementFactory"/>
+ <modelElementFactories
+ name="GMF Custom Style"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.CustomStyleModelElementFactory"/>
</environment:Environment>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AbstractCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AbstractCustomStyleListValueCommand.java new file mode 100644 index 00000000000..4ca1b9037fb --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AbstractCustomStyleListValueCommand.java @@ -0,0 +1,84 @@ +package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public abstract class AbstractCustomStyleListValueCommand extends AbstractCommand {
+
+ protected View view;
+
+ protected EClass styleClass;
+
+ protected String styleName;
+
+ protected boolean needsCreate;
+
+ protected EStructuralFeature styleFeature;
+
+ protected EditingDomain domain;
+
+ protected Command command;
+
+ protected NamedStyle style;
+
+ public AbstractCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature) {
+ this.view = view;
+ this.styleName = styleName;
+ this.styleClass = styleClass;
+ this.styleFeature = styleFeature;
+ this.domain = domain;
+ }
+
+ public void execute() {
+ //FIXME: Related to CompoundCommand vs StrictCompoundCommand.
+ //Sometimes, canExecute() is not called, and the command is not prepared
+ if(!isPrepared) {
+ prepare();
+ isPrepared = true;
+ }
+
+ if(needsCreate) {
+ view.getStyles().add(style);
+ }
+ command.execute();
+ }
+
+ public void redo() {
+ execute();
+ }
+
+ @Override
+ public boolean prepare() {
+ style = view.getNamedStyle(styleClass, styleName);
+
+ if(needsCreate = (style == null)) {
+ style = (NamedStyle)NotationFactory.eINSTANCE.create(styleClass);
+ style.setName(styleName);
+ }
+
+ command = createCommand();
+
+ // return true;
+ return command.canExecute();
+ }
+
+ protected abstract Command createCommand();
+
+ @Override
+ public void undo() {
+ EList currentList = (EList)(style.eGet(styleFeature));
+ command.undo();
+ if(needsCreate) {
+ view.getStyles().remove(style);
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AbstractCustomStyleObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AbstractCustomStyleObservableValue.java new file mode 100644 index 00000000000..42838376495 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AbstractCustomStyleObservableValue.java @@ -0,0 +1,114 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.tools.databinding.CommandBasedObservableValue;
+
+/**
+ * Abstract implementation for an ObservableValue associated to a GMF custom
+ * style (NamedStyle).
+ *
+ * @author Camille Letavernier
+ *
+ */
+public abstract class AbstractCustomStyleObservableValue extends AbstractObservableValue implements CommandBasedObservableValue, IChangeListener {
+
+ protected View source;
+
+ protected EditingDomain domain;
+
+ protected String styleName;
+
+ protected Object lastValue;
+
+ protected CustomStyleListener listener;
+
+ protected EClass styleClass;
+
+ protected EStructuralFeature styleFeature;
+
+ public AbstractCustomStyleObservableValue(View source, EditingDomain domain, String styleName, EClass styleClass, EStructuralFeature styleFeature) {
+ this.source = source;
+ this.domain = domain;
+ this.styleName = styleName;
+ this.styleClass = styleClass;
+ this.styleFeature = styleFeature;
+ source.eAdapters().add(listener = new CustomStyleListener(source, styleFeature, this, styleName));
+ }
+
+ public void handleChange(ChangeEvent event) {
+
+ final Object oldValue = lastValue;
+ final Object newValue = doGetValue();
+
+ fireValueChange(new ValueDiff() {
+
+ @Override
+ public Object getOldValue() {
+ return oldValue;
+ }
+
+ @Override
+ public Object getNewValue() {
+ return newValue;
+ }
+
+ });
+ }
+
+ @Override
+ protected Object doGetValue() {
+ NamedStyle valueStyle = source.getNamedStyle(styleClass, styleName);
+ if(valueStyle != null) {
+ lastValue = valueStyle.eGet(styleFeature);
+ } else {
+ lastValue = getDefaultValue();
+ }
+ return lastValue;
+ }
+
+ /**
+ * Gets the default value when this style is not set.
+ *
+ * @return The default value for this NamedStyle
+ */
+ protected abstract Object getDefaultValue();
+
+ @Override
+ protected void doSetValue(Object value) {
+ Command command = getCommand(value);
+ domain.getCommandStack().execute(command);
+ doGetValue(); //Refresh the lastValue
+ }
+
+ public Command getCommand(Object value) {
+ return new CustomStyleValueCommand(source, value, styleClass, styleFeature, styleName);
+ }
+
+ @Override
+ public void dispose() {
+ source.eAdapters().remove(listener);
+ listener.dispose();
+ listener = null;
+ super.dispose();
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AddAllCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AddAllCustomStyleListValueCommand.java new file mode 100644 index 00000000000..cb4bfdefb9b --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AddAllCustomStyleListValueCommand.java @@ -0,0 +1,47 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class AddAllCustomStyleListValueCommand extends AbstractCustomStyleListValueCommand {
+
+ protected int index = CommandParameter.NO_INDEX;
+
+ protected Collection<?> values;
+
+ protected Command command;
+
+ public AddAllCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature, Collection<?> values, int index) {
+ super(domain, view, styleName, styleClass, styleFeature);
+ this.index = index;
+ this.values = values;
+ }
+
+ public AddAllCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature feature, Collection<?> values) {
+ this(domain, view, styleName, styleClass, feature, values, CommandParameter.NO_INDEX);
+ }
+
+ @Override
+ protected Command createCommand() {
+ return AddCommand.create(domain, style, styleFeature, values, index);
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AddCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AddCustomStyleListValueCommand.java new file mode 100644 index 00000000000..9ea23b3bb0c --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/AddCustomStyleListValueCommand.java @@ -0,0 +1,44 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class AddCustomStyleListValueCommand extends AbstractCustomStyleListValueCommand {
+
+ protected int index = CommandParameter.NO_INDEX;
+
+ protected Object value;
+
+ public AddCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature, Object value, int index) {
+ super(domain, view, styleName, styleClass, styleFeature);
+ this.index = index;
+ this.value = value;
+ }
+
+ public AddCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass styleClass, EStructuralFeature styleFeature, Object value) {
+ this(domain, view, styleName, styleClass, styleFeature, value, CommandParameter.NO_INDEX);
+ }
+
+ @Override
+ protected Command createCommand() {
+ return AddCommand.create(domain, style, styleFeature, value, index);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomBooleanStyleObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomBooleanStyleObservableList.java new file mode 100644 index 00000000000..40d8555196f --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomBooleanStyleObservableList.java @@ -0,0 +1,24 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class CustomBooleanStyleObservableList extends CustomStyleObservableList {
+
+ public CustomBooleanStyleObservableList(View view, EditingDomain domain, String styleName) {
+ super(view, styleName, domain, NotationPackage.eINSTANCE.getBooleanListValueStyle(), NotationPackage.eINSTANCE.getBooleanListValueStyle_BooleanListValue());
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomBooleanStyleObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomBooleanStyleObservableValue.java new file mode 100644 index 00000000000..007625bfea6 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomBooleanStyleObservableValue.java @@ -0,0 +1,48 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class CustomBooleanStyleObservableValue extends AbstractCustomStyleObservableValue {
+
+ public CustomBooleanStyleObservableValue(View source, EditingDomain domain, String styleName) {
+ super(source, domain, styleName, NotationPackage.eINSTANCE.getBooleanValueStyle(), NotationPackage.eINSTANCE.getBooleanValueStyle_BooleanValue());
+ }
+
+ public Object getValueType() {
+ return Boolean.class;
+ }
+
+ /**
+ * Gets the default value when this style is not set.
+ * Subclasses may override
+ *
+ * @return The default value for this BooleanStyleValue
+ */
+ @Override
+ protected Boolean getDefaultValue() {
+ return false;
+ }
+
+ @Override
+ public Command getCommand(Object value) {
+ if(value instanceof Boolean) {
+ return super.getCommand(value);
+ }
+ throw new IllegalArgumentException("The value " + value + " is not a valid Boolean Value");
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomEObjectStyleObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomEObjectStyleObservableList.java new file mode 100644 index 00000000000..eb18e625667 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomEObjectStyleObservableList.java @@ -0,0 +1,25 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class CustomEObjectStyleObservableList extends CustomStyleObservableList {
+
+ //TODO: The super class is probably powerful enough to handle EObjects.
+ public CustomEObjectStyleObservableList(View view, EditingDomain domain, String styleName) {
+ super(view, styleName, domain, NotationPackage.eINSTANCE.getEObjectListValueStyle(), NotationPackage.eINSTANCE.getEObjectListValueStyle_EObjectListValue());
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomEObjectStyleObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomEObjectStyleObservableValue.java new file mode 100644 index 00000000000..15513e59f37 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomEObjectStyleObservableValue.java @@ -0,0 +1,49 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class CustomEObjectStyleObservableValue extends AbstractCustomStyleObservableValue {
+
+ public CustomEObjectStyleObservableValue(View source, EditingDomain domain, String styleName) {
+ super(source, domain, styleName, NotationPackage.eINSTANCE.getEObjectValueStyle(), NotationPackage.eINSTANCE.getEObjectValueStyle_EObjectValue());
+ }
+
+ public Object getValueType() {
+ return EObject.class;
+ }
+
+ /**
+ * Gets the default value when this style is not set.
+ * Subclasses may override
+ *
+ * @return The default value for this EObjectStyleValue
+ */
+ @Override
+ protected EObject getDefaultValue() {
+ return null;
+ }
+
+ @Override
+ public Command getCommand(Object value) {
+ if(value instanceof EObject) {
+ return super.getCommand(value);
+ }
+ throw new IllegalArgumentException("The value " + value + " is not a valid EObject Value");
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomIntStyleObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomIntStyleObservableList.java new file mode 100644 index 00000000000..5db23b5b195 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomIntStyleObservableList.java @@ -0,0 +1,24 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class CustomIntStyleObservableList extends CustomStyleObservableList {
+
+ public CustomIntStyleObservableList(View view, EditingDomain domain, String styleName) {
+ super(view, styleName, domain, NotationPackage.eINSTANCE.getIntListValueStyle(), NotationPackage.eINSTANCE.getIntListValueStyle_IntListValue());
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomIntStyleObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomIntStyleObservableValue.java new file mode 100644 index 00000000000..2443e8136b2 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomIntStyleObservableValue.java @@ -0,0 +1,48 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class CustomIntStyleObservableValue extends AbstractCustomStyleObservableValue {
+
+ public CustomIntStyleObservableValue(View source, EditingDomain domain, String styleName) {
+ super(source, domain, styleName, NotationPackage.eINSTANCE.getIntValueStyle(), NotationPackage.eINSTANCE.getIntValueStyle_IntValue());
+ }
+
+ public Object getValueType() {
+ return Integer.class;
+ }
+
+ /**
+ * Gets the default value when this style is not set.
+ * Subclasses may override
+ *
+ * @return The default value for this IntegerStyleValue
+ */
+ @Override
+ protected Integer getDefaultValue() {
+ return 0;
+ }
+
+ @Override
+ public Command getCommand(Object value) {
+ if(value instanceof Integer) {
+ return super.getCommand(value);
+ }
+ throw new IllegalArgumentException("The value " + value + " is not a valid Integer Value");
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStringStyleObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStringStyleObservableList.java new file mode 100644 index 00000000000..84dc817e020 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStringStyleObservableList.java @@ -0,0 +1,24 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class CustomStringStyleObservableList extends CustomStyleObservableList {
+
+ public CustomStringStyleObservableList(View view, EditingDomain domain, String styleName) {
+ super(view, styleName, domain, NotationPackage.eINSTANCE.getStringListValueStyle(), NotationPackage.eINSTANCE.getStringListValueStyle_StringListValue());
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStringStyleObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStringStyleObservableValue.java new file mode 100644 index 00000000000..f4d32f89dd2 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStringStyleObservableValue.java @@ -0,0 +1,48 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class CustomStringStyleObservableValue extends AbstractCustomStyleObservableValue {
+
+ public CustomStringStyleObservableValue(View source, EditingDomain domain, String styleName) {
+ super(source, domain, styleName, NotationPackage.eINSTANCE.getStringValueStyle(), NotationPackage.eINSTANCE.getStringValueStyle_StringValue());
+ }
+
+ public Object getValueType() {
+ return String.class;
+ }
+
+ /**
+ * Gets the default value when this style is not set.
+ * Subclasses may override
+ *
+ * @return The default value for this StringStyleValue
+ */
+ @Override
+ protected String getDefaultValue() {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public Command getCommand(Object value) {
+ if(value instanceof String) {
+ return super.getCommand(value);
+ }
+ throw new IllegalArgumentException("The value " + value + " is not a valid String Value");
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleListener.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleListener.java new file mode 100644 index 00000000000..6a0019a16b4 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleListener.java @@ -0,0 +1,134 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class CustomStyleListener implements Adapter {
+
+ private Notifier target;
+
+ private String styleName;
+
+ private IChangeListener listener;
+
+ private boolean disposed;
+
+ private View source;
+
+ private EStructuralFeature listenedFeature;
+
+ public CustomStyleListener(View source, EStructuralFeature listenedFeature, IChangeListener listener, String styleName) {
+ this.styleName = styleName;
+ this.listener = listener;
+ this.source = source;
+ this.listenedFeature = listenedFeature;
+ for(Object styleObject : source.getStyles()) {
+ if(styleObject instanceof NamedStyle) {
+ NamedStyle style = (NamedStyle)styleObject;
+ if(styleName.equals(style.getName())) {
+ //FIXME: If a style's name is change, we won't be notified. We should probably listen on all styles
+ style.eAdapters().add(this);
+ }
+ }
+ }
+ }
+
+ public void notifyChanged(Notification notification) {
+ if(disposed) {
+ ((Notifier)notification.getNotifier()).eAdapters().remove(this);
+ return;
+ }
+
+ if(notification.getFeature() == NotationPackage.eINSTANCE.getView_Styles()) {
+ switch(notification.getEventType()) {
+ case Notification.ADD:
+ handleAdd((EObject)notification.getNewValue());
+ break;
+ case Notification.ADD_MANY:
+ for(Object object : (List<?>)notification.getNewValue()) {
+ handleAdd((EObject)object);
+ }
+ break;
+ case Notification.REMOVE:
+ handleRemove((EObject)notification.getOldValue());
+ break;
+ case Notification.REMOVE_MANY:
+ for(Object object : (List<?>)notification.getOldValue()) {
+ handleRemove((EObject)object);
+ }
+ break;
+ }
+ }
+
+ if(notification.getFeature() == listenedFeature) {
+ if(notification.getNotifier() instanceof NamedStyle && styleName.equals(((NamedStyle)notification.getNotifier()).getName())) {
+ if(!notification.isTouch()) {
+ listener.handleChange(null);
+ }
+ }
+ }
+ }
+
+ private void handleRemove(EObject oldValue) {
+ oldValue.eAdapters().remove(this);
+ handleChange(oldValue);
+ }
+
+ private void handleAdd(EObject newValue) {
+ newValue.eAdapters().add(this);
+ handleChange(newValue);
+ }
+
+ private void handleChange(EObject value) {
+ if(value instanceof NamedStyle) {
+ if(styleName.equals(((NamedStyle)value).getName())) {
+ listener.handleChange(null);
+ return;
+ }
+ }
+ }
+
+ public Notifier getTarget() {
+ return target;
+ }
+
+ public void setTarget(Notifier newTarget) {
+ if(disposed) {
+ return;
+ }
+ this.target = newTarget;
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ public void dispose() {
+ this.disposed = true;
+ listener = null;
+ target = null;
+ source = null;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleObservableList.java new file mode 100644 index 00000000000..3b044c8923c --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleObservableList.java @@ -0,0 +1,148 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.databinding.EMFObservableList;
+import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
+
+
+public class CustomStyleObservableList extends EMFObservableList implements IChangeListener {
+
+ protected EClass eClass;
+
+ protected EStructuralFeature feature;
+
+ protected String styleName;
+
+ protected View view;
+
+ protected EditingDomain domain;
+
+ protected CustomStyleListener listener;
+
+ protected boolean styleExists;
+
+ protected boolean changing = false;
+
+ //Equals to concreteList
+ protected IObservableList observableConcreteList;
+
+ // protected final List<?> transientList;
+
+ public CustomStyleObservableList(View view, String styleName, EditingDomain domain, EClass eClass, EStructuralFeature feature) {
+ super(getWrappedList(view, styleName, eClass, feature), domain, null, null);
+ this.eClass = eClass;
+ this.feature = feature;
+ this.styleName = styleName;
+ this.view = view;
+ this.domain = domain;
+ observableConcreteList = (IObservableList)concreteList;
+ styleExists = isStyleCreated();
+
+ view.eAdapters().add(listener = new CustomStyleListener(view, feature, this, styleName));
+ }
+
+ @Override
+ public void commit(AbstractEditor editor) {
+ changing = true;
+ super.commit(editor);
+ changing = false;
+ }
+
+ private boolean isStyleCreated() {
+ return view.getNamedStyle(eClass, styleName) != null;
+ }
+
+ private static IObservableList getWrappedList(View view, String styleName, EClass eClass, EStructuralFeature feature) {
+ NamedStyle style = view.getNamedStyle(eClass, styleName);
+
+ if(style != null) {
+ return EMFProperties.list(feature).observe(style);
+ }
+
+ //The style doesn't exist yet, we need to simulate it
+ //(With an empty list)
+ return new WritableList();
+ }
+
+ @Override
+ public Command getAddCommand(int index, Object value) {
+ return new AddCustomStyleListValueCommand(domain, view, styleName, eClass, feature, value, index);
+ }
+
+ @Override
+ public Command getAddCommand(Object value) {
+ return new AddCustomStyleListValueCommand(domain, view, styleName, eClass, feature, value);
+ }
+
+ @Override
+ public Command getAddAllCommand(Collection<?> values) {
+ return new AddAllCustomStyleListValueCommand(domain, view, styleName, eClass, feature, values);
+ }
+
+ @Override
+ public Command getAddAllCommand(int index, Collection<?> values) {
+ return new AddCustomStyleListValueCommand(domain, view, styleName, eClass, feature, values, index);
+ }
+
+ @Override
+ public Command getRemoveCommand(Object value) {
+ return new RemoveCustomStyleListValueCommand(domain, view, styleName, eClass, feature, value);
+ }
+
+ @Override
+ public Command getRemoveAllCommand(Collection<?> values) {
+ return new RemoveAllCustomStyleListValueCommand(domain, view, styleName, eClass, feature, values);
+ }
+
+ @Override
+ public Command getSetCommand(int index, Object value) {
+ return new SetCustomStyleListValueCommand(domain, view, styleName, eClass, feature, index, value);
+ }
+
+ public void handleChange(ChangeEvent event) {
+ //If the ListValueStyle has been created or removed, we need to resync
+ //the concrete list with it
+ if(styleExists != (styleExists = isStyleCreated())) {
+ observableConcreteList.dispose();
+ concreteList = observableConcreteList = getWrappedList(view, styleName, eClass, feature);
+ }
+
+ //If this observable is not the source of the change, the wrapped
+ //list should also be refreshed.
+ if(!changing) {
+ refreshCacheList();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ view.eAdapters().remove(listener);
+ listener.dispose();
+ listener = null;
+ observableConcreteList.dispose();
+ super.dispose();
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleValueCommand.java new file mode 100644 index 00000000000..ab1dce124e1 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/CustomStyleValueCommand.java @@ -0,0 +1,86 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class CustomStyleValueCommand extends AbstractCommand {
+
+ private boolean createStyle;
+
+ private Object value;
+
+ private Object oldValue;
+
+ private EClass styleClass;
+
+ private View view;
+
+ private String styleName;
+
+ private EStructuralFeature styleFeature;
+
+ public CustomStyleValueCommand(View view, Object value, EClass styleClass, EStructuralFeature styleFeature, String styleName) {
+ this.value = value;
+ this.styleClass = styleClass;
+ this.view = view;
+ this.styleName = styleName;
+ this.styleFeature = styleFeature;
+ }
+
+ public void execute() {
+ NamedStyle valueStyle = view.getNamedStyle(styleClass, styleName);
+ createStyle = valueStyle == null;
+ if(createStyle) {
+ valueStyle = createStyle();
+ System.out.println("Create a new " + styleClass.getName());
+ } else {
+ oldValue = valueStyle.eGet(styleFeature);
+ }
+
+ valueStyle.eSet(styleFeature, value);
+ if(createStyle) {
+ view.getStyles().add(valueStyle);
+ }
+ }
+
+ protected NamedStyle createStyle() {
+ NamedStyle result = (NamedStyle)NotationFactory.eINSTANCE.create(styleClass);
+ result.setName(styleName);
+ return result;
+ }
+
+ public void redo() {
+ execute();
+ }
+
+ @Override
+ public void undo() {
+ NamedStyle valueStyle = view.getNamedStyle(styleClass, styleName);;
+ if(createStyle) {
+ view.getStyles().remove(valueStyle);
+ System.out.println("Remove the new " + styleClass.getName());
+ } else {
+ valueStyle.eSet(styleFeature, oldValue);
+ }
+ }
+
+ @Override
+ public boolean prepare() {
+ return true;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/RemoveAllCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/RemoveAllCustomStyleListValueCommand.java new file mode 100644 index 00000000000..a1813377652 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/RemoveAllCustomStyleListValueCommand.java @@ -0,0 +1,39 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class RemoveAllCustomStyleListValueCommand extends AbstractCustomStyleListValueCommand {
+
+ protected Collection<?> values;
+
+ public RemoveAllCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass eClass, EStructuralFeature feature, Collection<?> values) {
+ super(domain, view, styleName, eClass, feature);
+ this.values = values;
+ }
+
+ @Override
+ protected Command createCommand() {
+ return RemoveCommand.create(domain, style, styleFeature, values);
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/RemoveCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/RemoveCustomStyleListValueCommand.java new file mode 100644 index 00000000000..22adf4ae199 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/RemoveCustomStyleListValueCommand.java @@ -0,0 +1,36 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class RemoveCustomStyleListValueCommand extends AbstractCustomStyleListValueCommand {
+
+ protected Object value;
+
+ public RemoveCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass eClass, EStructuralFeature feature, Object value) {
+ super(domain, view, styleName, eClass, feature);
+ this.value = value;
+ }
+
+ @Override
+ protected Command createCommand() {
+ return RemoveCommand.create(domain, style, styleFeature, value);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/SetCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/SetCustomStyleListValueCommand.java new file mode 100644 index 00000000000..6e9df507e7d --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/custom/SetCustomStyleListValueCommand.java @@ -0,0 +1,39 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public class SetCustomStyleListValueCommand extends AbstractCustomStyleListValueCommand {
+
+ private int index;
+
+ private Object value;
+
+ public SetCustomStyleListValueCommand(EditingDomain domain, View view, String styleName, EClass eClass, EStructuralFeature feature, int index, Object value) {
+ super(domain, view, styleName, eClass, feature);
+ this.index = index;
+ this.value = value;
+ }
+
+ @Override
+ protected Command createCommand() {
+ return SetCommand.create(domain, style, styleFeature, value, index);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java new file mode 100644 index 00000000000..6b2f340f712 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java @@ -0,0 +1,169 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomBooleanStyleObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomBooleanStyleObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomEObjectStyleObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomEObjectStyleObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomIntStyleObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomIntStyleObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomStringStyleObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.custom.CustomStringStyleObservableValue;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.creation.StringEditionFactory;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.contexts.Property;
+import org.eclipse.papyrus.views.properties.environment.Type;
+import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
+
+
+public class CustomStyleModelElement extends EMFModelElement {
+
+ private DataContextElement element;
+
+ //this.view == super.source
+ private View view;
+
+ public CustomStyleModelElement(View source, DataContextElement context) {
+ this(source, null, context);
+ }
+
+ public CustomStyleModelElement(View source, EditingDomain domain, DataContextElement element) {
+ super(source, domain);
+ this.element = element;
+ this.view = source;
+ }
+
+ protected Property findProperty(String propertyPath) {
+ for(Property property : element.getProperties()) {
+ if(propertyPath.equals(property.getName())) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IObservable doGetObservable(String propertyPath) {
+ Property property = findProperty(propertyPath);
+ if(property == null) {
+ return null;
+ }
+ if(property.getMultiplicity() == 1) {
+ switch(property.getType()) {
+ case BOOLEAN:
+ return new CustomBooleanStyleObservableValue(view, domain, propertyPath);
+ case INTEGER:
+ return new CustomIntStyleObservableValue(view, domain, propertyPath);
+ case REFERENCE:
+ return new CustomEObjectStyleObservableValue(view, domain, propertyPath);
+ case STRING:
+ return new CustomStringStyleObservableValue(view, domain, propertyPath);
+ default:
+ return null;
+ }
+ } else {
+ switch(property.getType()) {
+ case BOOLEAN:
+ return new CustomBooleanStyleObservableList(view, domain, propertyPath);
+ case INTEGER:
+ return new CustomIntStyleObservableList(view, domain, propertyPath);
+ case REFERENCE:
+ return new CustomEObjectStyleObservableList(view, domain, propertyPath);
+ case STRING:
+ return new CustomStringStyleObservableList(view, domain, propertyPath);
+ default:
+ return null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return findProperty(propertyPath) != null;
+ }
+
+
+ //TODO: Implement these methods for multivalued properties (XxxListStyle)
+
+ @Override
+ public IStaticContentProvider getContentProvider(String propertyPath) {
+ return super.getContentProvider(propertyPath);
+ }
+
+ @Override
+ public ILabelProvider getLabelProvider(String propertyPath) {
+ return super.getLabelProvider(propertyPath);
+ }
+
+ @Override
+ public boolean isOrdered(String propertyPath) {
+ return true;
+ }
+
+ @Override
+ public boolean isUnique(String propertyPath) {
+ return false;
+ }
+
+ @Override
+ public boolean isMandatory(String propertyPath) {
+ return false;
+ }
+
+ @Override
+ public boolean forceRefresh(String propertyPath) {
+ return false;
+ }
+
+ @Override
+ public ReferenceValueFactory getValueFactory(String propertyPath) {
+ Property property = findProperty(propertyPath);
+ if(property == null) {
+ return null;
+ }
+
+ switch(property.getType()) {
+ case STRING:
+ return new StringEditionFactory();
+ case INTEGER:
+ case BOOLEAN:
+ return null;
+ case REFERENCE:
+ return null;
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Object getDefaultValue(String propertyPath) {
+ return null;
+ }
+
+ @Override
+ public boolean getDirectCreation(String propertyPath) {
+ Property property = findProperty(propertyPath);
+ if(property == null) {
+ return false;
+ }
+
+ return property.getType() != Type.REFERENCE;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java new file mode 100644 index 00000000000..87769b7b6d4 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java @@ -0,0 +1,38 @@ +/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
+
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
+
+
+public class CustomStyleModelElementFactory implements ModelElementFactory {
+
+ public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
+ View view = NotationHelper.findView(sourceElement);
+
+ if(view != null) {
+ EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(view);
+ return new CustomStyleModelElement(view, domain, context);
+ }
+
+ Activator.log.warn("The selected element cannot be resolved to a GMF View");
+ return null;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java index 9d04e7fb594..5bcd44621e2 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java @@ -11,13 +11,12 @@ *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
@@ -31,29 +30,17 @@ public class NotationModelElementFactory implements ModelElementFactory { public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
- View view = null;
-
- if(sourceElement instanceof EditPart) {
- EditPart part = (EditPart)sourceElement;
- Object model = part.getModel();
-
- if(model instanceof View) {
- view = (View)model;
- }
- } else if(sourceElement instanceof GradientData) {
+ if(sourceElement instanceof GradientData) {
return new GradientDataModelElement((GradientData)sourceElement);
- } else {
- EObject eObject = EMFHelper.getEObject(sourceElement);
- if(eObject instanceof View) {
- view = (View)eObject;
- }
}
+ View view = NotationHelper.findView(sourceElement);
if(view != null) {
EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(view);
return new GMFModelElement(view, domain);
}
+ Activator.log.warn("The selected element cannot be resolved to a GMF View");
return null;
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ListHelper.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ListHelper.java index 196a7e346bf..ae55a0d1565 100644 --- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ListHelper.java +++ b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/ListHelper.java @@ -38,4 +38,22 @@ public class ListHelper { }
return result;
}
+
+ public static String deepToString(List<?> list) {
+ return deepToString(list, ", ");
+ }
+
+ public static String deepToString(List<?> list, String separator) {
+ boolean firstElement = true;
+ String result = "";
+ for(Object item : list) {
+ if(firstElement) {
+ firstElement = false;
+ } else {
+ result += separator;
+ }
+ result += item == null ? null : item.toString();
+ }
+ return result;
+ }
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java index bd82e1940a1..48b4f5a4f9a 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java @@ -83,10 +83,18 @@ public class StringEditionFactory implements ReferenceValueFactory { }
public boolean canCreateObject() {
- return false;
+ return true;
}
public Object createObject(Control widget) {
+ InputDialog dialog = new InputDialog(widget.getShell(), title, label, "", validator); //$NON-NLS-1$
+
+ int result = dialog.open();
+ if(result == Window.OK) {
+ String newValue = dialog.getText();
+ return newValue;
+ }
+
return null;
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java index f91c35bdb5e..c8d598a3c15 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java @@ -13,7 +13,12 @@ package org.eclipse.papyrus.infra.widgets.editors; import org.eclipse.core.databinding.UpdateListStrategy;
import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.infra.widgets.Activator;
import org.eclipse.swt.widgets.Composite;
/**
@@ -141,5 +146,14 @@ public abstract class AbstractListEditor extends AbstractEditor { }
binding = getBindingContext().bindList(widgetObservable, modelProperty, targetToModelStrategy, modelToTargetStrategy);
+ binding.getValidationStatus().addChangeListener(new IChangeListener() {
+
+ public void handleChange(ChangeEvent event) {
+ Status status = (Status)((IObservableValue)event.getObservable()).getValue();
+ if(status.getSeverity() != Status.OK) {
+ Activator.log.error("Binding error (" + status.getSeverity() + ") : " + status.getMessage(), status.getException());
+ }
+ }
+ });
}
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java index 016ca92ca9a..d2a8df94857 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java @@ -16,6 +16,8 @@ import org.eclipse.core.databinding.conversion.IConverter; import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.infra.widgets.Activator;
import org.eclipse.swt.widgets.Composite;
/**
@@ -153,7 +155,20 @@ public abstract class AbstractValueEditor extends AbstractEditor { return;
}
+ if(targetToModelStrategy == null) {
+ targetToModelStrategy = new UpdateValueStrategy();
+ }
+
binding = getBindingContext().bindValue(widgetObservable, modelProperty, targetToModelStrategy, modelToTargetStrategy);
+ binding.getValidationStatus().addChangeListener(new IChangeListener() {
+
+ public void handleChange(ChangeEvent event) {
+ Status status = (Status)((IObservableValue)event.getObservable()).getValue();
+ if(status.getSeverity() != Status.OK) {
+ Activator.log.error("Binding error (" + status.getSeverity() + ") : " + status.getMessage(), status.getException());
+ }
+ }
+ });
}
/**
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleStringEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleStringEditor.java index d5940e99da6..55cc84786ae 100644 --- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleStringEditor.java +++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleStringEditor.java @@ -36,7 +36,7 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style) {
super(parent, style, new StringSelector());
- setFactory(new StringEditionFactory());
+ init();
}
/**
@@ -55,6 +55,7 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style, boolean ordered, boolean unique) {
super(parent, style, new StringSelector(), ordered, unique, null);
+ init();
}
/**
@@ -75,6 +76,7 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style, boolean ordered, boolean unique, String label) {
super(parent, style, new StringSelector(), ordered, unique, label);
+ init();
}
/**
@@ -97,6 +99,7 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style, IElementSelector selector, boolean ordered, boolean unique, String label) {
super(parent, style, selector, ordered, unique, label);
+ init();
}
/**
@@ -113,6 +116,7 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style, IElementSelector selector) {
super(parent, style, selector);
+ init();
}
/**
@@ -131,6 +135,7 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style, IElementSelector selector, String label) {
super(parent, style, selector, label);
+ init();
}
/**
@@ -147,6 +152,11 @@ public class MultipleStringEditor extends MultipleValueEditor { */
public MultipleStringEditor(Composite parent, int style, String label) {
super(parent, style, new StringSelector(), label);
+ init();
+ }
+
+ private void init() {
+ setFactory(new StringEditionFactory());
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java index cc6adff3b7b..c5d0a8f1628 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java @@ -19,9 +19,7 @@ import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-import org.eclipse.papyrus.views.properties.contexts.Property;
import org.eclipse.papyrus.views.properties.creation.PropertyEditorFactory;
-import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
/**
* Provides a default implementation for ModelElement methods applied on the
@@ -77,17 +75,6 @@ public abstract class AbstractModelElement implements ModelElement { }
/**
- * Finds the property associated to the given propertyPath
- *
- * @param propertyPath
- * The name of the property to retrieve
- * @return the property associated to the given propertyPath
- */
- protected Property getProperty(String propertyPath) {
- return ConfigurationManager.instance.getProperty(propertyPath, dataSource.getView().getContext());
- }
-
- /**
* @see org.eclipse.papyrus.views.properties.modelelement.ModelElement#getValueFactory(java.lang.String)
*
* @param propertyPath
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java index d233e84b95d..81bfa96e9bf 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java @@ -187,8 +187,10 @@ public class EMFModelElement extends AbstractModelElement { public IStaticContentProvider getContentProvider(String propertyPath) {
FeaturePath featurePath = getFeaturePath(propertyPath);
EStructuralFeature feature = getFeature(featurePath);
-
- return new EMFContentProvider(getSource(featurePath), feature);
+ if(feature != null) {
+ return new EMFContentProvider(getSource(featurePath), feature);
+ }
+ return super.getContentProvider(propertyPath);
}
@Override
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java index 3f10a1f0b8b..b0c89cbc8a0 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java @@ -48,9 +48,9 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi */
protected DataSource input;
- private boolean readOnly = false;
+ protected boolean readOnly = false;
- private boolean isEditable = true;
+ protected boolean isEditable = true;
/**
* The SWT Widget (For list properties only)
@@ -377,7 +377,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi try {
observableList = (IObservableList)input.getObservable(propertyPath);
} catch (Exception ex) {
- Activator.log.error("Cannot find a valid IObservable for " + propertyPath, ex); //$NON-NLS-1$
+ Activator.log.error("Cannot find a valid IObservableList for " + propertyPath, ex); //$NON-NLS-1$
}
}
@@ -393,7 +393,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi try {
observableValue = (IObservableValue)input.getObservable(propertyPath);
} catch (Exception ex) {
- Activator.log.error("Cannot find a valid IObservable for " + propertyPath, ex); //$NON-NLS-1$
+ Activator.log.error("Cannot find a valid IObservableValue for " + propertyPath, ex); //$NON-NLS-1$
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MultiString.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MultiString.java index 1469b893014..5c9a9fe3332 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MultiString.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MultiString.java @@ -47,6 +47,7 @@ public class MultiString extends AbstractPropertyEditor { protected void doBinding() {
editor.setOrdered(input.isOrdered(propertyPath));
editor.setUnique(input.isUnique(propertyPath));
+ editor.setDirectCreation(input.getDirectCreation(propertyPath));
if(getInputObservableList() instanceof ICommitListener) {
editor.addCommitListener((ICommitListener)getInputObservableList());
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/ViewEditor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/ViewEditor.java index 25ec219ebbf..e4d5c3bd02f 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/ViewEditor.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/ViewEditor.java @@ -133,7 +133,7 @@ public class ViewEditor extends AbstractPropertyEditor { return;
}
- IObservable observable = input.getObservable(propertyPath);
+ IObservable observable = getInputObservable();
if(observable == null) {
return;
}
@@ -222,6 +222,12 @@ public class ViewEditor extends AbstractPropertyEditor { }
@Override
+ protected IObservable getInputObservable() {
+ //Override the generic behavior: ViewEditor doesn't rely on an AbstractEditor
+ return input.getObservable(propertyPath);
+ }
+
+ @Override
public void setReadOnly(boolean readOnly) {
super.setReadOnly(readOnly);
updateControls();
|