summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Pascual2014-04-29 12:24:08 (EDT)
committerGabriel Pascual2014-04-30 08:54:50 (EDT)
commita174352dd68d69367bcb468722a0bd0938802e2a (patch)
tree14fc0e595c8b9bdb1528dda11783bd4e8f994509
parente770c8764a6f9a9c60315a689d5fc583286616c1 (diff)
downloadorg.eclipse.papyrus-a174352dd68d69367bcb468722a0bd0938802e2a.zip
org.eclipse.papyrus-a174352dd68d69367bcb468722a0bd0938802e2a.tar.gz
org.eclipse.papyrus-a174352dd68d69367bcb468722a0bd0938802e2a.tar.bz2
430079: [CSS] Papyrus shall provide features to define local themerefs/changes/81/25481/3
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430079 Patch 3 : - Fix major issue - Fix comment's remarks Patch 2 : - Rebase to pass hudson verification Pathch 1 : - Use workspace relative path for selected css files during CSS theme edition - Fix "restore default" button action in CSS preference page - Harmonisation of all UI for theme icon selection - Add dialog to confirm theme deletion - Refactor to resolve some dependency problems - Creation of widget for XWT theme view - Add embedded style sheets in CSS Workspace engine working - Fix problems of label provider for CSS themes properties view - Add workspace themes preference page - Add definition of theme property view - Fix saving step of an edited theme from workspace - Fix loading of theme icon in label provider - Fix behavior of theme edition dialog fields - Add edition action on style sheets list - Add move up and move down actions in edition dialog - Add actions (add and delete) to dialog - Resolution staying conflicts after last merge - Add edition theme dialog from project explorer - Minor modification of Style sheet metamodel - Modify CSS engine and theme manager to look at workspace theme contributions - Add theme creation by selecting one or more CSS files - Add dialog to define theme from CSS file in workspace - Create one menu for two actions to manage local theme - Manage command ID in handler - Fix containment relationship in model - Add draft of theme creation from a CSS selection - Modification of style sheets model - Add popup menu on CSS file Change-Id: Ie46281e334252bfbed727c18a431677761db2a45 Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi27
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx194
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleTheme.xwt32
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml97
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/ThemePropertyEditorFactory.java58
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeCreationDialog.java559
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeEditionDialog.java1133
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/IDynamicFieldEditor.java41
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java279
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java135
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElement.java69
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElementFactory.java65
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/preferences/ThemePreferencesPage.java1134
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSThemeLabelProvider.java99
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.project5
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF7
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/plugin.xml9
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java168
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java302
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java59
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java95
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/Theme.java67
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java758
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/META-INF/MANIFEST.MF40
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.ecore48
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.genmodel46
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsFactory.java138
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsPackage.java950
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/Theme.java123
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/WorkspaceThemes.java42
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsFactoryImpl.java259
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsPackageImpl.java662
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/ThemeImpl.java327
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/WorkspaceThemesImpl.java152
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsAdapterFactory.java425
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsSwitch.java432
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BrowseFileEditor.java408
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi111
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java175
39 files changed, 7754 insertions, 1976 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi
index 4f5fe3c..d610db8 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi
@@ -1,19 +1,8 @@
-<?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"/>
- <modelElementFactories
- name="CSS Preferences"
- factoryClass="org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement.CSSPreferencesModelElementFactory"/>
- <widgetTypes
- label="CSS ResetStyle Button"
- widgetClass="ResetStyleWidget"
- namespace="//@namespaces.0"/>
- <namespaces
- name="css"
- value="org.eclipse.papyrus.infra.gmfdiag.css.properties.widgets"/>
-</environment:Environment>
+<?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"/>
+ <modelElementFactories name="CSS Preferences" factoryClass="org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement.CSSPreferencesModelElementFactory"/>
+ <modelElementFactories name="CSS Themes" factoryClass="org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement.CSSThemesModelElementFactory"/>
+ <widgetTypes label="CSS ResetStyle Button" widgetClass="ResetStyleWidget" namespace="//@namespaces.0"/>
+ <namespaces name="css" value="org.eclipse.papyrus.infra.gmfdiag.css.properties.widgets"/>
+</environment:Environment>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx
index 6b4fb35..f8cbcf7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/css.ctx
@@ -1,88 +1,106 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" name="CSS">
- <tabs label="Style" id="style" category="org.eclipse.papyrus" image="" priority="70">
- <sections name="SingleStylableElement" sectionFile="ui/SingleStylableElement.xwt">
- <widget href="ui/SingleStylableElement.xwt#/"/>
- </sections>
- <sections name="MultipleStylableElement" sectionFile="ui/MultipleStylableElement.xwt">
- <widget href="ui/MultipleStylableElement.xwt#/"/>
- </sections>
- <sections name="SingleDiagram" sectionFile="ui/SingleDiagram.xwt">
- <widget href="ui/SingleDiagram.xwt#/"/>
- </sections>
- <sections name="SingleStyleSheetReference" sectionFile="ui/SingleStyleSheetReference.xwt">
- <widget href="ui/SingleStyleSheetReference.xwt#//@widgets.0"/>
- </sections>
- <sections name="SingleEmbeddedStyleSheet" sectionFile="ui/SingleEmbeddedStyleSheet.xwt">
- <widget href="ui/SingleEmbeddedStyleSheet.xwt#//@widgets.0"/>
- </sections>
- </tabs>
- <views name="SingleStylableElement" sections="//@tabs.0/@sections.0">
- <constraints xsi:type="constraints:SimpleConstraint" name="isSingleStylableElement" overrideable="false" overriddenConstraints="//@views.1/@constraints.0">
- <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
- <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
- <properties xsi:type="constraints:ValueProperty" name="className" value="View"/>
- </constraints>
- </views>
- <views elementMultiplicity="-1" name="MultipleStylableElement" sections="//@tabs.0/@sections.1">
- <constraints xsi:type="constraints:SimpleConstraint" name="isMultipleStylableElement" overrideable="false">
- <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
- <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
- <properties xsi:type="constraints:ValueProperty" name="className" value="View"/>
- </constraints>
- </views>
- <views name="Diagram" sections="//@tabs.0/@sections.2">
- <constraints xsi:type="constraints:SimpleConstraint" name="isDiagram" overrideable="false" overriddenConstraints="//@views.0/@constraints.0 //@views.1/@constraints.0">
- <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
- <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
- <properties xsi:type="constraints:ValueProperty" name="className" value="Diagram"/>
- </constraints>
- </views>
- <views name="SingleStyleSheetReference" sections="//@tabs.0/@sections.3">
- <constraints xsi:type="constraints:SimpleConstraint" name="isStyleSheetReference">
- <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.0"/>
- <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/papyrus/infra/gmfdiag/css"/>
- <properties xsi:type="constraints:ValueProperty" name="className" value="StyleSheetReference"/>
- </constraints>
- </views>
- <views name="SingleEmbeddedStyleSheet" sections="//@tabs.0/@sections.4">
- <constraints xsi:type="constraints:SimpleConstraint" name="isEmbeddedStyleSheet">
- <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.0"/>
- <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/papyrus/infra/gmfdiag/css"/>
- <properties xsi:type="constraints:ValueProperty" name="className" value="EmbeddedStyleSheet"/>
- </constraints>
- </views>
- <dataContexts name="CSS" label="CSS">
- <elements name="PapyrusCSSStyle">
- <properties name="cssId" label="CSS ID" description="The CSS ID of this element. The ID should be unique within a Diagram. It can be used to retrieve the style properties applied to this element."/>
- <properties name="cssClass" label="CSS Classes" multiplicity="-1" description="The list of CSS Classes associated to this element. Classes are string identifiers, used by the CSS Stylesheets to identify a set of elements on which styles should be applied."/>
- <properties name="cssStyle" label="CSS Style" description="The list of CSS properties applied to this element. This is a local style, which will only be applied on the selected element."/>
- </elements>
- <elements name="DiagramStyle" supertypes="//@dataContexts.0/@elements.0">
- <properties name="css_stylesheets" label="Diagram style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to this diagram"/>
- </elements>
- <elements name="ModelStyle">
- <properties name="modelStyleSheets" label="Model style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to this model"/>
- </elements>
- <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi#//@modelElementFactories.0"/>
- </dataContexts>
- <dataContexts name="modelstylesheets" label="StyleSheets">
- <elements name="StyleSheetReference">
- <properties name="path" label="Path" description="The path to an external style sheet file"/>
- </elements>
- <elements name="EmbeddedStyleSheet">
- <properties name="label" label="" description="The stylesheet's label"/>
- <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>
- <dataContexts name="Preferences" label="Preferences">
- <elements name="org.eclipse.papyrus.infra.gmfdiag.css">
- <properties name="currentTheme" label="" description="The theme currently applied to all Papyrus Diagrams in your workspace. The theme can be changed in the preferences."/>
- </elements>
- <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi#//@modelElementFactories.1"/>
- </dataContexts>
-</contexts:Context>
+<?xml version="1.0" encoding="UTF-8"?>
+<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" name="CSS">
+ <tabs label="Style" id="style" category="org.eclipse.papyrus" image="" priority="70">
+ <sections name="SingleStylableElement" sectionFile="ui/SingleStylableElement.xwt">
+ <widget href="ui/SingleStylableElement.xwt#/"/>
+ </sections>
+ <sections name="MultipleStylableElement" sectionFile="ui/MultipleStylableElement.xwt">
+ <widget href="ui/MultipleStylableElement.xwt#/"/>
+ </sections>
+ <sections name="SingleDiagram" sectionFile="ui/SingleDiagram.xwt">
+ <widget href="ui/SingleDiagram.xwt#/"/>
+ </sections>
+ <sections name="SingleStyleSheetReference" sectionFile="ui/SingleStyleSheetReference.xwt">
+ <widget href="ui/SingleStyleSheetReference.xwt#//@widgets.0"/>
+ </sections>
+ <sections name="SingleEmbeddedStyleSheet" sectionFile="ui/SingleEmbeddedStyleSheet.xwt">
+ <widget href="ui/SingleEmbeddedStyleSheet.xwt#//@widgets.0"/>
+ </sections>
+ <sections name="SingleTheme" sectionFile="ui/SingleTheme.xwt">
+ <widget href="ui/SingleTheme.xwt#/"/>
+ </sections>
+ </tabs>
+ <views name="SingleStylableElement" sections="//@tabs.0/@sections.0">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isSingleStylableElement" overrideable="false" overriddenConstraints="//@views.1/@constraints.0">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="View"/>
+ </constraints>
+ </views>
+ <views elementMultiplicity="-1" name="MultipleStylableElement" sections="//@tabs.0/@sections.1">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isMultipleStylableElement" overrideable="false">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="View"/>
+ </constraints>
+ </views>
+ <views name="Diagram" sections="//@tabs.0/@sections.2">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isDiagram" overrideable="false" overriddenConstraints="//@views.0/@constraints.0 //@views.1/@constraints.0">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="Diagram"/>
+ </constraints>
+ </views>
+ <views name="SingleStyleSheetReference" sections="//@tabs.0/@sections.3">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isStyleSheetReference">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/papyrus/infra/gmfdiag/css"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="StyleSheetReference"/>
+ </constraints>
+ </views>
+ <views name="SingleEmbeddedStyleSheet" sections="//@tabs.0/@sections.4">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isEmbeddedStyleSheet">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/papyrus/infra/gmfdiag/css"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="EmbeddedStyleSheet"/>
+ </constraints>
+ </views>
+ <views name="SingleTheme" sections="//@tabs.0/@sections.5">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isTheme">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/papyrus/infra/gmfdiag/css"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="Theme"/>
+ </constraints>
+ </views>
+ <dataContexts name="CSS" label="CSS">
+ <elements name="PapyrusCSSStyle">
+ <properties name="cssId" label="CSS ID" description="The CSS ID of this element. The ID should be unique within a Diagram. It can be used to retrieve the style properties applied to this element."/>
+ <properties name="cssClass" label="CSS Classes" multiplicity="-1" description="The list of CSS Classes associated to this element. Classes are string identifiers, used by the CSS Stylesheets to identify a set of elements on which styles should be applied."/>
+ <properties name="cssStyle" label="CSS Style" description="The list of CSS properties applied to this element. This is a local style, which will only be applied on the selected element."/>
+ </elements>
+ <elements name="DiagramStyle" supertypes="//@dataContexts.0/@elements.0">
+ <properties name="css_stylesheets" label="Diagram style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to this diagram"/>
+ </elements>
+ <elements name="ModelStyle">
+ <properties name="modelStyleSheets" label="Model style sheets" type="Reference" multiplicity="-1" description="The style sheets associated to this model"/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi#//@modelElementFactories.0"/>
+ </dataContexts>
+ <dataContexts name="WorkspaceThemes" label="Themes">
+ <elements name="Theme">
+ <properties name="label" label="Label" description="Theme label"/>
+ <properties name="icon" label="Icon" description="Theme icon"/>
+ <properties name="stylesheets" label="Theme style sheets" type="Reference" multiplicity="-1"/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi#//@modelElementFactories.2"/>
+ </dataContexts>
+ <dataContexts name="modelstylesheets" label="StyleSheets">
+ <elements name="StyleSheetReference">
+ <properties name="path" label="Path" description="The path to an external style sheet file"/>
+ </elements>
+ <elements name="EmbeddedStyleSheet">
+ <properties name="label" label="" description="The stylesheet's label"/>
+ <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>
+ <dataContexts name="Preferences" label="Preferences">
+ <elements name="org.eclipse.papyrus.infra.gmfdiag.css">
+ <properties name="currentTheme" label="" description="The theme currently applied to all Papyrus Diagrams in your workspace. The theme can be changed in the preferences."/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/Environment.xmi#//@modelElementFactories.1"/>
+ </dataContexts>
+</contexts:Context>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleTheme.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleTheme.xwt
new file mode 100644
index 0000000..ddcb484
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleTheme.xwt
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:css="clr-namespace:org.eclipse.papyrus.infra.gmfdiag.css.properties.widgets"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:j="clr-namespace:java.lang" 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>
+ <ppe:StringEditor input="{Binding}" property="WorkspaceThemes:Theme:label"></ppe:StringEditor>
+ <ppe:BrowseFilePropertyEditor input="{Binding}"
+ buttonLabel="Browse..." property="WorkspaceThemes:Theme:icon">
+ <ppe:BrowseFilePropertyEditor.filterNames>
+ <x:Array Type="j:String">
+ <j:String>All images</j:String>
+ <j:String>PNG Icon</j:String>
+ <j:String>GIF Icon</j:String>
+ <j:String>JPEG Icon</j:String>
+ </x:Array>
+ </ppe:BrowseFilePropertyEditor.filterNames>
+ <ppe:BrowseFilePropertyEditor.filterExtensions>
+ <x:Array Type="j:String">
+ <j:String>*.gif;*.png;*.jpeg</j:String>
+ <j:String>*.png</j:String>
+ <j:String>*.gif</j:String>
+ <j:String>*.jpeg</j:String>
+ </x:Array>
+ </ppe:BrowseFilePropertyEditor.filterExtensions>
+ </ppe:BrowseFilePropertyEditor>
+ <ppe:MultiReference input="{Binding}"
+ property="WorkspaceThemes:Theme:stylesheets"></ppe:MultiReference>
+</Composite> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml
index ca63aef..9875e75 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/plugin.xml
@@ -13,6 +13,103 @@
environmentModel="model/Environment.xmi">
</environment>
</extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.infra.gmfdiag.css.properties.handler.CSSFileHandler"
+ commandId="org.eclipse.papyrus.infra.gmfdiag.css.theme.define">
+ <enabledWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.extension"
+ value="css">
+ </test>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.infra.gmfdiag.css.properties.handler.CSSFileHandler"
+ commandId="org.eclipse.papyrus.infra.gmfdiag.css.theme.edit">
+ <enabledWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.extension"
+ value="css">
+ </test>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.infra.gmfdiag.css.theme.category"
+ id="org.eclipse.papyrus.infra.gmfdiag.css.theme.define"
+ name="Define theme">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.gmfdiag.css.theme.category"
+ id="org.eclipse.papyrus.infra.gmfdiag.css.theme.edit"
+ name="Edit theme">
+ </command>
+ <category
+ id="org.eclipse.papyrus.infra.gmfdiag.css.theme.category"
+ name="CSS Theme">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ <menu
+ id="org.eclipse.papyrus.infra.gmfdiag.css.theme.menu"
+ label="CSS Theme">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.ui.navigator.ProjectExplorer">
+ </equals>
+ </with>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.infra.gmfdiag.css.theme.menu">
+ <command
+ commandId="org.eclipse.papyrus.infra.gmfdiag.css.theme.define"
+ style="push">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.infra.gmfdiag.css.theme.edit"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.gmfdiag.css.properties.preferences.ThemePreferencesPage"
+ id="org.eclipse.papyrus.infra.gmfdiag.css.theme"
+ name="CSS Theme">
+ </page>
+ </extension>
<extension
point="org.eclipse.ui.propertyPages">
<page
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/ThemePropertyEditorFactory.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/ThemePropertyEditorFactory.java
new file mode 100644
index 0000000..bf877c5
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/creation/ThemePropertyEditorFactory.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.creation;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Editor factor for workspace theme.
+ *
+ * @author gpascual
+ *
+ */
+public class ThemePropertyEditorFactory extends EcorePropertyEditorFactory {
+
+ /**
+ * Default constructor.
+ *
+ * @param referenceIn
+ */
+ public ThemePropertyEditorFactory(EReference referenceIn) {
+ super(referenceIn);
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory#simpleCreateObject(org.eclipse.swt.widgets.Control)
+ *
+ * @param widget
+ * @return
+ */
+ @Override
+ protected EObject simpleCreateObject(Control widget) {
+ EObject createdObject = super.simpleCreateObject(widget);
+
+ //Generate an unique ID for created theme
+ if(createdObject instanceof Theme) {
+ ((Theme)createdObject).setId(EcoreUtil.generateUUID());
+ }
+
+ return createdObject;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeCreationDialog.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeCreationDialog.java
new file mode 100644
index 0000000..b7f9e83
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeCreationDialog.java
@@ -0,0 +1,559 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.dialog;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.PapyrusImageUtils;
+import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+
+
+/**
+ * Dialog to define a local theme from a selected CSS style.
+ *
+ * @author gpascual
+ */
+public class CSSThemeCreationDialog extends Dialog {
+
+ /** Title for icon selection dialog. */
+ private static final String ICON_SELECTION_DIALOG_TITLE = "Icon selection";
+
+ /** Label for workspace menu. */
+ private static final String WORKSPACE_MENU_LABEL = "Workspace";
+
+ /** Label for file system menu. */
+ private static final String FILE_SYSTEM_MENU_LABEL = "File System";
+
+ /** Id for file system menu item. */
+ private static final int FILESYSTEM_MENU_ID = 15;
+
+ /** Id for workspace menu item. */
+ private static final int WORKSPACE_MENU_ID = 12;
+
+ /** Label for browse button to select theme icon. */
+ private static final String BROWSE_BUTTON_LABEL = "Browse...";
+
+ /** List of valid extensions for an icon. */
+ private static List<String> filterExtensions = Arrays.asList(new String[]{ "*.gif;*.png;*.jpeg", "*.gif", "*.png", "*.jpeg" });
+
+ /** List of name associated to valid extensions. */
+ private List<String> filterNames = Arrays.asList(new String[]{ "All images", "GIF Icon", "PNG Icon", "JPEG Icon" });
+
+ /** Text for dialog title. */
+ private static final String DIALOG_TITLE = "CSS Theme Definition";
+
+ /** Text for theme icon field. */
+ private static final String ICON_PATH_LABEL = "Icon";
+
+ /** Text for theme label field. */
+ private static final String THEME_NAME_LABEL = "Label";
+
+ /** Id of browse button. */
+ private static final int BROWSE_BUTTON_ID = 13;
+
+ /** Theme to definr with dialog. */
+ private Theme theme = null;
+
+ /** Theme label field. */
+ private Text themeLabelField = null;
+
+ /** Theme icon path field. */
+ private Text iconPathField = null;
+
+ /** Theme style sheets viewer. */
+ private TreeViewer styleSheetsViewer = null;
+
+ /** Menu of browse button to select theme icon. */
+ private Menu browseMenu = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param parentShell
+ * shell of parent widget
+ * @param theme
+ * theme to edit
+ */
+ public CSSThemeCreationDialog(Shell parentShell, Theme theme) {
+ super(parentShell);
+
+ // Set theme to edit
+ this.theme = theme;
+ initialiseFilterLabels(filterNames, filterExtensions);
+ }
+
+ /**
+ * Gets the filter labels.
+ *
+ * @param filterNames
+ * the filter names
+ * @param filterExtensions
+ * the filter extensions
+ */
+ private void initialiseFilterLabels(List<String> filterNames, List<String> filterExtensions) {
+ int size = Math.min(filterNames.size(), filterExtensions.size());
+ String[] filters = new String[size];
+ for(int i = 0; i < size; i++) {
+ filters[i] = filterNames.get(i) + " (" + filterExtensions.get(i) + ")";
+ }
+
+ this.filterNames = Arrays.asList(filters);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
+ *
+ * @return
+ */
+ @Override
+ protected Point getInitialSize() {
+ return new Point(320, 360);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+ *
+ * @return
+ */
+ @Override
+ protected boolean isResizable() {
+
+ // Set dialog resizable
+ return true;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ *
+ * @param newShell
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ // Add title and icon to dialog
+ newShell.setText(DIALOG_TITLE);
+ newShell.setImage(PapyrusImageUtils.getDefaultIcon());
+ }
+
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * @return
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ // Create main container to dialog
+ Composite mainComposite = (Composite)super.createDialogArea(parent);
+ mainComposite.setLayout(new GridLayout(2, false));
+
+ // Add different parts to dialog
+ createThemeLabelPart(mainComposite);
+ createThemeIconPart(mainComposite);
+ createStyleSheetsTreeComposite(mainComposite);
+
+ // Initialise tree viewer
+ initialiseTree();
+
+ return mainComposite;
+ }
+
+ /**
+ * Create all components for theme label.
+ *
+ * @param parent
+ * Composite where components will be added
+ */
+ private void createThemeLabelPart(Composite parent) {
+
+ // Label for theme name field
+ Label themeNameLabel = new Label(parent, SWT.NONE);
+ themeNameLabel.setText(THEME_NAME_LABEL);
+
+ // Field to edit theme label
+ themeLabelField = new Text(parent, SWT.BORDER);
+ GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ themeLabelField.setLayoutData(layoutData);
+
+ // Add behavior to text field
+ themeLabelField.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ theme.setLabel(themeLabelField.getText());
+ }
+ });
+ }
+
+ /**
+ * Create all components for theme icon.
+ *
+ * @param parent
+ * Composite where components will be added
+ */
+ private void createThemeIconPart(Composite parent) {
+
+ //Label for theme icon field
+ Label themeIconLabel = new Label(parent, SWT.NONE);
+ themeIconLabel.setText(ICON_PATH_LABEL);
+
+ // Field to edit icon path for theme
+ iconPathField = new Text(parent, SWT.BORDER);
+ iconPathField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ // Add behavior to text field
+ iconPathField.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ theme.setIcon(iconPathField.getText());
+ }
+ });
+
+
+ // Add browse button to help user
+ Button browseButton = createButton(parent, BROWSE_BUTTON_ID, BROWSE_BUTTON_LABEL, false);
+
+ browseMenu = new Menu(browseButton);
+
+ createMenuItem(browseMenu, FILE_SYSTEM_MENU_LABEL, FILESYSTEM_MENU_ID);
+ createMenuItem(browseMenu, WORKSPACE_MENU_LABEL, WORKSPACE_MENU_ID);
+
+ }
+
+ /**
+ * Create menu item.
+ *
+ * @param parentMenu
+ * Menu where it will be added
+ * @param label
+ * Label of menu item
+ * @param menuId
+ */
+ private void createMenuItem(Menu parentMenu, String label, int menuId) {
+
+ MenuItem menuItem = new MenuItem(parentMenu, SWT.NONE);
+ menuItem.setText(label);
+ menuItem.setData(new Integer(menuId));
+ menuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ menuSelected(((Integer)e.widget.getData()).intValue());
+ }
+ });
+
+
+ }
+
+ /**
+ * Action to run when a menu is slected.
+ *
+ * @param menuId
+ * ID of selected menu
+ */
+ private void menuSelected(int menuId) {
+ switch(menuId) {
+ case WORKSPACE_MENU_ID:
+ browseWorkspace();
+ break;
+ case FILESYSTEM_MENU_ID:
+ browseFileSytem();
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+ }
+
+ /**
+ * Browse file in file system.
+ */
+ private void browseFileSytem() {
+ File file = getFile(iconPathField.getText());
+
+ FileDialog dialog = new FileDialog(getShell());
+ dialog.setText(ICON_SELECTION_DIALOG_TITLE);
+
+ dialog.setFileName(file.getAbsolutePath());
+ dialog.setFilterExtensions(filterExtensions.toArray(new String[filterExtensions.size()]));
+ dialog.setFilterNames(filterNames.toArray(new String[filterNames.size()]));
+
+ String result = dialog.open();
+ if(result == null) { //Cancel
+ return;
+ }
+ setResult(result);
+ }
+
+ /**
+ * Browse file in workspace.
+ */
+ private void browseWorkspace() {
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ ILabelProvider labelProvider = labelProviderService.getLabelProvider();
+
+ IFile currentFile = getIFile(iconPathField.getText());
+
+ TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
+ dialog.setTitle(ICON_SELECTION_DIALOG_TITLE);
+
+
+ WorkspaceContentProvider contentProvider = new WorkspaceContentProvider();
+
+
+ if(!(filterExtensions.isEmpty() || filterNames.isEmpty())) {
+ //The filters have been defined
+ contentProvider.setExtensionFilters(new LinkedHashMap<String, String>()); //Reset the default filters
+
+ //Use our own filters
+ for(int i = 0; i < Math.min(filterNames.size(), filterExtensions.size()); i++) {
+ contentProvider.addExtensionFilter(filterExtensions.get(i), filterNames.get(i));
+ }
+ }
+
+ dialog.setContentProvider(contentProvider);
+ dialog.setLabelProvider(labelProvider);
+
+
+ if(currentFile != null && currentFile.exists()) {
+ dialog.setInitialSelections(new IFile[]{ currentFile });
+ }
+
+ int code = dialog.open();
+ if(code == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ Object file = result[0];
+ if(file instanceof IFile) {
+ setResult((IFile)file);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ *
+ * @param buttonId
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+
+ switch(buttonId) {
+ case BROWSE_BUTTON_ID:
+ browseMenu.setVisible(true);
+ break;
+ default:
+ super.buttonPressed(buttonId);
+ break;
+ }
+
+ }
+
+
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(IFile file) {
+ iconPathField.setText(file.getFullPath().toString());
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(File file) {
+ iconPathField.setText(file.getAbsolutePath());
+
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param path
+ * the new result
+ */
+ protected void setResult(String path) {
+ iconPathField.setText(path);
+
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the i file
+ */
+ protected IFile getIFile(String path) {
+ return FileUtil.getIFile(path);
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the file
+ */
+ protected File getFile(String path) {
+ return FileUtil.getFile(path);
+ }
+
+
+
+ /**
+ * Create composite containing style sheets viewer.
+ *
+ * @param parent
+ * Composite where components will be added
+ */
+ private void createStyleSheetsTreeComposite(Composite parent) {
+
+ styleSheetsViewer = new TreeViewer(parent, SWT.BORDER);
+ Tree tree = styleSheetsViewer.getTree();
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
+ }
+
+ /**
+ * Initialise display of style sheets tree viewer.
+ */
+ private void initialiseTree() {
+ styleSheetsViewer.setContentProvider(new EMFContentProvider(theme, StylesheetsPackage.eINSTANCE.getTheme_Stylesheets()) {
+
+ @Override
+ protected IStructuredContentProvider getSemanticProvider(final EObject editedEObject, final EStructuralFeature feature) {
+
+ // Use a standard content provider
+ return new AbstractStaticContentProvider() {
+
+ public Object[] getElements() {
+ List<Object> result = new LinkedList<Object>();
+ if(editedEObject instanceof Theme) {
+ result.addAll(theme.getStylesheets());
+ }
+ return result.toArray();
+ }
+ };
+
+ }
+ });
+
+ styleSheetsViewer.setLabelProvider(new StyleSheetLabelProvider());
+ styleSheetsViewer.setInput(theme.getStylesheets());
+ }
+
+
+ /**
+ * Label provider for style sheets tree viwer.
+ *
+ * @author gpascual
+ *
+ */
+ private class StyleSheetLabelProvider extends BaseLabelProvider implements ILabelProvider {
+
+ /**
+ * Default constructor.
+ *
+ */
+ public StyleSheetLabelProvider() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public String getText(Object element) {
+ String text = element.toString();
+
+ if(element instanceof StyleSheetReference) {
+ text = ((StyleSheetReference)element).getPath();
+ }
+
+ return text;
+ }
+
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeEditionDialog.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeEditionDialog.java
new file mode 100644
index 0000000..d25c0f1
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/dialog/CSSThemeEditionDialog.java
@@ -0,0 +1,1133 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.dialog;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.PapyrusImageUtils;
+import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.CollectionContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
+import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+import org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Dialog to edit theme from an initial selection in workspace.
+ *
+ * @author gpascual
+ *
+ */
+public class CSSThemeEditionDialog extends Dialog {
+
+ /** Title for icon selection dialog. */
+ private static final String ICON_SELECTION_DIALOG_TITLE = "Icon selection";
+
+ /** Label for workspace menu. */
+ private static final String WORKSPACE_MENU_LABEL = "Workspace";
+
+ /** Label for file system menu. */
+ private static final String FILESYSTEM_MENU_LABEL = "File System";
+
+ /** Id of workspace menu. */
+ private static final int WORKSPACE_MENU_ID = 23;
+
+ /** Id of of file system menu */
+ private static final int FILESYSTEM_MENU_ID = 22;
+
+ /** Id of edit button. */
+ private static final int EDIT_BUTTON_ID = 19;
+
+ /** Id of down button. */
+ private static final int DOWN_BUTTON_ID = 18;
+
+ /** Id of up button. */
+ private static final int UP_BUTTON_ID = 17;
+
+ /** ID of delete button. */
+ private static final int DELETE_BUTTON_ID = 15;
+
+ /** ID of add button. */
+ private static final int ADD_BUTTON_ID = 14;
+
+ /** ID of browse buton. */
+ private static final int BROWSE_BUTTON_ID = 16;
+
+ /** Array of all id's buttons which were added in dialog. */
+ private static int[] actionIdList = new int[]{ DOWN_BUTTON_ID, UP_BUTTON_ID, DELETE_BUTTON_ID, ADD_BUTTON_ID, BROWSE_BUTTON_ID, EDIT_BUTTON_ID };
+
+ /** Title for add action dialog. */
+ private static final String ADD_DIALOG_TITLE = "Style sheets selection";
+
+ /** Icon for edit action button. */
+ private static final Image EDIT_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Edit_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for delete action button. */
+ private static final Image DELETE_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Delete_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for add action button. */
+ private static final Image ADD_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Add_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for up action button. */
+ private static final Image UP_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Up_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for down action button. */
+ private static final Image DOWN_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Down_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Text for style sheets list label. */
+ private static final String STYLE_SHEETS_LABEL = "Style sheets";
+
+ /** Text for browse button. */
+ private static final String BROWSE_BUTTON_LABEL = "Browse...";
+
+ /** Text for theme icon label. */
+ private static final String THEME_ICON_LABEL = "Icon";
+
+ /** Text for theme name label. */
+ private static final String THEME_NAME_LABEL = "Label";
+
+ /** Text for theme combo label. */
+ private static final String THEME_COMBO_LABEL = "Theme";
+
+ /** Title of dialog. */
+ private static final String DIALOG_TITLE = "CSS Theme Edition";
+
+ /** List of valid extensions for an icon. */
+ private List<String> filterExtensions = Arrays.asList(new String[]{ "*.gif;*.png;*.jpeg", "*.gif", "*.png", "*.jpeg" });
+
+ /** List of name associated to valid extensions. */
+ private List<String> filterNames = Arrays.asList(new String[]{ "All images", "GIF Icon", "PNG Icon", "JPEG Icon" });
+
+ /** Field for theme label. */
+ private Text themeLabelField = null;
+
+ /** Field for theme icon path. */
+ private Text iconPathfield = null;
+
+ /** Workspace themes from preference file. */
+ private WorkspaceThemes workspaceThemes = null;
+
+ /** Initial selection in workspace. */
+ private List<StyleSheet> selectedStyleSheetsList = null;
+
+ /** Viewer for style sheets of current theme. */
+ private TreeViewer themeStyleSheetsViewer = null;
+
+ /** Factory to edit contents of dialog. */
+ private EcorePropertyEditorFactory editorFactory = new EcorePropertyEditorFactory(StylesheetsPackage.eINSTANCE.getTheme_Stylesheets());
+
+ /** Current edited theme. */
+ private Theme currentTheme = null;
+
+ /** Label provider for different composites. */
+ private LabelProvider labelProvider = null;
+
+ /** Menu for browse button. */
+ private Menu browseMenu = null;
+
+
+ /**
+ * Default constructor.
+ *
+ * @param parentShell
+ */
+ public CSSThemeEditionDialog(Shell parentShell, WorkspaceThemes themes, IStructuredSelection parentSelection) {
+ super(parentShell);
+ workspaceThemes = themes;
+ initialiseFilterLabels(filterNames, filterExtensions);
+ initialiseWithSelection(parentSelection);
+ }
+
+
+ /**
+ * Gets the filter labels.
+ *
+ * @param filterNames
+ * the filter names
+ * @param filterExtensions
+ * the filter extensions
+ */
+ private void initialiseFilterLabels(List<String> filterNames, List<String> filterExtensions) {
+ int size = Math.min(filterNames.size(), filterExtensions.size());
+ String[] filters = new String[size];
+ for(int i = 0; i < size; i++) {
+ filters[i] = filterNames.get(i) + " (" + filterExtensions.get(i) + ")";
+ }
+ this.filterNames = Arrays.asList(filters);
+ }
+
+ /**
+ * Initialise selected style sheets list with selection.
+ *
+ * @param selection
+ * Source to extract style sheets
+ */
+ private void initialiseWithSelection(IStructuredSelection selection) {
+ Assert.isNotNull(selection);
+
+ // Instantiate an empty list
+ selectedStyleSheetsList = new ArrayList<StyleSheet>();
+
+ // Create iterator and factory for initialisation
+ Iterator<?> selectionIterator = selection.iterator();
+ StylesheetsFactory styleSheetsFactory = StylesheetsFactory.eINSTANCE;
+
+ // Explore selection
+ while(selectionIterator.hasNext()) {
+
+ // Check only file from selection
+ Object object = selectionIterator.next();
+ if(object instanceof IFile) {
+
+ // Create a style sheet reference and add it to list
+ StyleSheetReference reference = styleSheetsFactory.createStyleSheetReference();
+ reference.setPath(((IFile)object).getFullPath().toString());
+
+ selectedStyleSheetsList.add(reference);
+ }
+ }
+
+
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ *
+ * @param newShell
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ // Set title and icon of dialog
+ newShell.setText(DIALOG_TITLE);
+ newShell.setImage(PapyrusImageUtils.getDefaultIcon());
+ }
+
+ /**
+ * Create contents of the dialog.
+ *
+ * @param parent
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite container = (Composite)super.createDialogArea(parent);
+ container.setLayout(new GridLayout(2, false));
+
+ createEditedThemeComposite(container);
+ createThemeLabelPart(container);
+ createThemeIconPart(container);
+ createTreeActionButtons(container);
+ createThemeStyleSheetsPart(container);
+
+ refreshDialogContent(null);
+
+ return container;
+ }
+
+ /**
+ * Create composite whith that can select theme to edit.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createEditedThemeComposite(Composite parent) {
+
+ // Label for combo of themes
+ Label themeLabel = new Label(parent, SWT.NONE);
+ themeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ themeLabel.setText(THEME_COMBO_LABEL);
+
+ // Create a combo so that user can choice theme to edit
+ ComboViewer comboViewer = new ComboViewer(parent, SWT.READ_ONLY);
+ comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ /**
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ *
+ * @param event
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+
+ // Refresh content of dialog
+ refreshDialogContent(event.getSelection());
+
+ }
+ });
+
+ // Add label provider to combo viewer
+ comboViewer.setLabelProvider(new LabelProvider() {
+
+ /**
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+
+ // Super return as default result
+ String text = super.getText(element);
+
+ // Display label of theme in combo viewer
+ if(element instanceof Theme) {
+ text = ((Theme)element).getLabel();
+ }
+
+
+ return text;
+ }
+ });
+
+ comboViewer.setContentProvider(new EMFContentProvider(workspaceThemes, StylesheetsPackage.eINSTANCE.getWorkspaceThemes_Themes()) {
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.providers.EMFContentProvider#getSemanticProvider(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.ecore.EStructuralFeature)
+ *
+ * @param editedEObject
+ * @param feature
+ * @return
+ */
+ @Override
+ protected IStructuredContentProvider getSemanticProvider(final EObject editedEObject, final EStructuralFeature feature) {
+
+ // Use a standard content provider
+ return new AbstractStaticContentProvider() {
+
+ public Object[] getElements() {
+
+ List<Object> result = new LinkedList<Object>();
+
+ // Create list with workspace themes
+ if(editedEObject instanceof WorkspaceThemes) {
+ result.addAll(workspaceThemes.getThemes());
+ }
+
+ return result.toArray();
+ }
+ };
+
+ }
+ });
+
+ comboViewer.setInput(workspaceThemes.getThemes());
+ Combo combo = comboViewer.getCombo();
+ combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ }
+
+ /**
+ * Create theme label composite.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createThemeLabelPart(Composite parent) {
+
+ // Create label for label field
+ Label themeNameLabel = new Label(parent, SWT.NONE);
+ themeNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ themeNameLabel.setText(THEME_NAME_LABEL);
+
+ // Add theme label field
+ themeLabelField = new Text(parent, SWT.BORDER);
+ GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
+ themeLabelField.setLayoutData(gd_text);
+
+ themeLabelField.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ currentTheme.setLabel(themeLabelField.getText());
+
+ }
+ });
+ }
+
+ /**
+ * Create theme icon part.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createThemeIconPart(Composite parent) {
+ Label iconLabel = new Label(parent, SWT.NONE);
+ iconLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ iconLabel.setText(THEME_ICON_LABEL);
+
+ iconPathfield = new Text(parent, SWT.BORDER);
+ iconPathfield.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ iconPathfield.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ currentTheme.setIcon(iconPathfield.getText());
+
+ }
+ });
+ Button browseButton = createButton(parent, BROWSE_BUTTON_ID, BROWSE_BUTTON_LABEL, false);
+ browseMenu = new Menu(browseButton);
+
+ createMenuItem(browseMenu, FILESYSTEM_MENU_LABEL, FILESYSTEM_MENU_ID);
+ createMenuItem(browseMenu, WORKSPACE_MENU_LABEL, WORKSPACE_MENU_ID);
+ }
+
+ /**
+ * Create menu item.
+ *
+ * @param parentMenu
+ * Menu where it will be added
+ * @param label
+ * Label of menu item
+ * @param menuId
+ */
+ private void createMenuItem(Menu parentMenu, String label, int menuId) {
+
+ MenuItem menuItem = new MenuItem(browseMenu, SWT.NONE);
+ menuItem.setText(label);
+ menuItem.setData(new Integer(menuId));
+ menuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ menuSelected(((Integer)e.widget.getData()).intValue());
+ }
+ });
+
+
+ }
+
+ /**
+ * Action to run when a menu is slected.
+ *
+ * @param menuId
+ * ID of selected menu
+ */
+ private void menuSelected(int menuId) {
+ switch(menuId) {
+ case WORKSPACE_MENU_ID:
+ browseWorkspace();
+ break;
+ case FILESYSTEM_MENU_ID:
+ browseFileSytem();
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+ }
+
+ /**
+ * Browse file in file system.
+ */
+ private void browseFileSytem() {
+ File file = getFile(iconPathfield.getText());
+
+ FileDialog dialog = new FileDialog(getShell());
+ dialog.setText(ICON_SELECTION_DIALOG_TITLE);
+
+ dialog.setFileName(file.getAbsolutePath());
+ dialog.setFilterExtensions(filterExtensions.toArray(new String[filterExtensions.size()]));
+ dialog.setFilterNames(filterNames.toArray(new String[filterNames.size()]));
+ String result = dialog.open();
+ if(result == null) { //Cancel
+ return;
+ }
+ setResult(result);
+ }
+
+ /**
+ * Browse file in workspace.
+ */
+ private void browseWorkspace() {
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ ILabelProvider labelProvider = labelProviderService.getLabelProvider();
+
+ IFile currentFile = getIFile(iconPathfield.getText());
+
+ TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
+ dialog.setTitle(ICON_SELECTION_DIALOG_TITLE);
+
+
+ WorkspaceContentProvider contentProvider = new WorkspaceContentProvider();
+
+
+ if(!(filterExtensions.isEmpty() || filterNames.isEmpty())) {
+ //The filters have been defined
+ contentProvider.setExtensionFilters(new LinkedHashMap<String, String>()); //Reset the default filters
+
+ //Use our own filters
+ for(int i = 0; i < Math.min(filterNames.size(), filterExtensions.size()); i++) {
+ contentProvider.addExtensionFilter(filterExtensions.get(i), filterNames.get(i));
+ }
+ }
+
+ dialog.setContentProvider(contentProvider);
+ dialog.setLabelProvider(labelProvider);
+
+
+ if(currentFile != null && currentFile.exists()) {
+ dialog.setInitialSelections(new IFile[]{ currentFile });
+ }
+
+ int code = dialog.open();
+ if(code == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ Object file = result[0];
+ if(file instanceof IFile) {
+ setResult((IFile)file);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(IFile file) {
+ iconPathfield.setText(file.getFullPath().toString());
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(File file) {
+ iconPathfield.setText(file.getAbsolutePath());
+
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param path
+ * the new result
+ */
+ protected void setResult(String path) {
+ iconPathfield.setText(path);
+
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the i file
+ */
+ protected IFile getIFile(String path) {
+ return FileUtil.getIFile(path);
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the file
+ */
+ protected File getFile(String path) {
+ return FileUtil.getFile(path);
+ }
+
+
+ /**
+ * Create theme style sheets part.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createThemeStyleSheetsPart(Composite parent) {
+
+ // Create viewer
+ themeStyleSheetsViewer = new TreeViewer(parent, SWT.BORDER);
+
+ // Set standard collection content provider
+ themeStyleSheetsViewer.setContentProvider(CollectionContentProvider.instance);
+
+ labelProvider = new LabelProvider() {
+
+ /**
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+
+ // Use ancestor result as default
+ String text = super.getText(element);
+
+ // Display path of style sheet reference
+ if(element instanceof StyleSheetReference) {
+ text = ((StyleSheetReference)element).getPath();
+ } else if(element instanceof EmbeddedStyleSheet) {
+ text = ((EmbeddedStyleSheet)element).getLabel();
+ }
+
+ return text;
+ }
+ };
+ themeStyleSheetsViewer.setLabelProvider(labelProvider);
+
+ // Set layout
+ Tree tree = themeStyleSheetsViewer.getTree();
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
+
+
+ }
+
+ /**
+ * Create actions associate to tree viewer.
+ *
+ * @param parent
+ * Composite where action buttons will be added
+ */
+ private void createTreeActionButtons(Composite parent) {
+ Label labelViewer = new Label(parent, SWT.NONE);
+ labelViewer.setText(STYLE_SHEETS_LABEL);
+
+ Composite buttonsPanel = new Composite(parent, SWT.NONE);
+ buttonsPanel.setLayout(new GridLayout());
+ buttonsPanel.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false, 2, 1));
+
+ createButton(buttonsPanel, ADD_BUTTON_ID, ADD_ICON, false);
+ createButton(buttonsPanel, DELETE_BUTTON_ID, DELETE_ICON, false);
+ createButton(buttonsPanel, UP_BUTTON_ID, UP_ICON, false);
+ createButton(buttonsPanel, DOWN_BUTTON_ID, DOWN_ICON, false);
+ createButton(buttonsPanel, EDIT_BUTTON_ID, EDIT_ICON, false);
+
+ }
+
+
+ /**
+ * Override method to create a button with an icon and no label.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createButton(Composite, int, String, boolean)
+ *
+ * @param parent
+ * @param id
+ * @param icon
+ * @return
+ */
+ protected Button createButton(Composite parent, int id, Image icon, boolean defaultButton) {
+ Button button = super.createButton(parent, id, "", defaultButton);
+ button.setImage(icon);
+ return button;
+ }
+
+ /**
+ *
+ * Override method to define specific data layout for own dialog's buttons.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#setButtonLayoutData(org.eclipse.swt.widgets.Button)
+ *
+ * @param button
+ */
+ @Override
+ protected void setButtonLayoutData(Button button) {
+
+ // Determine id of button
+ Object data = button.getData();
+ int buttonId = -1;
+ if(data instanceof Integer) {
+ buttonId = (Integer)data;
+ }
+
+ //Filter specific button to set data layout
+ switch(buttonId) {
+ case ADD_BUTTON_ID:
+ case DELETE_BUTTON_ID:
+ case UP_BUTTON_ID:
+ case DOWN_BUTTON_ID:
+ case EDIT_BUTTON_ID:
+ button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ break;
+ default:
+ super.setButtonLayoutData(button);
+ break;
+ }
+
+
+ }
+
+ /**
+ * Delete current selection of tree viewer.
+ */
+ private void deleteAction() {
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedElement instanceof StyleSheet) {
+ currentTheme.getStylesheets().remove(selectedElement);
+ }
+
+ themeStyleSheetsViewer.setInput(currentTheme.getStylesheets());
+ refreshTreeviewer(currentTheme);
+ }
+
+ }
+
+
+ /**
+ * Open a dialog to add a style sheet to current selected theme.
+ */
+ private void addAction() {
+
+
+ ReferenceSelector selector = new ReferenceSelector(true);
+ selector.setContentProvider(new EMFContentProvider(currentTheme, StylesheetsPackage.eINSTANCE.getTheme_Stylesheets()) {
+
+ @Override
+ protected IStructuredContentProvider getSemanticProvider(final EObject editedEObject, final EStructuralFeature feature) {
+
+ // Use a standard content provider
+ return new AbstractStaticContentProvider() {
+
+ public Object[] getElements() {
+ List<Object> result = new LinkedList<Object>();
+ if(editedEObject instanceof Theme) {
+ result.addAll(currentTheme.getStylesheets());
+ }
+ return result.toArray();
+ }
+ };
+ }
+ });
+ selector.setLabelProvider(labelProvider);
+
+ // Use common component for add dialog and parameterize it
+ MultipleValueSelectorDialog vDialog = new MultipleValueSelectorDialog(getShell(), selector, ADD_DIALOG_TITLE);
+ vDialog.setContextElement(currentTheme);
+ vDialog.setLabelProvider(labelProvider);
+ vDialog.setFactory(new EcorePropertyEditorFactory(StylesheetsPackage.Literals.THEME__STYLESHEETS));
+
+ // Handle dialog result
+ int result = vDialog.open();
+ if(result == Dialog.OK) {
+
+ Object[] resultArray = vDialog.getResult();
+ refreshStyleSheets(resultArray);
+
+ }
+ }
+
+
+ /**
+ * Move up the selected style sheet in list.
+ */
+ private void upAction() {
+
+ // Handle selection to extract selected style sheet
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+
+ if(selectedElement instanceof StyleSheet) {
+
+ // Get index of selected style sheet in list
+ EList<StyleSheet> stylesheetsList = currentTheme.getStylesheets();
+ int index = stylesheetsList.indexOf(selectedElement);
+
+ // Check if selected style sheet is not at top of list
+ if(index > 0) {
+ stylesheetsList.move(--index, (StyleSheet)selectedElement);
+ themeStyleSheetsViewer.setInput(stylesheetsList);
+ }
+ }
+ }
+ }
+
+ /**
+ * Move down the selected style sheet in list.
+ */
+ private void downAction() {
+
+ // Handle selection to extract selected style sheet
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+
+ if(selectedElement instanceof StyleSheet) {
+
+ // Get index of selected style sheet in list
+ EList<StyleSheet> stylesheetsList = currentTheme.getStylesheets();
+ int index = stylesheetsList.indexOf(selectedElement);
+
+ // Check if selected style sheet is not at bottom of list
+ if(index < stylesheetsList.size() - 1) {
+ stylesheetsList.move(++index, (StyleSheet)selectedElement);
+ themeStyleSheetsViewer.setInput(stylesheetsList);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Edit action on selected style sheet in tree viewer.
+ */
+ private void editAction() {
+
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedObject instanceof StyleSheet) {
+ // Use editor factory
+ editorFactory.edit(getContents(), selectedObject);
+ }
+ }
+
+
+ }
+
+
+ /**
+ * Fill style sheets viewer with selected style sheets.
+ *
+ * @param result
+ * Result from dialog selection
+ */
+ private void refreshStyleSheets(Object[] result) {
+
+ // Complete current theme with dialog result
+ for(Object object : result) {
+
+ // Check if this is a style sheet
+ if(object instanceof StyleSheet)
+ currentTheme.getStylesheets().add((StyleSheet)object);
+ }
+
+ refreshTreeviewer(currentTheme);
+ }
+
+
+ /**
+ * Refresh content of tree viewer according to selected theme/
+ *
+ * @param currentTheme
+ * Current theme
+ */
+ private void refreshTreeviewer(Theme currentTheme) {
+
+ if(currentTheme != null) {
+
+ EList<StyleSheet> themeStyleSheetsList = currentTheme.getStylesheets();
+
+
+ // For each selected reference, check match with existing reference in theme
+ for(StyleSheet basereference : selectedStyleSheetsList) {
+
+ // Flag for search
+ boolean found = false;
+ int i = 0;
+
+ // Explore theme style s
+ while(i < themeStyleSheetsList.size() && !found) {
+
+ // Use own comparator to determine if style sheet reference exist
+ found = StylesheetsComparator.instance.compare(themeStyleSheetsList.get(i), basereference) == 0;
+ i++;
+ }
+
+ // Add selected reference only if it don't exist in theme
+ if(!found) {
+ themeStyleSheetsList.add(basereference);
+ }
+ }
+
+ // Set mirroring list as viewer input
+ themeStyleSheetsViewer.setInput(themeStyleSheetsList);
+ }
+
+ updateButtons(currentTheme);
+
+ }
+
+
+ /**
+ *
+ * Update state of dialog buttons.
+ *
+ * @param currentTheme
+ * Selected theme which determine state of different buttons.
+ */
+ private void updateButtons(Theme currentTheme) {
+ boolean editionEnable = currentTheme != null;
+
+ for(int buttonId : actionIdList) {
+ switch(buttonId) {
+ case ADD_BUTTON_ID:
+ case BROWSE_BUTTON_ID:
+ getButton(buttonId).setEnabled(editionEnable);
+ break;
+ case DELETE_BUTTON_ID:
+ case EDIT_BUTTON_ID:
+ getButton(buttonId).setEnabled(editionEnable && !currentTheme.getStylesheets().isEmpty());
+ break;
+ case UP_BUTTON_ID:
+ case DOWN_BUTTON_ID:
+ getButton(buttonId).setEnabled(editionEnable && (currentTheme.getStylesheets().size() > 1));
+ default:
+ break;
+ }
+
+ }
+
+ }
+
+ /**
+ * Refresh dialog area according to combo selection.
+ *
+ * @param selection
+ * selection which comes from combo viewer
+ */
+ protected void refreshDialogContent(ISelection selection) {
+
+ // Current selected theme
+ currentTheme = null;
+
+ // Get selected theme from combo
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+
+ if(selectedElement instanceof Theme) {
+ currentTheme = (Theme)selectedElement;
+ }
+ }
+
+
+
+ boolean editionEnable = currentTheme != null;
+ themeLabelField.setEditable(editionEnable);
+ iconPathfield.setEditable(editionEnable);
+
+ if(editionEnable) {
+
+ // Refresh text field (label, icon path, ...)
+ String themeLabel = currentTheme.getLabel();
+ if(themeLabel == null) {
+ themeLabel = "";
+ }
+ themeLabelField.setText(themeLabel);
+
+
+ String iconPath = currentTheme.getIcon();
+ if(iconPath == null) {
+ iconPath = "";
+ }
+ iconPathfield.setText(iconPath);
+ }
+
+ // Tree viewer
+ refreshTreeviewer(currentTheme);
+
+ }
+
+
+ /**
+ * Create contents of the button bar.
+ *
+ * @param parent
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ *
+ * @param buttonId
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ switch(buttonId) {
+ case ADD_BUTTON_ID:
+ addAction();
+ break;
+ case DELETE_BUTTON_ID:
+ deleteAction();
+ break;
+ case BROWSE_BUTTON_ID:
+ browseMenu.setVisible(true);
+ break;
+ case UP_BUTTON_ID:
+ upAction();
+ break;
+ case DOWN_BUTTON_ID:
+ downAction();
+ break;
+ case EDIT_BUTTON_ID:
+ editAction();
+ default:
+ super.buttonPressed(buttonId);
+ }
+ }
+
+
+
+ /**
+ * Return the initial size of the dialog.
+ */
+ @Override
+ protected Point getInitialSize() {
+ return new Point(450, 300);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+ *
+ * @return
+ */
+ @Override
+ protected boolean isResizable() {
+ return true;
+ }
+
+ /**
+ * @return last selected theme for edition
+ */
+ public Theme getEditedTheme() {
+ return currentTheme;
+ }
+
+ /**
+ * Comparator basic for style sheets. It compare path for reference and label for embedded.
+ */
+ public static class StylesheetsComparator implements Comparator<StyleSheet> {
+
+ public static final Comparator<StyleSheet> instance = new StylesheetsComparator();
+
+ /**
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param firstStyleSheet
+ * @param secondStyleSheet
+ * @return
+ */
+ public int compare(StyleSheet firstStyleSheet, StyleSheet secondStyleSheet) {
+
+ // Default result for comparison
+ boolean comparisonResult = false;
+ String rightOperand = null;
+ String leftOperand = null;
+
+ if(firstStyleSheet instanceof StyleSheetReference && secondStyleSheet instanceof StyleSheetReference) {
+
+ // Get both compared reference path
+ rightOperand = ((StyleSheetReference)firstStyleSheet).getPath();
+ leftOperand = ((StyleSheetReference)secondStyleSheet).getPath();
+
+ // Use standard string comparison
+ comparisonResult = rightOperand.equals(leftOperand);
+
+ } else if(firstStyleSheet instanceof EmbeddedStyleSheet && secondStyleSheet instanceof EmbeddedStyleSheet) {
+
+ // Get both of compared embedded label
+ rightOperand = ((EmbeddedStyleSheet)firstStyleSheet).getLabel();
+ leftOperand = ((EmbeddedStyleSheet)secondStyleSheet).getLabel();
+
+ // Use standard string comparison
+ comparisonResult = rightOperand.equals(leftOperand);
+ }
+
+ // Final comparison value
+ int comparisonValue = -1;
+ if(comparisonResult) {
+ comparisonValue = 0;
+ }
+
+ return comparisonValue;
+ }
+
+
+
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/IDynamicFieldEditor.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/IDynamicFieldEditor.java
new file mode 100644
index 0000000..6e5def4
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/IDynamicFieldEditor.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.fieldeditor;
+
+
+/**
+ * Interface for dynamic field editor. Standard field editors don't permit to update its input or set current selection.
+ *
+ * @author gpascual
+ */
+public interface IDynamicFieldEditor {
+
+
+ /**
+ * Set input to field editor.
+ *
+ * @param input
+ * New value of field editor input
+ */
+ void setInput(Object input);
+
+ /**
+ * Set current selection to field editor.
+ *
+ * @param selectedValue
+ * Value of selected element
+ *
+ */
+ void setSelection(String selectedValue);
+
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java
new file mode 100644
index 0000000..76d8e95
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/fieldeditor/InputComboFieldEditor.java
@@ -0,0 +1,279 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.fieldeditor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Implementation of dynamic combo field editor. Add {@link IDynamicFieldEditor} interface behavior to standard combo field editor.
+ *
+ * @see org.eclipse.jface.preference.ComboFieldEditor
+ *
+ * @author gpascual
+ *
+ */
+public class InputComboFieldEditor extends FieldEditor implements IDynamicFieldEditor {
+
+ /**
+ * The <code>Combo</code> widget.
+ */
+ private Combo combo = null;
+
+ /**
+ * The value (not the name) of the currently selected item in the Combo widget.
+ */
+ private String value = null;
+
+ /**
+ * The names (labels) and underlying values to populate the combo widget. These should be
+ * arranged as: { {name1, value1}, {name2, value2}, ...}
+ */
+ private String[][] fEntryNamesAndValues = null;
+
+ /**
+ * Create the combo box field editor.
+ *
+ * @param name
+ * the name of the preference this field editor works on
+ * @param labelText
+ * the label text of the field editor
+ * @param entryNamesAndValues
+ * the names (labels) and underlying values to populate the combo widget. These should be
+ * arranged as: { {name1, value1}, {name2, value2}, ...}
+ * @param parent
+ * the parent composite
+ */
+ public InputComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent) {
+ init(name, labelText);
+ Assert.isTrue(checkArray(entryNamesAndValues));
+ fEntryNamesAndValues = entryNamesAndValues;
+ createControl(parent);
+ }
+
+ /**
+ * Checks whether given <code>String[][]</code> is of "type" <code>String[][2]</code>.
+ *
+ * @return <code>true</code> if it is ok, and <code>false</code> otherwise
+ */
+ private boolean checkArray(String[][] table) {
+ if(table == null) {
+ return false;
+ }
+ for(int i = 0; i < table.length; i++) {
+ String[] array = table[i];
+ if(array == null || array.length != 2) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
+ */
+ @Override
+ protected void adjustForNumColumns(int numColumns) {
+ if(numColumns > 1) {
+ Control control = getLabelControl();
+ int left = numColumns;
+ if(control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ left = left - 1;
+ }
+ ((GridData)combo.getLayoutData()).horizontalSpan = left;
+ } else {
+ Control control = getLabelControl();
+ if(control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ }
+ ((GridData)combo.getLayoutData()).horizontalSpan = 1;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
+ */
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ int comboC = 1;
+ if(numColumns > 1) {
+ comboC = numColumns - 1;
+ }
+ Control control = getLabelControl(parent);
+ GridData gd = new GridData();
+ gd.horizontalSpan = 1;
+ control.setLayoutData(gd);
+ control = getComboBoxControl(parent);
+ gd = new GridData();
+ gd.horizontalSpan = comboC;
+ gd.horizontalAlignment = GridData.FILL;
+ control.setLayoutData(gd);
+ control.setFont(parent.getFont());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#doLoad()
+ */
+ @Override
+ protected void doLoad() {
+ updateComboForValue(getPreferenceStore().getString(getPreferenceName()));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
+ */
+ @Override
+ protected void doLoadDefault() {
+ updateComboForValue(getPreferenceStore().getDefaultString(getPreferenceName()));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#doStore()
+ */
+ @Override
+ protected void doStore() {
+ if(value == null) {
+ getPreferenceStore().setToDefault(getPreferenceName());
+ return;
+ }
+ getPreferenceStore().setValue(getPreferenceName(), value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ /*
+ * Lazily create and return the Combo control.
+ */
+ private Combo getComboBoxControl(Composite parent) {
+ if(combo == null) {
+ combo = new Combo(parent, SWT.READ_ONLY);
+ combo.setFont(parent.getFont());
+ for(int i = 0; i < fEntryNamesAndValues.length; i++) {
+ combo.add(fEntryNamesAndValues[i][0], i);
+ }
+
+ combo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent evt) {
+ String oldValue = value;
+ String name = combo.getText();
+ value = getValueForName(name);
+ setPresentsDefaultValue(false);
+ fireValueChanged(VALUE, oldValue, value);
+ }
+ });
+ }
+ return combo;
+ }
+
+ /*
+ * Given the name (label) of an entry, return the corresponding value.
+ */
+ private String getValueForName(String name) {
+ for(int i = 0; i < fEntryNamesAndValues.length; i++) {
+ String[] entry = fEntryNamesAndValues[i];
+ if(name.equals(entry[0])) {
+ return entry[1];
+ }
+ }
+ return fEntryNamesAndValues[0][0];
+ }
+
+ /*
+ * Set the name in the combo widget to match the specified value.
+ */
+ private void updateComboForValue(String value) {
+ this.value = value;
+ for(int i = 0; i < fEntryNamesAndValues.length; i++) {
+ if(value.equals(fEntryNamesAndValues[i][1])) {
+ combo.setText(fEntryNamesAndValues[i][0]);
+ return;
+ }
+ }
+ if(fEntryNamesAndValues.length > 0) {
+ value = fEntryNamesAndValues[0][1];
+ combo.setText(fEntryNamesAndValues[0][0]);
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditor#setEnabled(boolean, org.eclipse.swt.widgets.Composite)
+ *
+ * @param enabled
+ * @param parent
+ */
+ @Override
+ public void setEnabled(boolean enabled, Composite parent) {
+ super.setEnabled(enabled, parent);
+ getComboBoxControl(parent).setEnabled(enabled);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.properties.fieldeditor.IDynamicFieldEditor#setInput(java.lang.Object)
+ *
+ * @param input
+ */
+ public void setInput(Object input) {
+
+ if(input.getClass().equals(fEntryNamesAndValues.getClass())) {
+ fEntryNamesAndValues = (String[][])input;
+ }
+
+ combo.removeAll();
+ for(int i = 0; i < fEntryNamesAndValues.length; i++) {
+ combo.add(fEntryNamesAndValues[i][0], i);
+ }
+
+ doLoad();
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.properties.fieldeditor.IDynamicFieldEditor#setSelection(java.lang.String)
+ *
+ * @param newValue
+ */
+ public void setSelection(String newValue) {
+ String oldValue = this.value;
+ updateComboForValue(newValue);
+ fireValueChanged(VALUE, oldValue, newValue);
+
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java
new file mode 100644
index 0000000..482a080
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/handler/CSSFileHandler.java
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.gmfdiag.css.helper.WorkspaceThemesHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.dialog.CSSThemeCreationDialog;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.dialog.CSSThemeEditionDialog;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
+import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+/**
+ *
+ * Handler to define a CSS style sheet file as local theme.
+ *
+ * @author gpascual
+ *
+ */
+public class CSSFileHandler extends AbstractHandler implements IHandler {
+
+ /** ID of command to edit existing theme. */
+ private static final String THEME_EDIT_COMMAND_ID = "org.eclipse.papyrus.infra.gmfdiag.css.theme.edit"; //$NON-NLS-1$
+
+ /** ID of command to define theme. */
+ private static final String THEME_DEFINE_COMMAND_ID = "org.eclipse.papyrus.infra.gmfdiag.css.theme.define"; //$NON-NLS-1$
+
+ /** */
+ private WorkspaceThemesHelper cssHelper = new WorkspaceThemesHelper();
+
+ /**
+ * Default constructor.
+ *
+ */
+ public CSSFileHandler() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ Theme theme = null;
+ int dialogResult = -1;
+
+
+ // Get current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // Get selected file from selection
+ if(selection instanceof IStructuredSelection) {
+
+ // Get executed command ID
+ String commandID = event.getCommand().getId();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+ if(THEME_DEFINE_COMMAND_ID.equals(commandID)) {
+
+ // Get theme initialise with slected elements
+ theme = cssHelper.defineCSSStyleSheetFilesAsTheme((IStructuredSelection)selection);
+ // Open a specific dialog to define theme according to selection
+ Dialog dialog = new CSSThemeCreationDialog(shell, theme);
+ dialogResult = dialog.open();
+
+
+ } else if(THEME_EDIT_COMMAND_ID.equals(commandID)) {
+ IPath workspaceThemesFilePath = cssHelper.getThemeWorkspacePreferenceFilePath();
+
+ WorkspaceThemes workspaceThemes = null;
+ if(workspaceThemesFilePath.toFile().exists()) {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource = resourceSet.getResource(URI.createFileURI(workspaceThemesFilePath.toOSString()), true);
+ workspaceThemes = (WorkspaceThemes)EcoreUtil.getObjectByType(resource.getContents(), StylesheetsPackage.Literals.WORKSPACE_THEMES);
+ }
+
+ // Open a specific dialog to edit existing theme according to selection
+ CSSThemeEditionDialog dialog = new CSSThemeEditionDialog(shell, workspaceThemes, (IStructuredSelection)selection);
+ dialogResult = dialog.open();
+
+ theme = dialog.getEditedTheme();
+
+
+
+ }
+
+ // Save and reload themes list only if user has validated
+ if(dialogResult == Dialog.OK) {
+
+ if(THEME_DEFINE_COMMAND_ID.equals(commandID)) {
+ cssHelper.saveNewThemeWorkspacePreference(theme);
+ } else if(THEME_EDIT_COMMAND_ID.equals(commandID)) {
+ cssHelper.saveWorkspaceThemesPreferenceResource(theme);
+ }
+
+ ThemeManager.instance.reloadThemes();
+ }
+
+ }
+
+
+ return null;
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElement.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElement.java
new file mode 100644
index 0000000..6d54d28
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElement.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.provider.CSSStyleSheetLabelProvider;
+import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+
+
+/**
+ * Theme ModelElement to provide corresponding label provider because EMF model
+ * is not register in service registry.
+ *
+ * @author gpascual
+ *
+ */
+public class CSSThemesModelElement extends EMFModelElement implements ModelElement {
+
+ /** UI view path for theme style sheets. */
+ private static final String THEME_STYLESHEETS_PATH = "stylesheets"; //$NON-NLS-1$
+
+ /**
+ * Default constructor.
+ *
+ * @param source
+ * @param domain
+ */
+ public CSSThemesModelElement(EObject source, EditingDomain domain) {
+ super(source, domain);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.views.properties.modelelement.EMFModelElement#getLabelProvider(java.lang.String)
+ *
+ * @param propertyPath
+ * @return
+ */
+ @Override
+ public ILabelProvider getLabelProvider(String propertyPath) {
+
+ ILabelProvider labelProvider = null;
+
+
+ if(THEME_STYLESHEETS_PATH.equals(propertyPath)) {
+ labelProvider = new CSSStyleSheetLabelProvider();
+ }
+
+ // If label provider was not instantiated, we use this ancestor one
+ if(labelProvider == null) {
+ labelProvider = super.getLabelProvider(propertyPath);
+ }
+
+ return labelProvider;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElementFactory.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElementFactory.java
new file mode 100644
index 0000000..ade28c5
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSThemesModelElementFactory.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.views.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;
+
+
+/**
+ * Themes ModelElement factory to provide label provider because
+ * CSS EMF model is not in Service registry.
+ *
+ * @author gpascual
+ *
+ */
+public class CSSThemesModelElementFactory implements ModelElementFactory {
+
+
+ /**
+ * Default constructor.
+ *
+ */
+ public CSSThemesModelElementFactory() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory#createFromSource(java.lang.Object,
+ * org.eclipse.papyrus.views.properties.contexts.DataContextElement)
+ *
+ * @param sourceElement
+ * @param context
+ * @return
+ */
+ public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
+
+ EObject source = EMFHelper.getEObject(sourceElement);
+ if(source == null) {
+ Activator.log.warn("Unable to resolve the selected element to an EObject"); //$NON-NLS-1$
+ return null;
+ }
+
+ EditingDomain domain = EMFHelper.resolveEditingDomain(source);
+
+ // Create CSS themes ModelElement
+ return new CSSThemesModelElement(source, domain);
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/preferences/ThemePreferencesPage.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/preferences/ThemePreferencesPage.java
new file mode 100644
index 0000000..bb1dcb5
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/preferences/ThemePreferencesPage.java
@@ -0,0 +1,1134 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.preferences;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.engine.WorkspaceCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferences;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.creation.ThemePropertyEditorFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.fieldeditor.IDynamicFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.fieldeditor.InputComboFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.CollectionContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
+import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+import org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * A Preference page for selecting the Workspace CSS Theme
+ *
+ * @author Camille Letavernier
+ */
+public class ThemePreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ /** Title for icon selection dialog. */
+ private static final String ICON_SELECTION_DIALOG_TITLE = "Icon selection";
+
+ /** Label for workspace menu. */
+ private static final String WORKSPACE_MENU_LABEL = "Workspace";
+
+ /** Label for file system menu. */
+ private static final String FILE_SYSTEM_MENU_LABEL = "File System";
+
+ /** Id of workspace menu item. */
+ private static final int WORKSPACE_MENU_ID = 12;
+
+ /** Id of file system menu item. */
+ private static final int FILESYSTEM_MENU_ID = 25;
+
+ /** Label of theme field editor. */
+ private static final String CURRENT_THEME_FIELD_LABEL = "Current theme:";
+
+ /** Title of preference page. */
+ private static final String PAGE_TITLE = "CSS Theme";
+
+ /** Id of delete theme button. */
+ private static final int DELETE_THEME_BUTTON_ID = 46;
+
+ /** Id of new button. */
+ private static final int NEW_THEME_BUTTON_ID = 45;
+
+ /** Id of edit button. */
+ private static final int EDIT_BUTTON_ID = 19;
+
+ /** Id of down button. */
+ private static final int DOWN_BUTTON_ID = 18;
+
+ /** Id of up button. */
+ private static final int UP_BUTTON_ID = 17;
+
+ /** ID of delete button. */
+ private static final int DELETE_BUTTON_ID = 15;
+
+ /** ID of add button. */
+ private static final int ADD_BUTTON_ID = 14;
+
+ /** ID of browse buton. */
+ private static final int BROWSE_BUTTON_ID = 16;
+
+ /** Title for add action dialog. */
+ private static final String ADD_DIALOG_TITLE = "Style sheets selection";
+
+ private static final Image EDIT_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Edit_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for delete action button. */
+ private static final Image DELETE_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Delete_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for add action button. */
+ private static final Image ADD_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Add_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for up action button. */
+ private static final Image UP_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Up_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Icon for down action button. */
+ private static final Image DOWN_ICON = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "icons/Down_12x12.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** Text for style sheets list label. */
+ private static final String STYLE_SHEETS_LABEL = "Style sheets";
+
+ /** Text for browse button. */
+ private static final String BROWSE_BUTTON_LABEL = "Browse...";
+
+ /** Text for theme icon label. */
+ private static final String THEME_ICON_LABEL = "Icon";
+
+ /** Text for theme name label. */
+ private static final String THEME_NAME_LABEL = "Label";
+
+ /** List of valid extensions for an icon. */
+ private List<String> filterExtensions = Arrays.asList(new String[]{ "*.gif;*.png;*.jpeg", "*.gif", "*.png", "*.jpeg" });
+
+ /** List of name associated to valid extensions. */
+ private List<String> filterNames = Arrays.asList(new String[]{ "All images", "GIF Icon", "PNG Icon", "JPEG Icon" });
+
+ /** Flag to define if refresh must be done. */
+ public boolean needsRefresh = false;
+
+ /** Main composite of preference page. */
+ private Composite mainContainer = null;
+
+ /** Field for label of theme. */
+ private Text themeLabelField = null;
+
+ /** Current selected theme. */
+ protected Theme currentTheme = null;
+
+ /** Field for icon path of theme. */
+ private Text iconPathfield = null;
+
+ /** Viewer for style sheets of current theme. */
+ private TreeViewer themeStyleSheetsViewer = null;
+
+ /** Label provider for treeviewer. */
+ private LabelProvider labelProvider = null;
+
+ /** Dynamic combo editor for select theme preference. */
+ private IDynamicFieldEditor themesCombo = null;
+
+ /** Array of all id's buttons which were added in dialog. */
+ private Map<Integer, Button> buttonsMap = new HashMap<Integer, Button>();
+
+ /** Editor factory for theme. */
+ private EcorePropertyEditorFactory editorFactory = new ThemePropertyEditorFactory(StylesheetsPackage.Literals.WORKSPACE_THEMES__THEMES);
+
+ /** Menu of icon browse button. */
+ private Menu browseMenu = null;
+
+
+ /**
+ *
+ * Default constructor.
+ *
+ */
+ public ThemePreferencesPage() {
+ super(PAGE_TITLE, org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor("/icons/papyrus.png"), FieldEditorPreferencePage.GRID);
+ initialiseFilterLabels(filterNames, filterExtensions);
+ }
+
+ /**
+ * Gets the filter labels.
+ *
+ * @param filterNames
+ * the filter names
+ * @param filterExtensions
+ * the filter extensions
+ */
+ private void initialiseFilterLabels(List<String> filterNames, List<String> filterExtensions) {
+ int size = Math.min(filterNames.size(), filterExtensions.size());
+ String[] filters = new String[size];
+
+ for(int i = 0; i < size; i++) {
+ filters[i] = filterNames.get(i) + " (" + filterExtensions.get(i) + ")";
+ }
+
+ this.filterNames = Arrays.asList(filters);
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ *
+ * @param workbench
+ */
+ public void init(IWorkbench workbench) {
+
+ //Used default preference store to save current theme
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+
+ // Set description for page
+ setDescription("Papyrus Theme preferences");
+ }
+
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * @return
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+
+ // Create principal layout
+ mainContainer = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ mainContainer.setLayout(layout);
+ mainContainer.setFont(parent.getFont());
+
+ // Populate preference page
+ createPreferenceThemePart(mainContainer);
+ createThemeLabelPart(mainContainer);
+ createThemeIconPart(mainContainer);
+ createTreeActionButtons(mainContainer);
+ createThemeStyleSheetsPart(mainContainer);
+
+ // Initialize step
+ initialize();
+ checkState();
+
+
+ return mainContainer;
+ }
+
+ /**
+ * Create part of page to select, add and remove theme.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createPreferenceThemePart(Composite parent) {
+
+ // Add theme field editor
+ createFieldEditors();
+ Composite buttonsPanel = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ buttonsPanel.setLayout(layout);
+ buttonsPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+ // Add buttons to delete and add theme
+ createButton(buttonsPanel, NEW_THEME_BUTTON_ID, ADD_ICON, null);
+ createButton(buttonsPanel, DELETE_THEME_BUTTON_ID, DELETE_ICON, null);
+
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ *
+ */
+ @Override
+ protected void createFieldEditors() {
+ //Get all themes define in application instance
+ String[][] themes = getFieldThemes();
+
+ themesCombo = new InputComboFieldEditor(ThemePreferences.CURRENT_THEME, CURRENT_THEME_FIELD_LABEL, themes, mainContainer);
+
+
+ addField((FieldEditor)themesCombo);
+
+
+ }
+
+ /**
+ * Create theme label composite.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createThemeLabelPart(Composite parent) {
+
+ // Create label for label field
+ Label themeNameLabel = new Label(parent, SWT.NONE);
+ themeNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ themeNameLabel.setText(THEME_NAME_LABEL);
+
+ // Add theme label field
+ themeLabelField = new Text(parent, SWT.BORDER);
+ GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
+ themeLabelField.setLayoutData(gd_text);
+
+ themeLabelField.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ currentTheme.setLabel(themeLabelField.getText());
+ }
+
+
+ });
+ }
+
+
+ /**
+ * Create theme icon part.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createThemeIconPart(Composite parent) {
+ Label iconLabel = new Label(parent, SWT.NONE);
+ iconLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ iconLabel.setText(THEME_ICON_LABEL);
+
+ iconPathfield = new Text(parent, SWT.BORDER);
+ iconPathfield.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ iconPathfield.addModifyListener(new ModifyListener() {
+
+
+ public void modifyText(ModifyEvent e) {
+ currentTheme.setIcon(iconPathfield.getText());
+
+ }
+ });
+
+ // Create browse button and its menu
+ Button browseButton = createButton(parent, BROWSE_BUTTON_ID, null, BROWSE_BUTTON_LABEL);
+ browseMenu = new Menu(browseButton);
+ createMenuItem(browseMenu, FILE_SYSTEM_MENU_LABEL, FILESYSTEM_MENU_ID);
+ createMenuItem(browseMenu, WORKSPACE_MENU_LABEL, WORKSPACE_MENU_ID);
+ }
+
+ /**
+ * Create menu item.
+ *
+ * @param parentMenu
+ * Menu where it will be added
+ * @param label
+ * Label of menu item
+ * @param menuId
+ */
+ private void createMenuItem(Menu parentMenu, String label, int menuId) {
+
+ MenuItem menuItem = new MenuItem(parentMenu, SWT.NONE);
+ menuItem.setText(label);
+ menuItem.setData(new Integer(menuId));
+ menuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ menuSelected(((Integer)e.widget.getData()).intValue());
+ }
+ });
+
+
+ }
+
+ /**
+ * Action to run when a menu is slected.
+ *
+ * @param menuId
+ * ID of selected menu
+ */
+ private void menuSelected(int menuId) {
+ switch(menuId) {
+ case WORKSPACE_MENU_ID:
+ browseWorkspace();
+ break;
+ case FILESYSTEM_MENU_ID:
+ browseFileSytem();
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+ }
+
+ /**
+ * Browse file in file system.
+ */
+ private void browseFileSytem() {
+ File file = getFile(iconPathfield.getText());
+
+ FileDialog dialog = new FileDialog(getShell());
+ dialog.setText(ICON_SELECTION_DIALOG_TITLE);
+
+ dialog.setFileName(file.getAbsolutePath());
+ dialog.setFilterExtensions(filterExtensions.toArray(new String[filterExtensions.size()]));
+ dialog.setFilterNames(filterNames.toArray(new String[filterNames.size()]));
+ String result = dialog.open();
+ if(result == null) { //Cancel
+ return;
+ }
+ setResult(result);
+ }
+
+ /**
+ * Browse file in workspace.
+ */
+ private void browseWorkspace() {
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ ILabelProvider labelProvider = labelProviderService.getLabelProvider();
+
+ IFile currentFile = getIFile(iconPathfield.getText());
+
+ TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
+ dialog.setTitle(ICON_SELECTION_DIALOG_TITLE);
+
+
+ WorkspaceContentProvider contentProvider = new WorkspaceContentProvider();
+
+
+ if(!(filterExtensions.isEmpty() || filterNames.isEmpty())) {
+ //The filters have been defined
+ contentProvider.setExtensionFilters(new LinkedHashMap<String, String>()); //Reset the default filters
+
+ //Use our own filters
+ for(int i = 0; i < Math.min(filterNames.size(), filterExtensions.size()); i++) {
+ contentProvider.addExtensionFilter(filterExtensions.get(i), filterNames.get(i));
+ }
+ }
+
+ dialog.setContentProvider(contentProvider);
+ dialog.setLabelProvider(labelProvider);
+
+
+ if(currentFile != null && currentFile.exists()) {
+ dialog.setInitialSelections(new IFile[]{ currentFile });
+ }
+
+ int code = dialog.open();
+ if(code == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ Object file = result[0];
+ if(file instanceof IFile) {
+ setResult((IFile)file);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(IFile file) {
+ iconPathfield.setText(file.getFullPath().toString());
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(File file) {
+ iconPathfield.setText(file.getAbsolutePath());
+
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param path
+ * the new result
+ */
+ protected void setResult(String path) {
+ iconPathfield.setText(path);
+
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the i file
+ */
+ protected IFile getIFile(String path) {
+ return FileUtil.getIFile(path);
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the file
+ */
+ protected File getFile(String path) {
+ return FileUtil.getFile(path);
+ }
+
+ /**
+ * Create theme style sheets part.
+ *
+ * @param parent
+ * Parent composite where components will be added
+ */
+ private void createThemeStyleSheetsPart(Composite parent) {
+
+ // Create viewer
+ themeStyleSheetsViewer = new TreeViewer(parent, SWT.BORDER);
+
+ // Set standard collection content provider
+ themeStyleSheetsViewer.setContentProvider(CollectionContentProvider.instance);
+
+ labelProvider = new LabelProvider() {
+
+ /**
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+
+ // Use ancestor result as default
+ String text = super.getText(element);
+
+ // Display path of style sheet reference
+ if(element instanceof StyleSheetReference) {
+ text = ((StyleSheetReference)element).getPath();
+ } else if(element instanceof EmbeddedStyleSheet) {
+ text = ((EmbeddedStyleSheet)element).getLabel();
+ }
+
+ return text;
+ }
+ };
+ themeStyleSheetsViewer.setLabelProvider(labelProvider);
+
+ // Set layout
+ Tree tree = themeStyleSheetsViewer.getTree();
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
+
+
+ }
+
+
+ /**
+ * Create actions associate to tree viewer.
+ *
+ * @param parent
+ * Composite where action buttons will be added
+ */
+ private void createTreeActionButtons(Composite parent) {
+ Label labelViewer = new Label(parent, SWT.NONE);
+ labelViewer.setText(STYLE_SHEETS_LABEL);
+
+ Composite buttonsPanel = new Composite(parent, SWT.NONE);
+ buttonsPanel.setLayout(new GridLayout());
+ buttonsPanel.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false, 2, 1));
+
+ createButton(buttonsPanel, ADD_BUTTON_ID, ADD_ICON, null);
+ createButton(buttonsPanel, DELETE_BUTTON_ID, DELETE_ICON, null);
+ createButton(buttonsPanel, UP_BUTTON_ID, UP_ICON, null);
+ createButton(buttonsPanel, DOWN_BUTTON_ID, DOWN_ICON, null);
+ createButton(buttonsPanel, EDIT_BUTTON_ID, EDIT_ICON, null);
+
+ }
+
+ /**
+ * Override method to create a button with an icon and no label.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createButton(Composite, int, String, boolean)
+ *
+ * @param parent
+ * @param id
+ * @param icon
+ * @return
+ */
+ protected Button createButton(Composite parent, int id, Image icon, String label) {
+ ((GridLayout)parent.getLayout()).numColumns++;
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(JFaceResources.getDialogFont());
+ button.setData(new Integer(id));
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ buttonPressed(((Integer)event.widget.getData()).intValue());
+ }
+ });
+
+ if(label != null) {
+ button.setText(label);
+ }
+ if(icon != null) {
+ button.setImage(icon);
+ }
+ buttonsMap.put(new Integer(id), button);
+ setButtonLayoutData(button);
+ return button;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ *
+ * @param buttonId
+ */
+ protected void buttonPressed(int buttonId) {
+ switch(buttonId) {
+ case ADD_BUTTON_ID:
+ addAction();
+ break;
+ case DELETE_BUTTON_ID:
+ deleteAction();
+ break;
+ case BROWSE_BUTTON_ID:
+ browseMenu.setVisible(true);
+ break;
+ case UP_BUTTON_ID:
+ upAction();
+ break;
+ case DOWN_BUTTON_ID:
+ downAction();
+ break;
+ case EDIT_BUTTON_ID:
+ editAction();
+ break;
+ case NEW_THEME_BUTTON_ID:
+ addThemeAction();
+ break;
+ case DELETE_THEME_BUTTON_ID:
+ deleteThemeAction();
+ break;
+ default:
+ //Nothing to do
+ }
+ }
+
+
+ /**
+ * Delete current selection of tree viewer.
+ */
+ private void deleteAction() {
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedElement instanceof StyleSheet) {
+ currentTheme.getStylesheets().remove(selectedElement);
+ }
+
+ themeStyleSheetsViewer.setInput(currentTheme.getStylesheets());
+ refreshTreeviewer(currentTheme);
+ }
+
+ }
+
+
+ /**
+ * Open a dialog to add a style sheet to current selected theme.
+ */
+ private void addAction() {
+
+
+ ReferenceSelector selector = new ReferenceSelector(true);
+ selector.setContentProvider(new EMFContentProvider(currentTheme, StylesheetsPackage.eINSTANCE.getTheme_Stylesheets()) {
+
+ @Override
+ protected IStructuredContentProvider getSemanticProvider(final EObject editedEObject, final EStructuralFeature feature) {
+
+ // Use a standard content provider
+ return new AbstractStaticContentProvider() {
+
+ public Object[] getElements() {
+ List<Object> result = new LinkedList<Object>();
+ if(editedEObject instanceof Theme) {
+ result.addAll(currentTheme.getStylesheets());
+ }
+ return result.toArray();
+ }
+ };
+ }
+ });
+ selector.setLabelProvider(labelProvider);
+
+ // Use common component for add dialog and parameterize it
+ MultipleValueSelectorDialog vDialog = new MultipleValueSelectorDialog(getShell(), selector, ADD_DIALOG_TITLE);
+ vDialog.setContextElement(currentTheme);
+ vDialog.setLabelProvider(labelProvider);
+ vDialog.setFactory(new EcorePropertyEditorFactory(StylesheetsPackage.Literals.THEME__STYLESHEETS));
+
+ // Handle dialog result
+ int result = vDialog.open();
+ if(result == Dialog.OK) {
+
+ Object[] resultArray = vDialog.getResult();
+ refreshStyleSheets(resultArray);
+
+ }
+
+ }
+
+
+ /**
+ * Fill style sheets viewer with selected style sheets.
+ *
+ * @param result
+ * Result from dialog selection
+ */
+ private void refreshStyleSheets(Object[] result) {
+
+ // Complete current theme with dialog result
+ for(Object object : result) {
+
+ // Check if this is a style sheet
+ if(object instanceof StyleSheet)
+ currentTheme.getStylesheets().add((StyleSheet)object);
+ }
+
+ needsRefresh = true;
+
+ refreshTreeviewer(currentTheme);
+ }
+
+ /**
+ * Refresh content of tree viewer according to selected theme/
+ *
+ * @param currentTheme
+ * Current theme
+ */
+ private void refreshTreeviewer(Theme currentTheme) {
+
+
+ boolean isEditatble = ThemeManager.instance.isEditable(currentTheme.getId());
+
+ EList<StyleSheet> themeStyleSheetsList = currentTheme.getStylesheets();
+
+
+ // Set mirroring list as viewer input
+ themeStyleSheetsViewer.getTree().setEnabled(isEditatble);
+ themeStyleSheetsViewer.setInput(themeStyleSheetsList);
+
+
+ updateButtons(currentTheme);
+
+ }
+
+
+ /**
+ * Move up the selected style sheet in list.
+ */
+ private void upAction() {
+
+ // Handle selection to extract selected style sheet
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+
+ if(selectedElement instanceof StyleSheet) {
+
+ // Get index of selected style sheet in list
+ EList<StyleSheet> stylesheetsList = currentTheme.getStylesheets();
+ int index = stylesheetsList.indexOf(selectedElement);
+
+ // Check if selected style sheet is not at top of list
+ if(index > 0) {
+ stylesheetsList.move(--index, (StyleSheet)selectedElement);
+ themeStyleSheetsViewer.setInput(stylesheetsList);
+ }
+
+ needsRefresh = true;
+ }
+ }
+ }
+
+ /**
+ * Move down the selected style sheet in list.
+ */
+ private void downAction() {
+
+ // Handle selection to extract selected style sheet
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
+
+ if(selectedElement instanceof StyleSheet) {
+
+ // Get index of selected style sheet in list
+ EList<StyleSheet> stylesheetsList = currentTheme.getStylesheets();
+ int index = stylesheetsList.indexOf(selectedElement);
+
+ // Check if selected style sheet is not at bottom of list
+ if(index < stylesheetsList.size() - 1) {
+ stylesheetsList.move(++index, (StyleSheet)selectedElement);
+ themeStyleSheetsViewer.setInput(stylesheetsList);
+ }
+
+ needsRefresh = true;
+ }
+ }
+ }
+
+
+ /**
+ * Edit action on selected style sheet in tree viewer.
+ */
+ private void editAction() {
+
+ ISelection selection = themeStyleSheetsViewer.getSelection();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedObject instanceof StyleSheet) {
+ // Use editor factory
+ editorFactory.edit(buttonsMap.get(EDIT_BUTTON_ID), selectedObject);
+ needsRefresh = true;
+ }
+ }
+
+
+ }
+
+ /**
+ * Create a theme.
+ */
+ private void addThemeAction() {
+
+ ThemeManager themeManager = ThemeManager.instance;
+ Object createdObject = editorFactory.createObject(buttonsMap.get(NEW_THEME_BUTTON_ID), themeManager.getWorkspaceThemesPreferences());
+
+ if(createdObject instanceof Theme) {
+
+ themeManager.addTemporaryTheme((Theme)createdObject);
+ currentTheme = (Theme)createdObject;
+
+ themesCombo.setInput(getFieldThemes());
+ themesCombo.setSelection(((Theme)createdObject).getId());
+
+ }
+ }
+
+ /**
+ * Delete selected theme.
+ */
+ private void deleteThemeAction() {
+ boolean confirm = MessageDialog.openConfirm(getShell(), "Delete CSS theme", "WARNING! Deletion will be difinitive.\nDo you really want to delete this theme ?");
+ if(confirm) {
+ ThemeManager themeManager = ThemeManager.instance;
+ themeManager.delete(currentTheme);
+ String[][] fieldThemes = getFieldThemes();
+ themesCombo.setInput(fieldThemes);
+ currentTheme = themeManager.getTheme(fieldThemes[0][1]);
+ themesCombo.setSelection(currentTheme.getId());
+ }
+
+ }
+
+ /**
+ *
+ * Update state of dialog buttons.
+ *
+ * @param currentTheme
+ * Selected theme which determine state of different buttons.
+ */
+ private void updateButtons(Theme currentTheme) {
+ boolean editionEnable = ThemeManager.instance.isEditable(currentTheme.getId());
+
+ for(int buttonId : buttonsMap.keySet()) {
+ switch(buttonId) {
+ case ADD_BUTTON_ID:
+ case BROWSE_BUTTON_ID:
+ buttonsMap.get(buttonId).setEnabled(editionEnable);
+ break;
+ case DELETE_BUTTON_ID:
+ case EDIT_BUTTON_ID:
+ buttonsMap.get(buttonId).setEnabled(editionEnable && !currentTheme.getStylesheets().isEmpty());
+ break;
+ case UP_BUTTON_ID:
+ case DOWN_BUTTON_ID:
+ buttonsMap.get(buttonId).setEnabled(editionEnable && (currentTheme.getStylesheets().size() > 1));
+ case DELETE_THEME_BUTTON_ID:
+ buttonsMap.get(buttonId).setEnabled(ThemeManager.instance.isEditable(currentTheme.getId()));
+ default:
+ break;
+ }
+
+ }
+ }
+
+
+ /**
+ * @see org.eclipse.jface.dialogs.DialogPage#setButtonLayoutData(org.eclipse.swt.widgets.Button)
+ *
+ * @param button
+ * @return
+ */
+ @Override
+ protected GridData setButtonLayoutData(Button button) {
+ GridData layoutData = null;
+
+ // Determine id of button
+ Object data = button.getData();
+ int buttonId = -1;
+ if(data instanceof Integer) {
+ buttonId = (Integer)data;
+ }
+
+ //Filter specific button to set data layout
+ switch(buttonId) {
+ case ADD_BUTTON_ID:
+ case DELETE_BUTTON_ID:
+ case UP_BUTTON_ID:
+ case DOWN_BUTTON_ID:
+ case EDIT_BUTTON_ID:
+ case DELETE_THEME_BUTTON_ID:
+ case NEW_THEME_BUTTON_ID:
+ layoutData = new GridData(SWT.FILL, SWT.FILL, false, false);
+ button.setLayoutData(layoutData);
+ break;
+ default:
+ layoutData = super.setButtonLayoutData(button);
+ break;
+ }
+
+ return layoutData;
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ *
+ * @param event
+ */
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+ if(ThemePreferences.CURRENT_THEME.equals(event.getProperty())) {
+ needsRefresh = true;
+ }
+ if(FieldEditor.VALUE.equals(event.getProperty())) {
+ FieldEditor fieldEditor = (FieldEditor)event.getSource();
+ if(ThemePreferences.CURRENT_THEME.equals(fieldEditor.getPreferenceName())) {
+
+ Object newValue = event.getNewValue();
+ ThemeManager themeManager = ThemeManager.instance;
+
+ currentTheme = themeManager.getTheme(String.valueOf(newValue));
+ refreshPreferencePage();
+
+ }
+ }
+ }
+
+ /**
+ * Refresh dialog area according to combo selection.
+ *
+ * @param selection
+ * selection which comes from combo viewer
+ */
+ protected void refreshPreferencePage() {
+
+ // Refresh text field (label, icon path, ...)
+ String themeLabel = currentTheme.getLabel();
+ boolean editableTheme = ThemeManager.instance.isEditable(currentTheme.getId());
+ needsRefresh = true;
+
+ if(themeLabel == null) {
+ themeLabel = "";
+ }
+ themeLabelField.setEnabled(editableTheme);
+ themeLabelField.setText(themeLabel);
+
+
+ String iconPath = currentTheme.getIcon();
+ if(iconPath == null) {
+ iconPath = "";
+ }
+ iconPathfield.setEnabled(editableTheme);
+ iconPathfield.setText(iconPath);
+
+
+ // Tree viewer
+ refreshTreeviewer(currentTheme);
+
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize()
+ *
+ */
+ @Override
+ protected void initialize() {
+ String prefrenceValue = getPreferenceStore().getString(ThemePreferences.CURRENT_THEME);
+ currentTheme = ThemeManager.instance.getTheme(prefrenceValue);
+ refreshPreferencePage();
+ super.initialize();
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.PreferencePage#performApply()
+ *
+ */
+ @Override
+ protected void performApply() {
+ super.performApply();
+ themesCombo.setInput(getFieldThemes());
+ refreshPreferencePage();
+
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
+ *
+ * @return
+ */
+ @Override
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if(needsRefresh) {
+ WorkspaceCSSEngine.instance.reset();
+ DiagramHelper.setNeedsRefresh();
+ DiagramHelper.refreshDiagrams();
+ }
+
+
+ ThemeManager themeManager = ThemeManager.instance;
+ themeManager.persist();
+ return result;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performCancel()
+ *
+ * @return
+ */
+ @Override
+ public boolean performCancel() {
+ ThemeManager.instance.reloadThemes();
+ ThemeManager.instance.clearTemporaryThemes();
+ ThemeManager.instance.clearDeletedThemes();
+
+ return super.performCancel();
+ }
+
+ @Override
+ protected void performDefaults() {
+ super.performDefaults();
+
+ currentTheme = ThemeManager.instance.getTheme(getPreferenceStore().getDefaultString(ThemePreferences.CURRENT_THEME));
+ refreshPreferencePage();
+ }
+
+
+ /**
+ * @return Formatted themes list for combo field editor
+ */
+ protected String[][] getFieldThemes() {
+
+ // Use a manager to get all theme in application
+ ThemeManager themeManager = ThemeManager.instance;
+ themeManager.refreshThemes();
+ List<Theme> themes = themeManager.getThemes();
+
+ // Build theme list for combo editor
+ String[][] result = new String[themes.size()][2];
+ int i = 0;
+ for(Theme theme : themes) {
+ result[i][0] = theme.getLabel();
+ result[i][1] = theme.getId();
+ i++;
+ }
+
+ return result;
+ }
+
+
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSThemeLabelProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSThemeLabelProvider.java
index 288dba9..72ff342 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSThemeLabelProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/provider/CSSThemeLabelProvider.java
@@ -1,48 +1,51 @@
-/*****************************************************************************
- * 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.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.infra.gmfdiag.css.theme.Theme;
-import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager;
-import org.eclipse.swt.graphics.Image;
-
-
-public class CSSThemeLabelProvider extends LabelProvider {
-
- @Override
- public String getText(Object value) {
- Theme theme = getTheme(value);
- if(theme != null) {
- return theme.getLabel();
- }
- return super.getText(value);
- }
-
- @Override
- public Image getImage(Object value) {
- Theme theme = getTheme(value);
- if(theme != null) {
- return theme.getIcon();
- }
- return super.getImage(value);
- }
-
- protected Theme getTheme(Object value) {
- if(value instanceof String) {
- String themeId = (String)value;
- Theme theme = ThemeManager.instance.getTheme(themeId);
- return theme;
- }
- return null;
- }
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.properties.provider;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager;
+import org.eclipse.swt.graphics.Image;
+
+
+public class CSSThemeLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object value) {
+ Theme theme = getTheme(value);
+ if(theme != null) {
+ return theme.getLabel();
+ }
+ return super.getText(value);
+ }
+
+ @Override
+ public Image getImage(Object value) {
+ Theme theme = getTheme(value);
+ if(theme != null) {
+ Image icon = ThemeManager.instance.getThemeIcon(theme);
+ return icon;
+ }
+ return super.getImage(value);
+ }
+
+ protected Theme getTheme(Object value) {
+ if(value instanceof String) {
+ String themeId = (String)value;
+ Theme theme = ThemeManager.instance.getTheme(themeId);
+ return theme;
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.project b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.project
index 43b7b61..b4c4ad7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.project
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.project
@@ -20,11 +20,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF
index 4790d3e..ccfc4d7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF
@@ -37,7 +37,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.edit.ui,
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0",
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.0.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.0.0"
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.views.properties;bundle-version="1.0.0",
+ org.eclipse.papyrus.views.properties.model;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
@@ -45,7 +47,6 @@ Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.css.Activator
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css;singleton:=
- true
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css;singleton:=true
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/plugin.xml b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/plugin.xml
index 50f07fc..15c4927 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/plugin.xml
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/plugin.xml
@@ -18,15 +18,6 @@
</styleprovider>
</extension>
<extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
- class="org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferencesPage"
- id="org.eclipse.papyrus.infra.gmfdiag.css.theme"
- name="CSS Theme">
- </page>
- </extension>
- <extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferenceInitializer">
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java
index f01dfca..c0c6409 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java
@@ -1,71 +1,97 @@
-/*****************************************************************************
- * 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.engine;
-
-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.papyrus.infra.gmfdiag.css.theme.ThemeManager;
-import org.w3c.dom.Element;
-
-/**
- * A Singleton CSSEngine, handling the CSS stylesheets applied to the whole
- * workspace.
- *
- * This Engine is a child of the BaseCSSEngine.
- *
- * It should not be used directly.
- *
- * @author Camille Letavernier
- *
- * @see DiagramCSSEngine
- */
-@SuppressWarnings("restriction")
-public class WorkspaceCSSEngine extends ExtendedCSSEngineImpl {
-
- private WorkspaceCSSEngine() {
- super(BaseCSSEngine.INSTANCE);
- }
-
- public static ExtendedCSSEngine instance = new WorkspaceCSSEngine();
-
- @Override
- protected void reloadStyleSheets() {
- styleSheetURLs.clear();
- for(URL styleSheetURL : ThemeManager.instance.getWorkspaceStyleSheets()) {
- styleSheetURLs.add(styleSheetURL);
- }
- }
-
- //Unsupported operations. The WorkspaceCSSEngine should never 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();
- }
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.engine;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.e4.ui.css.core.dom.IElementProvider;
+import org.eclipse.e4.ui.css.core.engine.CSSElementContext;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+import org.w3c.dom.Element;
+
+/**
+ * A Singleton CSSEngine, handling the CSS stylesheets applied to the whole
+ * workspace.
+ *
+ * This Engine is a child of the BaseCSSEngine.
+ *
+ * It should not be used directly.
+ *
+ * @author Camille Letavernier
+ *
+ * @see DiagramCSSEngine
+ */
+@SuppressWarnings("restriction")
+public class WorkspaceCSSEngine extends ExtendedCSSEngineImpl {
+
+ private WorkspaceCSSEngine() {
+ super(BaseCSSEngine.INSTANCE);
+ }
+
+ public static ExtendedCSSEngine instance = new WorkspaceCSSEngine();
+
+ @Override
+ protected void reloadStyleSheets() {
+ styleSheetURLs.clear();
+ styleSheets.clear();
+ for(StyleSheet styleSheet : ThemeManager.instance.getWorkspaceStyleSheets()) {
+
+ if(styleSheet instanceof StyleSheetReference) {
+ IFile iFile = FileUtil.getIFile(((StyleSheetReference)styleSheet).getPath());
+ if(iFile != null) {
+ styleSheets.add(styleSheet);
+ } else {
+ try {
+
+ URL styleSheetURL = new URL(((StyleSheetReference)styleSheet).getPath());
+ styleSheetURLs.add(styleSheetURL);
+ } catch (MalformedURLException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ } else {
+ styleSheets.add(styleSheet);
+ }
+
+ }
+ }
+
+ //Unsupported operations. The WorkspaceCSSEngine should never 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/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java
new file mode 100644
index 0000000..73be411
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java
@@ -0,0 +1,302 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.helper;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
+
+
+
+/**
+ * Helper to define a theme from CSS style sheet file.
+ *
+ * @author gpascual
+ *
+ */
+public class WorkspaceThemesHelper {
+
+
+ /**
+ * Default constructor.
+ *
+ */
+ public WorkspaceThemesHelper() {
+ }
+
+ /**
+ * Define a theme from selected files.
+ * <p>
+ * FIXME User could select several CSS files to create a theme
+ * <P>
+ *
+ * @param file
+ */
+ public Theme defineCSSStyleSheetFilesAsTheme(IStructuredSelection selection) {
+ List<IFile> selectedCSSFilesList = new ArrayList<IFile>();
+
+ // Extract file from selection
+ Iterator<?> selectionIterator = selection.iterator();
+
+ while(selectionIterator.hasNext()) {
+ Object next = selectionIterator.next();
+ if(next instanceof IFile) {
+ selectedCSSFilesList.add((IFile)next);
+ }
+ }
+
+ // Create a theme from selected CSS file
+ Theme theme = createThemeFromSelection(selectedCSSFilesList);
+ theme.setId(EcoreUtil.generateUUID());
+
+ return theme;
+
+ }
+
+ /**
+ * Method to persist deleted and edited theme in workspace preference file.
+ *
+ * @param editedThemesArray
+ * Array of edited themes to persist
+ * @param deletedThemesArray
+ * Array of deleted theme to persist
+ */
+ public void saveWorkspaceThemesPreferenceResource(Theme[] editedThemesArray, Theme[] deletedThemesArray) {
+
+ // Get current resource of workspace theme preferences
+ Resource currentThemefile = findThemeFile();
+ WorkspaceThemes workspaceThemes = (WorkspaceThemes)EcoreUtil.getObjectByType(currentThemefile.getContents(), StylesheetsPackage.Literals.WORKSPACE_THEMES);
+
+ // Handle edited themes
+ for(Theme editedTheme : editedThemesArray) {
+ boolean updateResult = updateWorkspaceTheme(editedTheme, workspaceThemes);
+
+ // If update haven't done, theme must be added
+ if(!updateResult) {
+ workspaceThemes.getThemes().add(editedTheme);
+ }
+ }
+
+ // Handle deleted themes
+ for(Theme deletedTheme : deletedThemesArray) {
+ removeWorkspaceTheme(deletedTheme, workspaceThemes);
+ }
+
+ // Save edited preference file
+ saveResource(currentThemefile);
+
+ }
+
+ /**
+ * Method to delete a theme in workspace theme.
+ *
+ * @param deletedTheme
+ * Theme to delete
+ * @param workspaceThemes
+ * Current workspace themes
+ */
+ private void removeWorkspaceTheme(Theme deletedTheme, WorkspaceThemes workspaceThemes) {
+ // Search resource value of edited theme
+ Iterator<Theme> currentThemesIterator = workspaceThemes.getThemes().iterator();
+ Theme themeId = null;
+ boolean found = false;
+
+ while(currentThemesIterator.hasNext() && !found) {
+ themeId = currentThemesIterator.next();
+ found = themeId.getId().equals(deletedTheme.getId());
+ }
+
+ if(found) {
+ // Replace in resource the current value with the edited one and save resource
+ EcoreUtil.remove(workspaceThemes, StylesheetsPackage.eINSTANCE.getWorkspaceThemes_Themes(), themeId);
+ }
+
+
+
+ }
+
+ /**
+ * Replace in current workspace themes resource theme with the edited value.
+ *
+ * @param editedTheme
+ * New theme value
+ */
+ public void saveWorkspaceThemesPreferenceResource(Theme editedTheme) {
+ // Get current resource of workspace theme preferences
+ Resource currentThemefile = findThemeFile();
+ WorkspaceThemes workspaceThemes = (WorkspaceThemes)EcoreUtil.getObjectByType(currentThemefile.getContents(), StylesheetsPackage.Literals.WORKSPACE_THEMES);
+
+ updateWorkspaceTheme(editedTheme, workspaceThemes);
+
+ saveResource(currentThemefile);
+ }
+
+ /**
+ *
+ * Update in current workspace themes resource the theme with the edited one.
+ *
+ * @param editedTheme
+ * Theme with new value
+ * @param workspaceThemes
+ * workspace themes
+ */
+ private boolean updateWorkspaceTheme(Theme editedTheme, WorkspaceThemes workspaceThemes) {
+ // Search resource value of edited theme
+ Iterator<Theme> currentThemesIterator = workspaceThemes.getThemes().iterator();
+ Theme themeId = null;
+ boolean found = false;
+
+ while(currentThemesIterator.hasNext() && !found) {
+ themeId = currentThemesIterator.next();
+ found = themeId.getId().equals(editedTheme.getId());
+ }
+
+ if(found) {
+ // Replace in resource the current value with the edited one and save resource
+ EcoreUtil.replace(workspaceThemes, StylesheetsPackage.eINSTANCE.getWorkspaceThemes_Themes(), themeId, editedTheme);
+ }
+
+ return found;
+ }
+
+ /**
+ * Save style sheets EMF Resource.
+ *
+ * @param styleSheetsResource
+ *
+ */
+ private void saveResource(Resource styleSheetsResource) {
+ // Save theme preference file
+ if(styleSheetsResource != null) {
+ try {
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put(XMIResource.XMI_ID, Boolean.TRUE);
+ styleSheetsResource.save(options);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+
+ /**
+ * Save theme in workspace preferences.
+ *
+ * @param theme
+ * Theme to save
+ */
+ public void saveNewThemeWorkspacePreference(Theme theme) {
+ Resource themeFile = theme.eResource();
+
+ if(themeFile == null) {
+ themeFile = findThemeFile();
+ }
+
+ // Get workspace themes
+ WorkspaceThemes workspaceThemes = (WorkspaceThemes)EcoreUtil.getObjectByType(themeFile.getContents(), StylesheetsPackage.eINSTANCE.getWorkspaceThemes());
+
+ // Create a workspace themes root
+ if(workspaceThemes == null) {
+ workspaceThemes = StylesheetsFactory.eINSTANCE.createWorkspaceThemes();
+ themeFile.getContents().add(workspaceThemes);
+ }
+
+ // Add created theme
+ workspaceThemes.getThemes().add(theme);
+
+ saveResource(themeFile);
+
+ }
+
+ /**
+ * Created a style sheets theme from project selection.
+ *
+ * @param selectedCSSFilesList
+ * @return
+ */
+ private Theme createThemeFromSelection(List<IFile> selectedCSSFilesList) {
+
+ // Factory to create necessary elements
+ StylesheetsFactory styleSheetsFactory = StylesheetsFactory.eINSTANCE;
+
+ // Create new theme
+ Theme newTheme = styleSheetsFactory.createTheme();
+
+ for(IFile cssFile : selectedCSSFilesList) {
+
+ //Style sheets to add in theme
+ StyleSheetReference styleSheetsReference = styleSheetsFactory.createStyleSheetReference();
+ styleSheetsReference.setPath(cssFile.getFullPath().toString());
+ newTheme.getStylesheets().add(styleSheetsReference);
+ }
+ return newTheme;
+ }
+
+ /**
+ * Look for theme workspace preferences file.
+ *
+ * @return Created resource if it don't exist, otherwise loaded
+ */
+ private Resource findThemeFile() {
+
+ IPath themeFilePath = getThemeWorkspacePreferenceFilePath();
+
+ // Create associated URI
+ URI resolvedURI = CommonPlugin.resolve(URI.createFileURI(themeFilePath.toOSString()));
+
+ // Create EMF resource
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource = null;
+
+ if(themeFilePath.toFile().exists()) {
+ resource = resourceSet.getResource(resolvedURI, true);
+ } else {
+ resource = resourceSet.createResource(resolvedURI);
+ }
+
+ return resource;
+ }
+
+ /**
+ * Build path to access preference file.
+ *
+ * @return Path to theme.xmi file in workspace preference directory
+ */
+ public IPath getThemeWorkspacePreferenceFilePath() {
+ // Get workspace path
+ IPath pluginStatePath = Activator.getDefault().getStateLocation();
+
+ // Build preference file path
+ IPath themeFilePath = pluginStatePath.append("theme.xmi");
+ return themeFilePath;
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java
index 5e4956b..45e320f 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java
@@ -1,25 +1,34 @@
-/*****************************************************************************
- * 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.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-
-//Unused
-public class ThemePreferenceInitializer extends AbstractPreferenceInitializer {
-
- @Override
- public void initializeDefaultPreferences() {
- // IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- // store.setDefault(ThemePreferencesPage.CURRENT_THEME, null);
- }
-
-}
+/*****************************************************************************
+ * 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
+ * Gabriel Pascual (ALL4TEC) - Initial API and Implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+
+
+/**
+ * Theme preference initializer.
+ *
+ * @author gpascual
+ *
+ */
+public class ThemePreferenceInitializer extends AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ store.setDefault(ThemePreferences.CURRENT_THEME, "org.eclipse.papyrus.css.papyrus_theme");
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
deleted file mode 100644
index 0d1f24d..0000000
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java
+++ /dev/null
@@ -1,95 +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.preferences;
-
-import java.util.List;
-
-import org.eclipse.jface.preference.ComboFieldEditor;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
-import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.css.engine.WorkspaceCSSEngine;
-import org.eclipse.papyrus.infra.gmfdiag.css.theme.Theme;
-import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * A Preference page for selecting the Workspace CSS Theme
- *
- * @author Camille Letavernier
- */
-public class ThemePreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public boolean needsRefresh = false;
-
- /**
- *
- * Constructor.
- *
- */
- public ThemePreferencesPage() {
- super("CSS Theme", org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor("/icons/papyrus.png"), FLAT);
- }
-
- public void init(IWorkbench workbench) {
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription("Papyrus Theme preferences");
- }
-
- @Override
- protected void createFieldEditors() {
- String[][] themes = getFieldThemes();
- ComboFieldEditor editor = new ComboFieldEditor(ThemePreferences.CURRENT_THEME, "Current theme:", themes, getFieldEditorParent());
- addField(editor);
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- super.propertyChange(event);
- if(ThemePreferences.CURRENT_THEME.equals(event.getProperty())) {
- needsRefresh = true;
- }
- if(FieldEditor.VALUE.equals(event.getProperty())) {
- if(ThemePreferences.CURRENT_THEME.equals(((FieldEditor)event.getSource()).getPreferenceName())) {
- needsRefresh = true;
- }
- }
- }
-
- @Override
- public boolean performOk() {
- boolean result = super.performOk();
- if(needsRefresh) {
- WorkspaceCSSEngine.instance.reset();
- DiagramHelper.setNeedsRefresh();
- DiagramHelper.refreshDiagrams();
- }
- return result;
- }
-
- protected String[][] getFieldThemes() {
- List<Theme> themes = ThemeManager.instance.getThemes();
-
- String[][] result = new String[themes.size()][2];
- int i = 0;
- for(Theme theme : themes) {
- result[i][0] = theme.getLabel();
- result[i][1] = theme.getId();
- i++;
- }
- return result;
- }
-
-}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/Theme.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/Theme.java
deleted file mode 100644
index 91e2172..0000000
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/Theme.java
+++ /dev/null
@@ -1,67 +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.theme;
-
-import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A CSS Theme descriptor
- *
- * @author Camille Letavernier
- */
-public class Theme {
-
- private String label;
-
- private Image icon;
-
- private final String id;
-
- private final List<URL> styleSheets;
-
- public Theme(String id) {
- this.id = id;
- this.styleSheets = new LinkedList<URL>();
- }
-
- public String getLabel() {
- return label == null || "".equals(label) ? id : label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public Image getIcon() {
- return icon;
- }
-
- public void setIcon(Image icon) {
- this.icon = icon;
- }
-
- public String getId() {
- return id;
- }
-
- public void addStyleSheet(URL url) {
- styleSheets.add(url);
- }
-
- public List<URL> getStyleSheets() {
- return styleSheets;
- }
-}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
index d7ca686..a01d7fd 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
@@ -1,220 +1,538 @@
-/*****************************************************************************
- * 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.theme;
-
-import java.io.IOException;
-import java.net.URL;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferences;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A Singleton to manage CSS Themes. Reads Themes from an extension point,
- * and provides an access to them.
- *
- * @author Camille Letavernier
- *
- */
-public class ThemeManager {
-
- public static String EXTENSION_ID = Activator.PLUGIN_ID + ".theme";
-
- public static ThemeManager instance = new ThemeManager();
-
- private Map<String, Theme> allThemes;
-
- /**
- * Returns all the Themes, sorted alphabetically
- *
- * @return
- */
- public List<Theme> getThemes() {
- List<Theme> sortedThemes = new LinkedList<Theme>(getAllThemes().values());
- Collections.sort(sortedThemes, ThemeComparator.instance);
- return sortedThemes;
- }
-
- /**
- * Returns the list of the workspace stylesheet's URLs.
- *
- * @return
- */
- public List<URL> getWorkspaceStyleSheets() {
- Theme current = findCurrentTheme();
- if(current == null) {
- return Collections.emptyList();
- }
- return current.getStyleSheets();
- }
-
- /**
- * Returns the theme associated to the given id, or null if it doesn't
- * exist
- *
- * @param themeId
- * @return
- */
- public Theme getTheme(String themeId) {
- return getAllThemes().get(themeId);
- }
-
- private Map<String, Theme> getAllThemes() {
- if(allThemes == null) {
- allThemes = new LinkedHashMap<String, Theme>(); //Keep the themes ordered, to avoid nondeterministic behavior
- allThemes.put(EmptyTheme.instance.getId(), EmptyTheme.instance);
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
-
- loadThemeDefinitions(config);
- loadThemeContributions(config);
- }
-
- return allThemes;
- }
-
- private void loadThemeDefinitions(IConfigurationElement[] config) {
- for(IConfigurationElement themeConfig : config) {
- if(!themeConfig.getName().equals("themeDefinition")) {
- continue;
- }
-
- final String themeId = themeConfig.getAttribute("id");
- if(themeId == null) {
- Activator.log.warn("Cannot define a CSS Theme with an empty id (Contributed by " + themeConfig.getContributor() + ")");
- continue;
- }
- Theme theme = new Theme(themeId);
-
- String themeLabel = themeConfig.getAttribute("label");
- theme.setLabel(themeLabel);
-
- String themeIcon = themeConfig.getAttribute("icon");
- if(themeIcon != null) {
- //FIXME: Use the Papyrus Image service when it is available
- Image icon = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(themeConfig.getContributor().getName(), themeIcon);
- if(icon != null) {
- theme.setIcon(icon);
- }
- }
-
- allThemes.put(themeId, theme);
- }
- }
-
- private void loadThemeContributions(IConfigurationElement[] config) {
- for(IConfigurationElement themeConfig : config) {
- if(!themeConfig.getName().equals("themeContribution")) {
- continue;
- }
-
- final String themeId = themeConfig.getAttribute("id");
- if(themeId == null || !allThemes.containsKey(themeId)) {
- Activator.log.warn("Cannot contribute to an undefined theme: " + themeId);
- continue;
- }
-
- Theme theme = allThemes.get(themeId);
-
- IConfigurationElement[] stylesheets = themeConfig.getChildren("stylesheet");
- for(IConfigurationElement stylesheetConfig : stylesheets) {
- String path = stylesheetConfig.getAttribute("stylesheetPath");
- try {
- URL url = new URL("platform:/plugin/" + themeConfig.getContributor().getName() + "/" + path);
- theme.addStyleSheet(url);
- } catch (IOException ex) {
- Activator.log.error(ex);
- }
- }
- }
- }
-
- private Theme findCurrentTheme() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- if(store.contains(ThemePreferences.CURRENT_THEME)) {
- String themeId = store.getString(ThemePreferences.CURRENT_THEME);
- Theme theme = getAllThemes().containsKey(themeId) ? getAllThemes().get(themeId) : EmptyTheme.instance;
- return theme;
- }
-
- //The theme has not been defined: return the first one, and store it
- List<Theme> sortedThemes = new ArrayList<Theme>(getAllThemes().values());
- if(sortedThemes.size() < 2) {
- return EmptyTheme.instance;
- }
-
- //Index 0 is EmptyTheme ; we return the first non-empty theme
- Theme theme = sortedThemes.get(1);
- store.setValue(ThemePreferences.CURRENT_THEME, theme.getId());
- try {
- ((IPersistentPreferenceStore)store).save();
- } catch (IOException e) {
- Activator.log.error(e);
- }
- return theme;
- }
-
- public static class EmptyTheme extends Theme {
-
- public static Theme instance = new EmptyTheme();
-
- private EmptyTheme() {
- super("none"); //$NON-NLS-1$
- setLabel("No theme");
- Image icon = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("icons/Delete_12x12.gif");
- setIcon(icon);
- }
- }
-
- /**
- * Sorts the Themes alphabetically (Based on their label). The Empty theme
- * is always the first element.
- *
- * @author Camille Letavernier
- */
- private static class ThemeComparator implements Comparator<Theme> {
-
- private ThemeComparator() {
- }
-
- @Override
- public int compare(Theme o1, Theme o2) {
- if(o1 == EmptyTheme.instance) {
- return -1;
- }
- if(o2 == EmptyTheme.instance) {
- return 1;
- }
-
- return Collator.getInstance().compare(o1.getLabel(), o2.getLabel());
- }
-
- public static Comparator<Theme> instance = new ThemeComparator();
-
- }
-
- private ThemeManager() {
-
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 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
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.theme;
+
+import java.io.IOException;
+import java.net.URL;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.helper.WorkspaceThemesHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferences;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A Singleton to manage CSS Themes. Reads Themes from an extension point
+ * and provides an access to them.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ThemeManager {
+
+ /** Extension point ID. */
+ public static String EXTENSION_ID = Activator.PLUGIN_ID + ".theme";
+
+ /** Unique instance of manager. */
+ public static ThemeManager instance = new ThemeManager();
+
+ /** All found themes in application. */
+ private Map<String, Theme> allThemes = null;
+
+ /** Unsaved themes. */
+ private List<Theme> temporaryThemesList = new ArrayList<Theme>();
+
+ /** Themes to delete. */
+ private List<Theme> deletedThemesList = new ArrayList<Theme>();
+
+ /** Workspace themes helper. */
+ private WorkspaceThemesHelper workspaceThemesHelper = new WorkspaceThemesHelper();
+
+ /**
+ * Default constructor.
+ */
+ private ThemeManager() {
+ //Singleton
+ }
+
+ /**
+ * Returns all the Themes, sorted alphabetically
+ *
+ * @return
+ */
+ public List<Theme> getThemes() {
+ List<Theme> sortedThemes = new LinkedList<Theme>(getAllThemes().values());
+ Collections.sort(sortedThemes, ThemeComparator.instance);
+
+ return sortedThemes;
+ }
+
+ /**
+ * Returns the list of the workspace stylesheet's URLs.
+ *
+ * @return
+ */
+ public List<StyleSheet> getWorkspaceStyleSheets() {
+ Theme current = findCurrentTheme();
+ if(current == null) {
+ return Collections.emptyList();
+ }
+ return current.getStylesheets();
+ }
+
+ /**
+ * Returns the theme associated to the given id, or <code>null</code> if it doesn't
+ * exist
+ *
+ * @param themeId
+ * @return
+ */
+ public Theme getTheme(String themeId) {
+ return getAllThemes().get(themeId);
+ }
+
+ /**
+ * Permit to reload known themes list.
+ */
+ public void reloadThemes() {
+ allThemes = null;
+ }
+
+ /**
+ * Refresh known themes list by merging states of themes.
+ */
+ public void refreshThemes() {
+
+ // Handle added themes
+ for(Theme addedTheme : temporaryThemesList) {
+
+ String key = addedTheme.getId();
+ if(!allThemes.containsKey(key)) {
+ allThemes.put(key, addedTheme);
+ }
+ }
+
+ // Handle deleted themes
+ for(Theme deletedTheme : deletedThemesList) {
+ String key = deletedTheme.getId();
+ if(allThemes.containsKey(key)) {
+ allThemes.remove(key);
+ }
+ }
+
+ }
+
+
+ /**
+ * Clean temporary list of themes.
+ */
+ public void clearTemporaryThemes() {
+ temporaryThemesList.clear();
+ }
+
+ /**
+ * Clean deleted theme list.
+ */
+ public void clearDeletedThemes() {
+ deletedThemesList.clear();
+ }
+
+ /**
+ * Add a temporary theme.
+ *
+ * @param temporaryTheme
+ * Theme to add in workspace themes preference
+ *
+ */
+ public void addTemporaryTheme(Theme temporaryTheme) {
+ temporaryThemesList.add(temporaryTheme);
+ }
+
+ /**
+ * Delete theme from preferences.
+ *
+ * @param theme
+ * Theme to delete
+ */
+ public void delete(Theme theme) {
+
+ // If theme is temporary don't maintain in associated list
+ if(temporaryThemesList.contains(theme)) {
+ temporaryThemesList.remove(theme);
+ } else {
+ // Else store in a list to be able to cancel
+ deletedThemesList.add(theme);
+ }
+ }
+
+ /**
+ * Get icon from a theme. Icon can register with plugin URI or file URI.
+ *
+ * @param theme
+ * Theme which can have an icon
+ * @return Loaded image, otherwise <code>null</code>
+ */
+ public Image getThemeIcon(Theme theme) {
+ Image icon = null;
+
+
+ String iconPath = theme.getIcon();
+ if(iconPath != null) {
+
+ // First : looking for theme in contribution
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+ icon = handleThemeDefinition(theme, config);
+
+ // Second : Try to load image from its path
+ if(icon == null) {
+
+ // Test path to icon
+ IPath path = new Path(iconPath);
+ if(path.toFile().exists()) {
+ icon = new Image(PlatformUI.getWorkbench().getDisplay(), iconPath);
+ }
+
+ }
+ }
+
+ return icon;
+ }
+
+ /**
+ * Return only workspace themes preference.
+ *
+ * @return Workspace themes preference (instance of {@link WorkspaceThemes}) if it exist, otherwise <code>null</code>
+ */
+ public WorkspaceThemes getWorkspaceThemesPreferences() {
+ WorkspaceThemes workspaceThemes = null;
+
+
+ // Get path of preference file
+ IPath path = workspaceThemesHelper.getThemeWorkspacePreferenceFilePath();
+
+ // If file exist, themes can load
+ if(path.toFile().exists()) {
+ // Resolve URI
+ URI fileURI = CommonPlugin.resolve(URI.createFileURI(path.toOSString()));
+
+ // Create associated resource
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ Resource resource = resourceSet.getResource(fileURI, true);
+
+
+ // Get workspace theme
+ workspaceThemes = (WorkspaceThemes)EcoreUtil.getObjectByType(resource.getContents(), StylesheetsPackage.eINSTANCE.getWorkspaceThemes());
+ }
+
+ return workspaceThemes;
+
+ }
+
+ /**
+ * Know if theme is editable. Only themes of workspace or temporary can be edited.
+ *
+ * @param id
+ * Id of theme to check
+ * @return <code>true</code> if theme can be edited, otherwise <code>false<code>
+ */
+ public boolean isEditable(String id) {
+ boolean isEditable = false;
+
+ WorkspaceThemes workspacePreference = getWorkspaceThemesPreferences();
+ if(workspacePreference != null) {
+
+ // Check if theme existing in temporary
+ isEditable = temporaryThemesList.contains(allThemes.get(id));
+
+ //Check if theme comes from workspace preferences
+ Iterator<Theme> themesIterator = workspacePreference.getThemes().iterator();
+ while(themesIterator.hasNext() && !isEditable) {
+ isEditable = id.equals(themesIterator.next().getId());
+ }
+
+
+ }
+
+ return isEditable;
+ }
+
+ /**
+ * Persist state of the manager.
+ */
+ public void persist() {
+ Theme[] editableThemes = getEditableThemes();
+ workspaceThemesHelper.saveWorkspaceThemesPreferenceResource(editableThemes, deletedThemesList.toArray(new Theme[deletedThemesList.size()]));
+
+ // Reset manager
+ allThemes = null;
+ deletedThemesList.clear();
+ temporaryThemesList.clear();
+ }
+
+ /**
+ * @return
+ */
+ private Theme[] getEditableThemes() {
+ List<Theme> editableThemeList = new ArrayList<Theme>();
+
+ for(Theme theme : allThemes.values()) {
+ if(isEditable(theme.getId())) {
+ editableThemeList.add(theme);
+ }
+ }
+ return editableThemeList.toArray(new Theme[editableThemeList.size()]);
+ }
+
+ /**
+ * Look for corresponding theme in theme definition contribution and load its image.
+ *
+ * @param theme
+ * Theme to find in all contribution
+ * @param config
+ * Configuration of all theme contribution
+ * @return Loaded image if theme is came from contribution, otherwise <code>null</code>
+ */
+ private Image handleThemeDefinition(Theme theme, IConfigurationElement[] config) {
+ Image icon = null;
+
+ for(IConfigurationElement themeContribution : config) {
+
+ // Verify that contribution is a theme definition
+ if(!themeContribution.getName().equals("themeDefinition")) {
+ continue;
+ }
+
+ // Get label and Id of definition to compare to parameter
+ String themeId = themeContribution.getAttribute("id");
+ String themeLabel = themeContribution.getAttribute("label");
+
+ if(themeId != null && themeId.equals(theme.getId()) && themeLabel != null && themeLabel.equals(theme.getLabel())) {
+ //FIXME: Use the Papyrus Image service when it is available
+ icon = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(themeContribution.getContributor().getName(), theme.getIcon());
+ }
+ }
+
+ return icon;
+ }
+
+ private Map<String, Theme> getAllThemes() {
+ if(allThemes == null) {
+ allThemes = new LinkedHashMap<String, Theme>(); //Keep the themes ordered, to avoid nondeterministic behavior
+ allThemes.put(EmptyTheme.instance.getId(), EmptyTheme.instance);
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ loadThemeDefinitions(config);
+ loadThemeContributions(config);
+ loadThemePreferenceWorkspace();
+ loadTemporaryThemes();
+
+ // Remove deleted themes
+ for(Theme theme : deletedThemesList) {
+ String themeId = theme.getId();
+ if(allThemes.containsKey(themeId)) {
+ allThemes.remove(themeId);
+ }
+ }
+ }
+
+ return allThemes;
+ }
+
+ /**
+ * Load theme definitions.
+ *
+ * @param config
+ * configuration of all contribution definition
+ */
+ private void loadThemeDefinitions(IConfigurationElement[] config) {
+
+ // For all theme definitions
+ for(IConfigurationElement themeConfig : config) {
+
+ if(!themeConfig.getName().equals("themeDefinition")) {
+ continue;
+ }
+
+ final String themeId = themeConfig.getAttribute("id");
+ if(themeId == null) {
+ Activator.log.warn("Cannot define a CSS Theme with an empty id (Contributed by " + themeConfig.getContributor() + ")");
+ continue;
+ }
+
+ //Create theme
+ Theme theme = StylesheetsFactory.eINSTANCE.createTheme();
+ theme.setId(themeId);
+
+ String themeLabel = themeConfig.getAttribute("label");
+ theme.setLabel(themeLabel);
+
+ String themeIcon = themeConfig.getAttribute("icon");
+ if(themeIcon != null) {
+
+ theme.setIcon(themeIcon);
+
+ }
+
+ allThemes.put(themeId, theme);
+ }
+ }
+
+ /**
+ * Load theme contributions.
+ *
+ * @param config
+ * configuration of all contribution definition
+ */
+ private void loadThemeContributions(IConfigurationElement[] config) {
+ for(IConfigurationElement themeConfig : config) {
+
+ // Verify that
+ if(!themeConfig.getName().equals("themeContribution")) {
+ continue;
+ }
+
+ final String themeId = themeConfig.getAttribute("id");
+ if(themeId == null || !allThemes.containsKey(themeId)) {
+ Activator.log.warn("Cannot contribute to an undefined theme: " + themeId);
+ continue;
+ }
+
+ Theme theme = allThemes.get(themeId);
+
+ IConfigurationElement[] stylesheets = themeConfig.getChildren("stylesheet");
+ for(IConfigurationElement stylesheetConfig : stylesheets) {
+ String path = stylesheetConfig.getAttribute("stylesheetPath");
+ try {
+ URL url = new URL("platform:/plugin/" + themeConfig.getContributor().getName() + "/" + path);
+ StyleSheetReference styleSheet = StylesheetsFactory.eINSTANCE.createStyleSheetReference();
+ styleSheet.setPath(url.toString());
+ theme.getStylesheets().add(styleSheet);
+ } catch (IOException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+ }
+
+ /**
+ * Load themes of workspace preference.
+ */
+ private void loadThemePreferenceWorkspace() {
+
+ WorkspaceThemes workspaceThemes = getWorkspaceThemesPreferences();
+
+ // If file exist, themes can load
+ if(workspaceThemes != null) {
+
+
+ // Add each themme to current list
+ for(Theme theme : workspaceThemes.getThemes()) {
+ allThemes.put(theme.getId(), theme);
+ }
+
+ }
+ }
+
+ /**
+ * Add temporary themes in current themes list.
+ */
+ private void loadTemporaryThemes() {
+ for(Theme theme : temporaryThemesList) {
+ allThemes.put(theme.getId(), theme);
+ }
+
+ }
+
+ private Theme findCurrentTheme() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ if(store.contains(ThemePreferences.CURRENT_THEME)) {
+ String themeId = store.getString(ThemePreferences.CURRENT_THEME);
+ Theme theme = getAllThemes().containsKey(themeId) ? getAllThemes().get(themeId) : EmptyTheme.instance;
+ return theme;
+ }
+
+ //The theme has not been defined: return the first one, and store it
+ List<Theme> sortedThemes = new ArrayList<Theme>(getAllThemes().values());
+ if(sortedThemes.size() < 2) {
+ return EmptyTheme.instance;
+ }
+
+ //Index 0 is EmptyTheme ; we return the first non-empty theme
+ Theme theme = sortedThemes.get(1);
+ store.setValue(ThemePreferences.CURRENT_THEME, theme.getId());
+ try {
+ ((IPersistentPreferenceStore)store).save();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ return theme;
+ }
+
+ public static class EmptyTheme extends ThemeImpl {
+
+ public static Theme instance = new EmptyTheme();
+
+ private EmptyTheme() {
+ setId("none");
+ setLabel("No theme");
+ setIcon("icons/Delete_12x12.gif");
+ }
+ }
+
+ /**
+ * Sorts the Themes alphabetically (Based on their label). The Empty theme
+ * is always the first element.
+ *
+ * @author Camille Letavernier
+ */
+ private static class ThemeComparator implements Comparator<Theme> {
+
+ private ThemeComparator() {
+ }
+
+ @Override
+ public int compare(Theme o1, Theme o2) {
+ if(o1 == EmptyTheme.instance) {
+ return -1;
+ }
+ if(o2 == EmptyTheme.instance) {
+ return 1;
+ }
+
+ return Collator.getInstance().compare(o1.getLabel(), o2.getLabel());
+ }
+
+ public static Comparator<Theme> instance = new ThemeComparator();
+
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/META-INF/MANIFEST.MF
index aa425ef..e180f21 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/META-INF/MANIFEST.MF
@@ -1,21 +1,19 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.ui,
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
- org.eclipse.uml2.uml;bundle-version="4.0.0"
-Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.model,
- org.eclipse.papyrus.infra.gmfdiag.css.stylesheets,
- org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl,
- org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.util
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css.model;singl
- eton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.ui,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0"
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.model,
+ org.eclipse.papyrus.infra.gmfdiag.css.stylesheets,
+ org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl,
+ org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.util
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css.model;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.ecore b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.ecore
index 933548c..fe1bb50 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.ecore
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.ecore
@@ -1,18 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="stylesheets" nsURI="http://www.eclipse.org/papyrus/infra/gmfdiag/css"
- nsPrefix="css">
- <eClassifiers xsi:type="ecore:EClass" name="ModelStyleSheets" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement">
- <eStructuralFeatures xsi:type="ecore:EReference" name="stylesheets" upperBound="-1"
- eType="#//StyleSheet" containment="true"/>
- </eClassifiers>
- <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>
- <eClassifiers xsi:type="ecore:EClass" name="EmbeddedStyleSheet" eSuperTypes="#//StyleSheet">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="content" lowerBound="1"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="stylesheets" nsURI="http://www.eclipse.org/papyrus/infra/gmfdiag/css"
+ nsPrefix="css">
+ <eClassifiers xsi:type="ecore:EClass" name="ModelStyleSheets" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="stylesheets" upperBound="-1"
+ eType="#//StyleSheet" containment="true"/>
+ </eClassifiers>
+ <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>
+ <eClassifiers xsi:type="ecore:EClass" name="EmbeddedStyleSheet" eSuperTypes="#//StyleSheet">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="content" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="WorkspaceThemes" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="themes" upperBound="-1"
+ eType="#//Theme" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Theme">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" ordered="false" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"
+ defaultValueLiteral="" iD="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="icon" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="stylesheets" upperBound="-1"
+ eType="#//StyleSheet" containment="true"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.genmodel b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.genmodel
index 720a70c..aac7ed7 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.genmodel
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/Model/StyleSheets.genmodel
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen"
- editDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model.edit/src-gen" editorDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model.editor/src-gen"
- modelPluginID="org.eclipse.papyrus.infra.gmfdiag.css.model" modelName="StyleSheets"
- testsDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model.tests/src-gen" importerID="org.eclipse.emf.importer.ecore"
- complianceLevel="5.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
- <foreignModel>StyleSheets.ecore</foreignModel>
- <genPackages prefix="Stylesheets" basePackage="org.eclipse.papyrus.infra.gmfdiag.css"
- disposableProviderFactory="true" ecorePackage="StyleSheets.ecore#/">
- <genClasses ecoreClass="StyleSheets.ecore#//ModelStyleSheets">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference StyleSheets.ecore#//ModelStyleSheets/stylesheets"/>
- </genClasses>
- <genClasses image="false" ecoreClass="StyleSheets.ecore#//StyleSheet"/>
- <genClasses ecoreClass="StyleSheets.ecore#//StyleSheetReference">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute StyleSheets.ecore#//StyleSheetReference/path"/>
- </genClasses>
- <genClasses ecoreClass="StyleSheets.ecore#//EmbeddedStyleSheet">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute StyleSheets.ecore#//EmbeddedStyleSheet/label"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute StyleSheets.ecore#//EmbeddedStyleSheet/content"/>
- </genClasses>
- </genPackages>
-</genmodel:GenModel>
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen"
+ editDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model.edit/src-gen" editorDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model.editor/src-gen"
+ modelPluginID="org.eclipse.papyrus.infra.gmfdiag.css.model" modelName="StyleSheets"
+ testsDirectory="/org.eclipse.papyrus.infra.gmfdiag.css.model.tests/src-gen" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
+ <foreignModel>StyleSheets.ecore</foreignModel>
+ <genPackages prefix="Stylesheets" basePackage="org.eclipse.papyrus.infra.gmfdiag.css"
+ disposableProviderFactory="true" ecorePackage="StyleSheets.ecore#/">
+ <genClasses ecoreClass="StyleSheets.ecore#//ModelStyleSheets">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference StyleSheets.ecore#//ModelStyleSheets/stylesheets"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="StyleSheets.ecore#//StyleSheet"/>
+ <genClasses ecoreClass="StyleSheets.ecore#//StyleSheetReference">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute StyleSheets.ecore#//StyleSheetReference/path"/>
+ </genClasses>
+ <genClasses ecoreClass="StyleSheets.ecore#//EmbeddedStyleSheet">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute StyleSheets.ecore#//EmbeddedStyleSheet/label"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute StyleSheets.ecore#//EmbeddedStyleSheet/content"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsFactory.java
index 27b6b2d..d11cbef 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsFactory.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsFactory.java
@@ -1,60 +1,78 @@
-/**
- */
-package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage
- * @generated
- */
-public interface StylesheetsFactory extends EFactory {
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- StylesheetsFactory eINSTANCE = org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsFactoryImpl.init();
-
- /**
- * Returns a new object of class '<em>Model Style Sheets</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Model Style Sheets</em>'.
- * @generated
- */
- ModelStyleSheets createModelStyleSheets();
-
- /**
- * Returns a new object of class '<em>Style Sheet Reference</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Style Sheet Reference</em>'.
- * @generated
- */
- StyleSheetReference createStyleSheetReference();
-
- /**
- * Returns a new object of class '<em>Embedded Style Sheet</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Embedded Style Sheet</em>'.
- * @generated
- */
- EmbeddedStyleSheet createEmbeddedStyleSheet();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package supported by this factory.
- * @generated
- */
- StylesheetsPackage getStylesheetsPackage();
-
-} //StylesheetsFactory
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage
+ * @generated
+ */
+public interface StylesheetsFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ StylesheetsFactory eINSTANCE = org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Model Style Sheets</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Model Style Sheets</em>'.
+ * @generated
+ */
+ ModelStyleSheets createModelStyleSheets();
+
+ /**
+ * Returns a new object of class '<em>Style Sheet Reference</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Style Sheet Reference</em>'.
+ * @generated
+ */
+ StyleSheetReference createStyleSheetReference();
+
+ /**
+ * Returns a new object of class '<em>Embedded Style Sheet</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Embedded Style Sheet</em>'.
+ * @generated
+ */
+ EmbeddedStyleSheet createEmbeddedStyleSheet();
+
+ /**
+ * Returns a new object of class '<em>Workspace Themes</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Workspace Themes</em>'.
+ * @generated
+ */
+ WorkspaceThemes createWorkspaceThemes();
+
+ /**
+ * Returns a new object of class '<em>Theme</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Theme</em>'.
+ * @generated
+ */
+ Theme createTheme();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ StylesheetsPackage getStylesheetsPackage();
+
+} //StylesheetsFactory
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsPackage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsPackage.java
index 60b633b..b751efe 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsPackage.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/StylesheetsPackage.java
@@ -1,361 +1,589 @@
-/**
- */
-package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory
- * @model kind="package"
- * @generated
- */
-public interface StylesheetsPackage extends EPackage {
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNAME = "stylesheets";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_URI = "http://www.eclipse.org/papyrus/infra/gmfdiag/css";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_PREFIX = "css";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- StylesheetsPackage eINSTANCE = org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl <em>Model Style Sheets</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getModelStyleSheets()
- * @generated
- */
- int MODEL_STYLE_SHEETS = 0;
-
- /**
- * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int MODEL_STYLE_SHEETS__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS;
-
- /**
- * The feature id for the '<em><b>Stylesheets</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int MODEL_STYLE_SHEETS__STYLESHEETS = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Model Style Sheets</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- 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.stylesheets.StyleSheet <em>Style Sheet</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheet()
- * @generated
- */
- int STYLE_SHEET = 1;
-
- /**
- * The number of structural features of the '<em>Style Sheet</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int STYLE_SHEET_FEATURE_COUNT = 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl <em>Style Sheet Reference</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheetReference()
- * @generated
- */
- int STYLE_SHEET_REFERENCE = 2;
-
- /**
- * The feature id for the '<em><b>Path</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int STYLE_SHEET_REFERENCE__PATH = STYLE_SHEET_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Style Sheet Reference</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int STYLE_SHEET_REFERENCE_FEATURE_COUNT = STYLE_SHEET_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl <em>Embedded Style Sheet</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getEmbeddedStyleSheet()
- * @generated
- */
- int EMBEDDED_STYLE_SHEET = 3;
-
- /**
- * The feature id for the '<em><b>Label</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int EMBEDDED_STYLE_SHEET__LABEL = STYLE_SHEET_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Content</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int EMBEDDED_STYLE_SHEET__CONTENT = STYLE_SHEET_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Embedded Style Sheet</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int EMBEDDED_STYLE_SHEET_FEATURE_COUNT = STYLE_SHEET_FEATURE_COUNT + 2;
-
-
- /**
- * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets <em>Model Style Sheets</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Model Style Sheets</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets
- * @generated
- */
- EClass getModelStyleSheets();
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets#getStylesheets <em>Stylesheets</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Stylesheets</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets#getStylesheets()
- * @see #getModelStyleSheets()
- * @generated
- */
- EReference getModelStyleSheets_Stylesheets();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet <em>Style Sheet</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Style Sheet</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
- * @generated
- */
- EClass getStyleSheet();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference <em>Style Sheet Reference</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Style Sheet Reference</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference
- * @generated
- */
- EClass getStyleSheetReference();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference#getPath <em>Path</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Path</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference#getPath()
- * @see #getStyleSheetReference()
- * @generated
- */
- EAttribute getStyleSheetReference_Path();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet <em>Embedded Style Sheet</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Embedded Style Sheet</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet
- * @generated
- */
- EClass getEmbeddedStyleSheet();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getLabel <em>Label</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Label</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getLabel()
- * @see #getEmbeddedStyleSheet()
- * @generated
- */
- EAttribute getEmbeddedStyleSheet_Label();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getContent <em>Content</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Content</em>'.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getContent()
- * @see #getEmbeddedStyleSheet()
- * @generated
- */
- EAttribute getEmbeddedStyleSheet_Content();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- StylesheetsFactory getStylesheetsFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- interface Literals {
- /**
- * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl <em>Model Style Sheets</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getModelStyleSheets()
- * @generated
- */
- EClass MODEL_STYLE_SHEETS = eINSTANCE.getModelStyleSheets();
-
- /**
- * The meta object literal for the '<em><b>Stylesheets</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference MODEL_STYLE_SHEETS__STYLESHEETS = eINSTANCE.getModelStyleSheets_Stylesheets();
-
- /**
- * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet <em>Style Sheet</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheet()
- * @generated
- */
- EClass STYLE_SHEET = eINSTANCE.getStyleSheet();
-
- /**
- * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl <em>Style Sheet Reference</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheetReference()
- * @generated
- */
- EClass STYLE_SHEET_REFERENCE = eINSTANCE.getStyleSheetReference();
-
- /**
- * The meta object literal for the '<em><b>Path</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute STYLE_SHEET_REFERENCE__PATH = eINSTANCE.getStyleSheetReference_Path();
-
- /**
- * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl <em>Embedded Style Sheet</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getEmbeddedStyleSheet()
- * @generated
- */
- EClass EMBEDDED_STYLE_SHEET = eINSTANCE.getEmbeddedStyleSheet();
-
- /**
- * The meta object literal for the '<em><b>Label</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute EMBEDDED_STYLE_SHEET__LABEL = eINSTANCE.getEmbeddedStyleSheet_Label();
-
- /**
- * The meta object literal for the '<em><b>Content</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute EMBEDDED_STYLE_SHEET__CONTENT = eINSTANCE.getEmbeddedStyleSheet_Content();
-
- }
-
-} //StylesheetsPackage
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface StylesheetsPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "stylesheets";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/papyrus/infra/gmfdiag/css";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "css";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ StylesheetsPackage eINSTANCE = org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl <em>Model Style Sheets</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getModelStyleSheets()
+ * @generated
+ */
+ int MODEL_STYLE_SHEETS = 0;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODEL_STYLE_SHEETS__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Stylesheets</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODEL_STYLE_SHEETS__STYLESHEETS = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Model Style Sheets</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ 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.stylesheets.StyleSheet <em>Style Sheet</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheet()
+ * @generated
+ */
+ int STYLE_SHEET = 1;
+
+ /**
+ * The number of structural features of the '<em>Style Sheet</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STYLE_SHEET_FEATURE_COUNT = 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl <em>Style Sheet Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheetReference()
+ * @generated
+ */
+ int STYLE_SHEET_REFERENCE = 2;
+
+ /**
+ * The feature id for the '<em><b>Path</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STYLE_SHEET_REFERENCE__PATH = STYLE_SHEET_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Style Sheet Reference</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STYLE_SHEET_REFERENCE_FEATURE_COUNT = STYLE_SHEET_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl <em>Embedded Style Sheet</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getEmbeddedStyleSheet()
+ * @generated
+ */
+ int EMBEDDED_STYLE_SHEET = 3;
+
+ /**
+ * The feature id for the '<em><b>Label</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EMBEDDED_STYLE_SHEET__LABEL = STYLE_SHEET_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Content</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EMBEDDED_STYLE_SHEET__CONTENT = STYLE_SHEET_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Embedded Style Sheet</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EMBEDDED_STYLE_SHEET_FEATURE_COUNT = STYLE_SHEET_FEATURE_COUNT + 2;
+
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.WorkspaceThemesImpl <em>Workspace Themes</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.WorkspaceThemesImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getWorkspaceThemes()
+ * @generated
+ */
+ int WORKSPACE_THEMES = 4;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int WORKSPACE_THEMES__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Themes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int WORKSPACE_THEMES__THEMES = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Workspace Themes</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int WORKSPACE_THEMES_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl <em>Theme</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getTheme()
+ * @generated
+ */
+ int THEME = 5;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int THEME__ID = 0;
+
+ /**
+ * The feature id for the '<em><b>Label</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int THEME__LABEL = 1;
+
+ /**
+ * The feature id for the '<em><b>Icon</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int THEME__ICON = 2;
+
+ /**
+ * The feature id for the '<em><b>Stylesheets</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int THEME__STYLESHEETS = 3;
+
+ /**
+ * The number of structural features of the '<em>Theme</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int THEME_FEATURE_COUNT = 4;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets <em>Model Style Sheets</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Model Style Sheets</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets
+ * @generated
+ */
+ EClass getModelStyleSheets();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets#getStylesheets <em>Stylesheets</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Stylesheets</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets#getStylesheets()
+ * @see #getModelStyleSheets()
+ * @generated
+ */
+ EReference getModelStyleSheets_Stylesheets();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet <em>Style Sheet</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Style Sheet</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
+ * @generated
+ */
+ EClass getStyleSheet();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference <em>Style Sheet Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Style Sheet Reference</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference
+ * @generated
+ */
+ EClass getStyleSheetReference();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference#getPath <em>Path</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Path</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference#getPath()
+ * @see #getStyleSheetReference()
+ * @generated
+ */
+ EAttribute getStyleSheetReference_Path();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet <em>Embedded Style Sheet</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Embedded Style Sheet</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet
+ * @generated
+ */
+ EClass getEmbeddedStyleSheet();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getLabel <em>Label</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Label</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getLabel()
+ * @see #getEmbeddedStyleSheet()
+ * @generated
+ */
+ EAttribute getEmbeddedStyleSheet_Label();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getContent <em>Content</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Content</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet#getContent()
+ * @see #getEmbeddedStyleSheet()
+ * @generated
+ */
+ EAttribute getEmbeddedStyleSheet_Content();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes <em>Workspace Themes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Workspace Themes</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes
+ * @generated
+ */
+ EClass getWorkspaceThemes();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes#getThemes <em>Themes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Themes</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes#getThemes()
+ * @see #getWorkspaceThemes()
+ * @generated
+ */
+ EReference getWorkspaceThemes_Themes();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme <em>Theme</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Theme</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme
+ * @generated
+ */
+ EClass getTheme();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getId <em>Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Id</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getId()
+ * @see #getTheme()
+ * @generated
+ */
+ EAttribute getTheme_Id();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getLabel <em>Label</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Label</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getLabel()
+ * @see #getTheme()
+ * @generated
+ */
+ EAttribute getTheme_Label();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getIcon <em>Icon</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Icon</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getIcon()
+ * @see #getTheme()
+ * @generated
+ */
+ EAttribute getTheme_Icon();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getStylesheets <em>Stylesheets</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Stylesheets</em>'.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getStylesheets()
+ * @see #getTheme()
+ * @generated
+ */
+ EReference getTheme_Stylesheets();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ StylesheetsFactory getStylesheetsFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl <em>Model Style Sheets</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ModelStyleSheetsImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getModelStyleSheets()
+ * @generated
+ */
+ EClass MODEL_STYLE_SHEETS = eINSTANCE.getModelStyleSheets();
+
+ /**
+ * The meta object literal for the '<em><b>Stylesheets</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference MODEL_STYLE_SHEETS__STYLESHEETS = eINSTANCE.getModelStyleSheets_Stylesheets();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet <em>Style Sheet</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheet()
+ * @generated
+ */
+ EClass STYLE_SHEET = eINSTANCE.getStyleSheet();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl <em>Style Sheet Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StyleSheetReferenceImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getStyleSheetReference()
+ * @generated
+ */
+ EClass STYLE_SHEET_REFERENCE = eINSTANCE.getStyleSheetReference();
+
+ /**
+ * The meta object literal for the '<em><b>Path</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STYLE_SHEET_REFERENCE__PATH = eINSTANCE.getStyleSheetReference_Path();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl <em>Embedded Style Sheet</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.EmbeddedStyleSheetImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getEmbeddedStyleSheet()
+ * @generated
+ */
+ EClass EMBEDDED_STYLE_SHEET = eINSTANCE.getEmbeddedStyleSheet();
+
+ /**
+ * The meta object literal for the '<em><b>Label</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute EMBEDDED_STYLE_SHEET__LABEL = eINSTANCE.getEmbeddedStyleSheet_Label();
+
+ /**
+ * The meta object literal for the '<em><b>Content</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute EMBEDDED_STYLE_SHEET__CONTENT = eINSTANCE.getEmbeddedStyleSheet_Content();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.WorkspaceThemesImpl <em>Workspace Themes</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.WorkspaceThemesImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getWorkspaceThemes()
+ * @generated
+ */
+ EClass WORKSPACE_THEMES = eINSTANCE.getWorkspaceThemes();
+
+ /**
+ * The meta object literal for the '<em><b>Themes</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference WORKSPACE_THEMES__THEMES = eINSTANCE.getWorkspaceThemes_Themes();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl <em>Theme</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.StylesheetsPackageImpl#getTheme()
+ * @generated
+ */
+ EClass THEME = eINSTANCE.getTheme();
+
+ /**
+ * The meta object literal for the '<em><b>Id</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute THEME__ID = eINSTANCE.getTheme_Id();
+
+ /**
+ * The meta object literal for the '<em><b>Label</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute THEME__LABEL = eINSTANCE.getTheme_Label();
+
+ /**
+ * The meta object literal for the '<em><b>Icon</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute THEME__ICON = eINSTANCE.getTheme_Icon();
+
+ /**
+ * The meta object literal for the '<em><b>Stylesheets</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference THEME__STYLESHEETS = eINSTANCE.getTheme_Stylesheets();
+
+ }
+
+} //StylesheetsPackage
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/Theme.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/Theme.java
new file mode 100644
index 0000000..2fa8740
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/Theme.java
@@ -0,0 +1,123 @@
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Theme</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getLabel <em>Label</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getIcon <em>Icon</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getStylesheets <em>Stylesheets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getTheme()
+ * @model
+ * @generated
+ */
+public interface Theme extends EObject {
+ /**
+ * Returns the value of the '<em><b>Id</b></em>' attribute.
+ * The default value is <code>""</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id</em>' attribute.
+ * @see #setId(String)
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getTheme_Id()
+ * @model default="" id="true" ordered="false"
+ * @generated
+ */
+ String getId();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getId <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(String value);
+
+ /**
+ * Returns the value of the '<em><b>Label</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Label</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Label</em>' attribute.
+ * @see #setLabel(String)
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getTheme_Label()
+ * @model
+ * @generated
+ */
+ String getLabel();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getLabel <em>Label</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Label</em>' attribute.
+ * @see #getLabel()
+ * @generated
+ */
+ void setLabel(String value);
+
+ /**
+ * Returns the value of the '<em><b>Icon</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Icon</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Icon</em>' attribute.
+ * @see #setIcon(String)
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getTheme_Icon()
+ * @model
+ * @generated
+ */
+ String getIcon();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme#getIcon <em>Icon</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Icon</em>' attribute.
+ * @see #getIcon()
+ * @generated
+ */
+ void setIcon(String value);
+
+ /**
+ * Returns the value of the '<em><b>Stylesheets</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Stylesheets</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Stylesheets</em>' containment reference list.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getTheme_Stylesheets()
+ * @model containment="true"
+ * @generated
+ */
+ EList<StyleSheet> getStylesheets();
+
+} // Theme
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/WorkspaceThemes.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/WorkspaceThemes.java
new file mode 100644
index 0000000..5b5788b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/WorkspaceThemes.java
@@ -0,0 +1,42 @@
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EModelElement;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Workspace Themes</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes#getThemes <em>Themes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getWorkspaceThemes()
+ * @model
+ * @generated
+ */
+public interface WorkspaceThemes extends EModelElement {
+ /**
+ * Returns the value of the '<em><b>Themes</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Themes</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Themes</em>' containment reference list.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#getWorkspaceThemes_Themes()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Theme> getThemes();
+
+} // WorkspaceThemes
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsFactoryImpl.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsFactoryImpl.java
index 2615679..3ce9544 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsFactoryImpl.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsFactoryImpl.java
@@ -1,118 +1,141 @@
-/**
- */
-package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class StylesheetsFactoryImpl extends EFactoryImpl implements StylesheetsFactory {
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static StylesheetsFactory init() {
- try {
- StylesheetsFactory theStylesheetsFactory = (StylesheetsFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/infra/gmfdiag/css");
- if (theStylesheetsFactory != null) {
- return theStylesheetsFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new StylesheetsFactoryImpl();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public StylesheetsFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case StylesheetsPackage.MODEL_STYLE_SHEETS: return createModelStyleSheets();
- case StylesheetsPackage.STYLE_SHEET_REFERENCE: return createStyleSheetReference();
- case StylesheetsPackage.EMBEDDED_STYLE_SHEET: return createEmbeddedStyleSheet();
- default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ModelStyleSheets createModelStyleSheets() {
- ModelStyleSheetsImpl modelStyleSheets = new ModelStyleSheetsImpl();
- return modelStyleSheets;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public StyleSheetReference createStyleSheetReference() {
- StyleSheetReferenceImpl styleSheetReference = new StyleSheetReferenceImpl();
- return styleSheetReference;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EmbeddedStyleSheet createEmbeddedStyleSheet() {
- EmbeddedStyleSheetImpl embeddedStyleSheet = new EmbeddedStyleSheetImpl();
- return embeddedStyleSheet;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public StylesheetsPackage getStylesheetsPackage() {
- return (StylesheetsPackage)getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static StylesheetsPackage getPackage() {
- return StylesheetsPackage.eINSTANCE;
- }
-
-} //StylesheetsFactoryImpl
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.*;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StylesheetsFactoryImpl extends EFactoryImpl implements StylesheetsFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static StylesheetsFactory init() {
+ try {
+ StylesheetsFactory theStylesheetsFactory = (StylesheetsFactory)EPackage.Registry.INSTANCE.getEFactory(StylesheetsPackage.eNS_URI);
+ if (theStylesheetsFactory != null) {
+ return theStylesheetsFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new StylesheetsFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StylesheetsFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case StylesheetsPackage.MODEL_STYLE_SHEETS: return createModelStyleSheets();
+ case StylesheetsPackage.STYLE_SHEET_REFERENCE: return createStyleSheetReference();
+ case StylesheetsPackage.EMBEDDED_STYLE_SHEET: return createEmbeddedStyleSheet();
+ case StylesheetsPackage.WORKSPACE_THEMES: return createWorkspaceThemes();
+ case StylesheetsPackage.THEME: return createTheme();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelStyleSheets createModelStyleSheets() {
+ ModelStyleSheetsImpl modelStyleSheets = new ModelStyleSheetsImpl();
+ return modelStyleSheets;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StyleSheetReference createStyleSheetReference() {
+ StyleSheetReferenceImpl styleSheetReference = new StyleSheetReferenceImpl();
+ return styleSheetReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EmbeddedStyleSheet createEmbeddedStyleSheet() {
+ EmbeddedStyleSheetImpl embeddedStyleSheet = new EmbeddedStyleSheetImpl();
+ return embeddedStyleSheet;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public WorkspaceThemes createWorkspaceThemes() {
+ WorkspaceThemesImpl workspaceThemes = new WorkspaceThemesImpl();
+ return workspaceThemes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Theme createTheme() {
+ ThemeImpl theme = new ThemeImpl();
+ return theme;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StylesheetsPackage getStylesheetsPackage() {
+ return (StylesheetsPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static StylesheetsPackage getPackage() {
+ return StylesheetsPackage.eINSTANCE;
+ }
+
+} //StylesheetsFactoryImpl
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsPackageImpl.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsPackageImpl.java
index be80aa9..f8647b4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsPackageImpl.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/StylesheetsPackageImpl.java
@@ -1,282 +1,380 @@
-/**
- */
-package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Package</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class StylesheetsPackageImpl extends EPackageImpl implements StylesheetsPackage {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass modelStyleSheetsEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass styleSheetEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass styleSheetReferenceEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass embeddedStyleSheetEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private StylesheetsPackageImpl() {
- super(eNS_URI, StylesheetsFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
- * <p>This method is used to initialize {@link StylesheetsPackage#eINSTANCE} when that field is accessed.
- * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static StylesheetsPackage init() {
- if (isInited) return (StylesheetsPackage)EPackage.Registry.INSTANCE.getEPackage(StylesheetsPackage.eNS_URI);
-
- // Obtain or create and register package
- StylesheetsPackageImpl theStylesheetsPackage = (StylesheetsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof StylesheetsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new StylesheetsPackageImpl());
-
- isInited = true;
-
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
-
- // Create package meta-data objects
- theStylesheetsPackage.createPackageContents();
-
- // Initialize created meta-data
- theStylesheetsPackage.initializePackageContents();
-
- // Mark meta-data to indicate it can't be changed
- theStylesheetsPackage.freeze();
-
-
- // Update the registry and return the package
- EPackage.Registry.INSTANCE.put(StylesheetsPackage.eNS_URI, theStylesheetsPackage);
- return theStylesheetsPackage;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getModelStyleSheets() {
- return modelStyleSheetsEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getModelStyleSheets_Stylesheets() {
- return (EReference)modelStyleSheetsEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getStyleSheet() {
- return styleSheetEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getStyleSheetReference() {
- return styleSheetReferenceEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getStyleSheetReference_Path() {
- return (EAttribute)styleSheetReferenceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getEmbeddedStyleSheet() {
- return embeddedStyleSheetEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getEmbeddedStyleSheet_Label() {
- return (EAttribute)embeddedStyleSheetEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getEmbeddedStyleSheet_Content() {
- return (EAttribute)embeddedStyleSheetEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public StylesheetsFactory getStylesheetsFactory() {
- return (StylesheetsFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated) return;
- isCreated = true;
-
- // Create classes and their features
- modelStyleSheetsEClass = createEClass(MODEL_STYLE_SHEETS);
- createEReference(modelStyleSheetsEClass, MODEL_STYLE_SHEETS__STYLESHEETS);
-
- styleSheetEClass = createEClass(STYLE_SHEET);
-
- styleSheetReferenceEClass = createEClass(STYLE_SHEET_REFERENCE);
- createEAttribute(styleSheetReferenceEClass, STYLE_SHEET_REFERENCE__PATH);
-
- embeddedStyleSheetEClass = createEClass(EMBEDDED_STYLE_SHEET);
- createEAttribute(embeddedStyleSheetEClass, EMBEDDED_STYLE_SHEET__LABEL);
- createEAttribute(embeddedStyleSheetEClass, EMBEDDED_STYLE_SHEET__CONTENT);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized) return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Obtain other dependent packages
- EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
-
- // Create type parameters
-
- // Set bounds for type parameters
-
- // Add supertypes to classes
- modelStyleSheetsEClass.getESuperTypes().add(theEcorePackage.getEModelElement());
- styleSheetReferenceEClass.getESuperTypes().add(this.getStyleSheet());
- embeddedStyleSheetEClass.getESuperTypes().add(this.getStyleSheet());
-
- // Initialize classes and features; add operations and parameters
- 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(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);
-
- initEClass(embeddedStyleSheetEClass, EmbeddedStyleSheet.class, "EmbeddedStyleSheet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getEmbeddedStyleSheet_Label(), ecorePackage.getEString(), "label", null, 0, 1, EmbeddedStyleSheet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEmbeddedStyleSheet_Content(), theEcorePackage.getEString(), "content", null, 1, 1, EmbeddedStyleSheet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- // Create resource
- createResource(eNS_URI);
- }
-
-} //StylesheetsPackageImpl
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StylesheetsPackageImpl extends EPackageImpl implements StylesheetsPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass modelStyleSheetsEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass styleSheetEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass styleSheetReferenceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass embeddedStyleSheetEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass workspaceThemesEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass themeEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private StylesheetsPackageImpl() {
+ super(eNS_URI, StylesheetsFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link StylesheetsPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static StylesheetsPackage init() {
+ if (isInited) return (StylesheetsPackage)EPackage.Registry.INSTANCE.getEPackage(StylesheetsPackage.eNS_URI);
+
+ // Obtain or create and register package
+ StylesheetsPackageImpl theStylesheetsPackage = (StylesheetsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof StylesheetsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new StylesheetsPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theStylesheetsPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theStylesheetsPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theStylesheetsPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(StylesheetsPackage.eNS_URI, theStylesheetsPackage);
+ return theStylesheetsPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getModelStyleSheets() {
+ return modelStyleSheetsEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getModelStyleSheets_Stylesheets() {
+ return (EReference)modelStyleSheetsEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStyleSheet() {
+ return styleSheetEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStyleSheetReference() {
+ return styleSheetReferenceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getStyleSheetReference_Path() {
+ return (EAttribute)styleSheetReferenceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getEmbeddedStyleSheet() {
+ return embeddedStyleSheetEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getEmbeddedStyleSheet_Label() {
+ return (EAttribute)embeddedStyleSheetEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getEmbeddedStyleSheet_Content() {
+ return (EAttribute)embeddedStyleSheetEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getWorkspaceThemes() {
+ return workspaceThemesEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getWorkspaceThemes_Themes() {
+ return (EReference)workspaceThemesEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getTheme() {
+ return themeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getTheme_Id() {
+ return (EAttribute)themeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getTheme_Label() {
+ return (EAttribute)themeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getTheme_Icon() {
+ return (EAttribute)themeEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getTheme_Stylesheets() {
+ return (EReference)themeEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StylesheetsFactory getStylesheetsFactory() {
+ return (StylesheetsFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ modelStyleSheetsEClass = createEClass(MODEL_STYLE_SHEETS);
+ createEReference(modelStyleSheetsEClass, MODEL_STYLE_SHEETS__STYLESHEETS);
+
+ styleSheetEClass = createEClass(STYLE_SHEET);
+
+ styleSheetReferenceEClass = createEClass(STYLE_SHEET_REFERENCE);
+ createEAttribute(styleSheetReferenceEClass, STYLE_SHEET_REFERENCE__PATH);
+
+ embeddedStyleSheetEClass = createEClass(EMBEDDED_STYLE_SHEET);
+ createEAttribute(embeddedStyleSheetEClass, EMBEDDED_STYLE_SHEET__LABEL);
+ createEAttribute(embeddedStyleSheetEClass, EMBEDDED_STYLE_SHEET__CONTENT);
+
+ workspaceThemesEClass = createEClass(WORKSPACE_THEMES);
+ createEReference(workspaceThemesEClass, WORKSPACE_THEMES__THEMES);
+
+ themeEClass = createEClass(THEME);
+ createEAttribute(themeEClass, THEME__ID);
+ createEAttribute(themeEClass, THEME__LABEL);
+ createEAttribute(themeEClass, THEME__ICON);
+ createEReference(themeEClass, THEME__STYLESHEETS);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ modelStyleSheetsEClass.getESuperTypes().add(theEcorePackage.getEModelElement());
+ styleSheetReferenceEClass.getESuperTypes().add(this.getStyleSheet());
+ embeddedStyleSheetEClass.getESuperTypes().add(this.getStyleSheet());
+ workspaceThemesEClass.getESuperTypes().add(theEcorePackage.getEModelElement());
+
+ // Initialize classes and features; add operations and parameters
+ 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(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);
+
+ initEClass(embeddedStyleSheetEClass, EmbeddedStyleSheet.class, "EmbeddedStyleSheet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEmbeddedStyleSheet_Label(), ecorePackage.getEString(), "label", null, 0, 1, EmbeddedStyleSheet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEmbeddedStyleSheet_Content(), theEcorePackage.getEString(), "content", null, 1, 1, EmbeddedStyleSheet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(workspaceThemesEClass, WorkspaceThemes.class, "WorkspaceThemes", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getWorkspaceThemes_Themes(), this.getTheme(), null, "themes", null, 0, -1, WorkspaceThemes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(themeEClass, Theme.class, "Theme", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getTheme_Id(), theEcorePackage.getEString(), "id", "", 0, 1, Theme.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
+ initEAttribute(getTheme_Label(), theEcorePackage.getEString(), "label", null, 0, 1, Theme.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTheme_Icon(), theEcorePackage.getEString(), "icon", null, 0, 1, Theme.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTheme_Stylesheets(), this.getStyleSheet(), null, "stylesheets", null, 0, -1, Theme.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //StylesheetsPackageImpl
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/ThemeImpl.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/ThemeImpl.java
new file mode 100644
index 0000000..3b2fe7b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/ThemeImpl.java
@@ -0,0 +1,327 @@
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Theme</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl#getLabel <em>Label</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl#getIcon <em>Icon</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.ThemeImpl#getStylesheets <em>Stylesheets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ThemeImpl extends EObjectImpl implements Theme {
+
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_EDEFAULT = "";
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLabel()
+ * @generated
+ * @ordered
+ */
+ protected static final String LABEL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLabel()
+ * @generated
+ * @ordered
+ */
+ protected String label = LABEL_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getIcon() <em>Icon</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIcon()
+ * @generated
+ * @ordered
+ */
+ protected static final String ICON_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getIcon() <em>Icon</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIcon()
+ * @generated
+ * @ordered
+ */
+ protected String icon = ICON_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getStylesheets() <em>Stylesheets</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStylesheets()
+ * @generated
+ * @ordered
+ */
+ protected EList<StyleSheet> stylesheets;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ThemeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StylesheetsPackage.Literals.THEME;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setId(String newId) {
+ String oldId = id;
+ id = newId;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StylesheetsPackage.THEME__ID, oldId, id));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLabel(String newLabel) {
+ String oldLabel = label;
+ label = newLabel;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StylesheetsPackage.THEME__LABEL, oldLabel, label));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getIcon() {
+ return icon;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setIcon(String newIcon) {
+ String oldIcon = icon;
+ icon = newIcon;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StylesheetsPackage.THEME__ICON, oldIcon, icon));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<StyleSheet> getStylesheets() {
+ if (stylesheets == null) {
+ stylesheets = new EObjectContainmentEList<StyleSheet>(StyleSheet.class, this, StylesheetsPackage.THEME__STYLESHEETS);
+ }
+ return stylesheets;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StylesheetsPackage.THEME__STYLESHEETS:
+ return ((InternalEList<?>)getStylesheets()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case StylesheetsPackage.THEME__ID:
+ return getId();
+ case StylesheetsPackage.THEME__LABEL:
+ return getLabel();
+ case StylesheetsPackage.THEME__ICON:
+ return getIcon();
+ case StylesheetsPackage.THEME__STYLESHEETS:
+ return getStylesheets();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case StylesheetsPackage.THEME__ID:
+ setId((String)newValue);
+ return;
+ case StylesheetsPackage.THEME__LABEL:
+ setLabel((String)newValue);
+ return;
+ case StylesheetsPackage.THEME__ICON:
+ setIcon((String)newValue);
+ return;
+ case StylesheetsPackage.THEME__STYLESHEETS:
+ getStylesheets().clear();
+ getStylesheets().addAll((Collection<? extends StyleSheet>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case StylesheetsPackage.THEME__ID:
+ setId(ID_EDEFAULT);
+ return;
+ case StylesheetsPackage.THEME__LABEL:
+ setLabel(LABEL_EDEFAULT);
+ return;
+ case StylesheetsPackage.THEME__ICON:
+ setIcon(ICON_EDEFAULT);
+ return;
+ case StylesheetsPackage.THEME__STYLESHEETS:
+ getStylesheets().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case StylesheetsPackage.THEME__ID:
+ return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
+ case StylesheetsPackage.THEME__LABEL:
+ return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
+ case StylesheetsPackage.THEME__ICON:
+ return ICON_EDEFAULT == null ? icon != null : !ICON_EDEFAULT.equals(icon);
+ case StylesheetsPackage.THEME__STYLESHEETS:
+ return stylesheets != null && !stylesheets.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (id: ");
+ result.append(id);
+ result.append(", label: ");
+ result.append(label);
+ result.append(", icon: ");
+ result.append(icon);
+ result.append(')');
+ return result.toString();
+ }
+
+} //ThemeImpl
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/WorkspaceThemesImpl.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/WorkspaceThemesImpl.java
new file mode 100644
index 0000000..e4844ff
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/impl/WorkspaceThemesImpl.java
@@ -0,0 +1,152 @@
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.EModelElementImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Workspace Themes</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.impl.WorkspaceThemesImpl#getThemes <em>Themes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class WorkspaceThemesImpl extends EModelElementImpl implements WorkspaceThemes {
+ /**
+ * The cached value of the '{@link #getThemes() <em>Themes</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getThemes()
+ * @generated
+ * @ordered
+ */
+ protected EList<Theme> themes;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected WorkspaceThemesImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StylesheetsPackage.Literals.WORKSPACE_THEMES;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Theme> getThemes() {
+ if (themes == null) {
+ themes = new EObjectContainmentEList<Theme>(Theme.class, this, StylesheetsPackage.WORKSPACE_THEMES__THEMES);
+ }
+ return themes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StylesheetsPackage.WORKSPACE_THEMES__THEMES:
+ return ((InternalEList<?>)getThemes()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case StylesheetsPackage.WORKSPACE_THEMES__THEMES:
+ return getThemes();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case StylesheetsPackage.WORKSPACE_THEMES__THEMES:
+ getThemes().clear();
+ getThemes().addAll((Collection<? extends Theme>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case StylesheetsPackage.WORKSPACE_THEMES__THEMES:
+ getThemes().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case StylesheetsPackage.WORKSPACE_THEMES__THEMES:
+ return themes != null && !themes.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //WorkspaceThemesImpl
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsAdapterFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsAdapterFactory.java
index 0f08df5..02cbba1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsAdapterFactory.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsAdapterFactory.java
@@ -1,194 +1,231 @@
-/**
- */
-package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage
- * @generated
- */
-public class StylesheetsAdapterFactory extends AdapterFactoryImpl {
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static StylesheetsPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public StylesheetsAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = StylesheetsPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject)object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch that delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected StylesheetsSwitch<Adapter> modelSwitch =
- new StylesheetsSwitch<Adapter>() {
- @Override
- public Adapter caseModelStyleSheets(ModelStyleSheets object) {
- return createModelStyleSheetsAdapter();
- }
- @Override
- public Adapter caseStyleSheet(StyleSheet object) {
- return createStyleSheetAdapter();
- }
- @Override
- public Adapter caseStyleSheetReference(StyleSheetReference object) {
- return createStyleSheetReferenceAdapter();
- }
- @Override
- public Adapter caseEmbeddedStyleSheet(EmbeddedStyleSheet object) {
- return createEmbeddedStyleSheetAdapter();
- }
- @Override
- public Adapter caseEModelElement(EModelElement object) {
- return createEModelElementAdapter();
- }
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject)target);
- }
-
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets <em>Model Style Sheets</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets
- * @generated
- */
- public Adapter createModelStyleSheetsAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet <em>Style Sheet</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
- * @generated
- */
- public Adapter createStyleSheetAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference <em>Style Sheet Reference</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference
- * @generated
- */
- public Adapter createStyleSheetReferenceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet <em>Embedded Style Sheet</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet
- * @generated
- */
- public Adapter createEmbeddedStyleSheetAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.ecore.EModelElement
- * @generated
- */
- public Adapter createEModelElementAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} //StylesheetsAdapterFactory
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.*;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage
+ * @generated
+ */
+public class StylesheetsAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static StylesheetsPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StylesheetsAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = StylesheetsPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StylesheetsSwitch<Adapter> modelSwitch =
+ new StylesheetsSwitch<Adapter>() {
+ @Override
+ public Adapter caseModelStyleSheets(ModelStyleSheets object) {
+ return createModelStyleSheetsAdapter();
+ }
+ @Override
+ public Adapter caseStyleSheet(StyleSheet object) {
+ return createStyleSheetAdapter();
+ }
+ @Override
+ public Adapter caseStyleSheetReference(StyleSheetReference object) {
+ return createStyleSheetReferenceAdapter();
+ }
+ @Override
+ public Adapter caseEmbeddedStyleSheet(EmbeddedStyleSheet object) {
+ return createEmbeddedStyleSheetAdapter();
+ }
+ @Override
+ public Adapter caseWorkspaceThemes(WorkspaceThemes object) {
+ return createWorkspaceThemesAdapter();
+ }
+ @Override
+ public Adapter caseTheme(Theme object) {
+ return createThemeAdapter();
+ }
+ @Override
+ public Adapter caseEModelElement(EModelElement object) {
+ return createEModelElementAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets <em>Model Style Sheets</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets
+ * @generated
+ */
+ public Adapter createModelStyleSheetsAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet <em>Style Sheet</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet
+ * @generated
+ */
+ public Adapter createStyleSheetAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference <em>Style Sheet Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference
+ * @generated
+ */
+ public Adapter createStyleSheetReferenceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet <em>Embedded Style Sheet</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet
+ * @generated
+ */
+ public Adapter createEmbeddedStyleSheetAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes <em>Workspace Themes</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes
+ * @generated
+ */
+ public Adapter createWorkspaceThemesAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme <em>Theme</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme
+ * @generated
+ */
+ public Adapter createThemeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EModelElement
+ * @generated
+ */
+ public Adapter createEModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //StylesheetsAdapterFactory
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsSwitch.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsSwitch.java
index de7269f..9af971e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsSwitch.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.model/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/stylesheets/util/StylesheetsSwitch.java
@@ -1,194 +1,238 @@
-/**
- */
-package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.util;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.util.Switch;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
-import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage
- * @generated
- */
-public class StylesheetsSwitch<T> extends Switch<T> {
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static StylesheetsPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public StylesheetsSwitch() {
- if (modelPackage == null) {
- modelPackage = StylesheetsPackage.eINSTANCE;
- }
- }
-
- /**
- * Checks whether this is a switch for the given package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @parameter ePackage the package in question.
- * @return whether this is a switch for the given package.
- * @generated
- */
- @Override
- protected boolean isSwitchFor(EPackage ePackage) {
- return ePackage == modelPackage;
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- @Override
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case StylesheetsPackage.MODEL_STYLE_SHEETS: {
- ModelStyleSheets modelStyleSheets = (ModelStyleSheets)theEObject;
- T result = caseModelStyleSheets(modelStyleSheets);
- if (result == null) result = caseEModelElement(modelStyleSheets);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case StylesheetsPackage.STYLE_SHEET: {
- StyleSheet styleSheet = (StyleSheet)theEObject;
- T result = caseStyleSheet(styleSheet);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case StylesheetsPackage.STYLE_SHEET_REFERENCE: {
- StyleSheetReference styleSheetReference = (StyleSheetReference)theEObject;
- T result = caseStyleSheetReference(styleSheetReference);
- if (result == null) result = caseStyleSheet(styleSheetReference);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case StylesheetsPackage.EMBEDDED_STYLE_SHEET: {
- EmbeddedStyleSheet embeddedStyleSheet = (EmbeddedStyleSheet)theEObject;
- T result = caseEmbeddedStyleSheet(embeddedStyleSheet);
- if (result == null) result = caseStyleSheet(embeddedStyleSheet);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- default: return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Model Style Sheets</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Model Style Sheets</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseModelStyleSheets(ModelStyleSheets object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Style Sheet</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Style Sheet</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseStyleSheet(StyleSheet object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Style Sheet Reference</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Style Sheet Reference</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseStyleSheetReference(StyleSheetReference object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Embedded Style Sheet</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Embedded Style Sheet</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseEmbeddedStyleSheet(EmbeddedStyleSheet object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseEModelElement(EModelElement object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- @Override
- public T defaultCase(EObject object) {
- return null;
- }
-
-} //StylesheetsSwitch
+/**
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.util;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.Switch;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.*;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsPackage
+ * @generated
+ */
+public class StylesheetsSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static StylesheetsPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StylesheetsSwitch() {
+ if (modelPackage == null) {
+ modelPackage = StylesheetsPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case StylesheetsPackage.MODEL_STYLE_SHEETS: {
+ ModelStyleSheets modelStyleSheets = (ModelStyleSheets)theEObject;
+ T result = caseModelStyleSheets(modelStyleSheets);
+ if (result == null) result = caseEModelElement(modelStyleSheets);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StylesheetsPackage.STYLE_SHEET: {
+ StyleSheet styleSheet = (StyleSheet)theEObject;
+ T result = caseStyleSheet(styleSheet);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StylesheetsPackage.STYLE_SHEET_REFERENCE: {
+ StyleSheetReference styleSheetReference = (StyleSheetReference)theEObject;
+ T result = caseStyleSheetReference(styleSheetReference);
+ if (result == null) result = caseStyleSheet(styleSheetReference);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StylesheetsPackage.EMBEDDED_STYLE_SHEET: {
+ EmbeddedStyleSheet embeddedStyleSheet = (EmbeddedStyleSheet)theEObject;
+ T result = caseEmbeddedStyleSheet(embeddedStyleSheet);
+ if (result == null) result = caseStyleSheet(embeddedStyleSheet);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StylesheetsPackage.WORKSPACE_THEMES: {
+ WorkspaceThemes workspaceThemes = (WorkspaceThemes)theEObject;
+ T result = caseWorkspaceThemes(workspaceThemes);
+ if (result == null) result = caseEModelElement(workspaceThemes);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StylesheetsPackage.THEME: {
+ Theme theme = (Theme)theEObject;
+ T result = caseTheme(theme);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Model Style Sheets</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Model Style Sheets</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseModelStyleSheets(ModelStyleSheets object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Style Sheet</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Style Sheet</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStyleSheet(StyleSheet object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Style Sheet Reference</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Style Sheet Reference</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStyleSheetReference(StyleSheetReference object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Embedded Style Sheet</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Embedded Style Sheet</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmbeddedStyleSheet(EmbeddedStyleSheet object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Workspace Themes</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Workspace Themes</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseWorkspaceThemes(WorkspaceThemes object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Theme</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Theme</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTheme(Theme object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEModelElement(EModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //StylesheetsSwitch
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BrowseFileEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BrowseFileEditor.java
new file mode 100644
index 0000000..5bd901b
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BrowseFileEditor.java
@@ -0,0 +1,408 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.editors;
+
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.messages.Messages;
+import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+
+/**
+ * Specific String editor to select a file with unique button.
+ *
+ * @author gpascual
+ *
+ */
+public class BrowseFileEditor extends StringEditor {
+
+ /** Unique button with associated menu to choice where file will be selected. */
+ private Button button = null;
+
+ /** List of accepted file extensions. */
+ private List<String> filterExtensions = new ArrayList<String>();
+
+ /** List of accepted names. */
+ private List<String> filterNames = new ArrayList<String>();
+
+ /** Attribute to allow file from workspace. */
+ private boolean allowWorkspace = true;
+
+ /** Attribute to allow file from file system. */
+ private boolean allowFileSystem = true;
+
+ /** Attribute for writing rights. */
+ private boolean readOnly = false;
+
+ /** Menu of file system. */
+ private MenuItem fileSystemMenuItem = null;
+
+ /** Menu of workspace. */
+ private MenuItem workspaceMenuItem = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param parent
+ * the parent
+ * @param style
+ * the style
+ */
+ public BrowseFileEditor(Composite parent, int style) {
+ super(parent, style);
+ ((GridLayout)getLayout()).numColumns++;
+ button = factory.createButton(this, Messages.StringFileSelector_Browse, SWT.PUSH);
+ button.setLayoutData(new GridData());
+
+
+ final Menu browseMenu = createButtonMenu();
+
+
+
+ // Display menu when user select button
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ browseMenu.setVisible(true);
+ }
+ });
+
+ }
+
+
+ /**
+ * Creates the button menu.
+ *
+ * @return the menu
+ */
+ private Menu createButtonMenu() {
+ final Menu browseMenu = new Menu(button);
+
+ // Add file system menu
+ fileSystemMenuItem = new MenuItem(browseMenu, SWT.NONE);
+ fileSystemMenuItem.setText("File system");
+ fileSystemMenuItem.addSelectionListener(new SelectionAdapter() {
+
+
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ File file = getFile(text.getText());
+
+ FileDialog dialog = new FileDialog(getShell());
+ if(labelText != null) {
+ dialog.setText(labelText);
+ }
+ dialog.setFileName(file.getAbsolutePath());
+ dialog.setFilterExtensions(filterExtensions.toArray(new String[filterExtensions.size()]));
+ dialog.setFilterNames(filterNames.toArray(new String[filterNames.size()]));
+ String result = dialog.open();
+ if(result == null) { //Cancel
+ return;
+ }
+ setResult(result);
+ }
+ });
+
+ // Add workspace menu
+ workspaceMenuItem = new MenuItem(browseMenu, SWT.NONE);
+ workspaceMenuItem.setText("Workspace");
+ workspaceMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ LabelProviderService labelProviderService = new LabelProviderServiceImpl();
+ try {
+ labelProviderService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+
+ ILabelProvider labelProvider = labelProviderService.getLabelProvider();
+
+ IFile currentFile = getIFile(text.getText());
+
+ TreeSelectorDialog dialog = new TreeSelectorDialog(getShell());
+ if(labelText != null) {
+ dialog.setTitle(labelText);
+ }
+
+ WorkspaceContentProvider contentProvider = new WorkspaceContentProvider();
+
+ if(!(filterExtensions.isEmpty() || filterNames.isEmpty())) {
+ //The filters have been defined
+ contentProvider.setExtensionFilters(new LinkedHashMap<String, String>()); //Reset the default filters
+
+ //Use our own filters
+ for(int i = 0; i < Math.min(filterNames.size(), filterExtensions.size()); i++) {
+ contentProvider.addExtensionFilter(filterExtensions.get(i), filterNames.get(i));
+ }
+ }
+
+ dialog.setContentProvider(contentProvider);
+ dialog.setLabelProvider(labelProvider);
+
+
+ if(currentFile != null && currentFile.exists()) {
+ dialog.setInitialSelections(new IFile[]{ currentFile });
+ }
+
+ int code = dialog.open();
+ if(code == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ Object file = result[0];
+ if(file instanceof IFile) {
+ setResult((IFile)file);
+ }
+ }
+ }
+ }
+ });
+
+ return browseMenu;
+ }
+
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(IFile file) {
+ text.setText(file.getFullPath().toString());
+ notifyChange();
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param file
+ * the new result
+ */
+ protected void setResult(File file) {
+ text.setText(file.getAbsolutePath());
+ notifyChange();
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param path
+ * the new result
+ */
+ protected void setResult(String path) {
+ text.setText(path);
+ notifyChange();
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the i file
+ */
+ protected IFile getIFile(String path) {
+ return FileUtil.getIFile(path);
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @param path
+ * the path
+ * @return the file
+ */
+ protected File getFile(String path) {
+ return FileUtil.getFile(path);
+ }
+
+ /**
+ * Sets the filters.
+ *
+ * @param filterExtensions
+ * the filter extensions
+ * @param filterNames
+ * the filter names
+ */
+ public void setFilters(String[] filterExtensions, String[] filterNames) {
+ if(filterExtensions.length != filterNames.length) {
+ //This is a simple warning. Only valid filters will be retained.
+ Activator.log.warn("FilterExtensions and FilterNames do not match");
+ }
+
+ setFilterNames(getFilterLabels(filterNames, filterExtensions));
+ setFilterExtensions(filterExtensions);
+ }
+
+ /**
+ * Gets the filter labels.
+ *
+ * @param filterNames
+ * the filter names
+ * @param filterExtensions
+ * the filter extensions
+ * @return the filter labels
+ */
+ protected String[] getFilterLabels(String[] filterNames, String[] filterExtensions) {
+ int size = Math.min(filterNames.length, filterExtensions.length);
+ String[] filters = new String[size];
+ for(int i = 0; i < size; i++) {
+ filters[i] = filterNames[i] + " (" + filterExtensions[i] + ")";
+ }
+ return filters;
+ }
+
+ /**
+ * Sets the filter extensions.
+ *
+ * @param filterExtensions
+ * the new filter extensions
+ */
+ public void setFilterExtensions(String[] filterExtensions) {
+ this.filterExtensions = Arrays.asList(filterExtensions);
+ }
+
+ /**
+ * Sets the filter names.
+ *
+ * @param filterNames
+ * the new filter names
+ */
+ public void setFilterNames(String[] filterNames) {
+ this.filterNames = Arrays.asList(filterNames);
+ }
+
+ /**
+ * Adds the filtered extension.
+ *
+ * @param filteredExtension
+ * the filtered extension
+ * @param filterName
+ * the filter name
+ */
+ public void addFilteredExtension(String filteredExtension, String filterName) {
+ if(filteredExtension != null) {
+ if(filterName == null) {
+ filterName = filteredExtension;
+ }
+
+ filterExtensions.add(filteredExtension);
+ filterNames.add(filterName);
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.editors.StringEditor#getEditableType()
+ *
+ * @return
+ */
+
+ @Override
+ public Object getEditableType() {
+ return String.class;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.editors.StringEditor#setReadOnly(boolean)
+ *
+ * @param readOnly
+ */
+
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ super.setReadOnly(readOnly);
+ this.readOnly = readOnly;
+ updateButtons();
+ }
+
+ /**
+ * Sets the allow workspace.
+ *
+ * @param allowWorkspace
+ * the new allow workspace
+ */
+ public void setAllowWorkspace(boolean allowWorkspace) {
+ this.allowWorkspace = allowWorkspace;
+ updateButtons();
+ }
+
+ /**
+ * Sets the allow file system.
+ *
+ * @param allowFileSystem
+ * the new allow file system
+ */
+ public void setAllowFileSystem(boolean allowFileSystem) {
+
+ this.allowFileSystem = allowFileSystem;
+ updateButtons();
+ }
+
+ /**
+ * Sets the button label.
+ *
+ * @param label
+ * the new button label
+ */
+ public void setButtonLabel(String label) {
+ button.setText(label);
+ }
+
+ /**
+ * Gets the button label.
+ *
+ * @return the button label
+ */
+ public String getButtonLabel() {
+ return button.getText();
+ }
+
+ /**
+ * Update buttons.
+ */
+ private void updateButtons() {
+ boolean enableWorkspace = !readOnly && allowWorkspace;
+ boolean enableFileSystem = !readOnly && allowFileSystem;
+ //((GridData)browseWorkspace.getLayoutData()).exclude = !allowWorkspace;
+ //((GridData)browse.getLayoutData()).exclude = !allowFileSystem;
+ fileSystemMenuItem.setEnabled(enableWorkspace);
+ workspaceMenuItem.setEnabled(enableFileSystem);
+ }
+}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi
index b311164..6bf05b5 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi
@@ -1,55 +1,56 @@
-<?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">
- <constraintTypes label="EMF Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/>
- <constraintTypes label="True Constraint (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/>
- <constraintTypes label="EMF Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/>
- <constraintTypes label="Java Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/>
- <constraintTypes label="Java Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/>
- <modelElementFactories name="EMF Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.EMFModelElementFactory"/>
- <modelElementFactories name="Annotation Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.AnnotationModelElementFactory"/>
- <modelElementFactories name="Basic preferences Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.PreferencesModelElementFactory"/>
- <widgetTypes label="Label" widgetClass="Label"/>
- <widgetTypes label="Text" widgetClass="Text"/>
- <widgetTypes label="Button" widgetClass="Button"/>
- <propertyEditorTypes label="StringEditor" widgetClass="StringEditor" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringMultiline" widgetClass="StringMultiline" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringLabel (Read-only)" widgetClass="StringLabel" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringCombo" widgetClass="StringCombo" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="FileSelector" widgetClass="StringFileSelector" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="BooleanCombo" widgetClass="BooleanCombo" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="BooleanCheckbox" widgetClass="BooleanCheckbox" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="BooleanRadio" widgetClass="BooleanRadio" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="BooleanToggle" widgetClass="BooleanToggle" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="IntegerEditor" widgetClass="IntegerEditor" namespace="//@namespaces.3" type="Integer"/>
- <propertyEditorTypes label="IntegerSpinner" widgetClass="IntegerSpinner" namespace="//@namespaces.3" type="Integer"/>
- <propertyEditorTypes label="EnumCombo" widgetClass="EnumCombo" namespace="//@namespaces.3" type="Enumeration"/>
- <propertyEditorTypes label="EnumRadio (No preview)" widgetClass="EnumRadio" namespace="//@namespaces.3" type="Enumeration"/>
- <propertyEditorTypes label="ReferenceCombo" widgetClass="ReferenceCombo" namespace="//@namespaces.3" type="Reference"/>
- <propertyEditorTypes label="ReferenceDialog" widgetClass="ReferenceDialog" namespace="//@namespaces.3" type="Reference"/>
- <propertyEditorTypes label="ViewEditor" widgetClass="ViewEditor" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
- <propertyEditorTypes label="ReferenceLabel (Read-only)" widgetClass="ReferenceLabel" namespace="//@namespaces.3" type="Reference"/>
- <propertyEditorTypes label="MultiReference" widgetClass="MultiReference" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
- <propertyEditorTypes label="MultiReferenceWithPropertyView" widgetClass="MultiReferencePropertyEditorWithPropertyView" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
- <propertyEditorTypes label="MultiString" widgetClass="MultiString" namespace="//@namespaces.3" multiplicity="-1"/>
- <propertyEditorTypes label="MultipleFileEditor" widgetClass="MultiStringFile" namespace="//@namespaces.3" multiplicity="-1"/>
- <propertyEditorTypes label="MultiInteger" widgetClass="MultiInteger" namespace="//@namespaces.3" type="Integer" multiplicity="-1"/>
- <propertyEditorTypes label="InvalidWidget" widgetClass="InvalidWidget" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringMultiline with References" widgetClass="StringMultilineWithReferences" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="FloatEditor" widgetClass="FloatEditor" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="DoubleEditor" widgetClass="DoubleEditor" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="UnlimitedNaturalEditor" widgetClass="UnlimitedNaturalEditor" namespace="//@namespaces.3"/>
- <compositeWidgetTypes label="Composite" widgetClass="Composite"/>
- <compositeWidgetTypes label="Group" widgetClass="Group"/>
- <layoutTypes label="GridLayout" widgetClass="GridLayout"/>
- <layoutTypes label="FillLayout" widgetClass="FillLayout"/>
- <layoutTypes label="RowLayout" widgetClass="RowLayout"/>
- <layoutTypes label="PropertiesLayout" widgetClass="PropertiesLayout" namespace="//@namespaces.4"/>
- <namespaces prefix="" name="" value="http://www.eclipse.org/xwt/presentation"/>
- <namespaces prefix="" name="x" value="http://www.eclipse.org/xwt"/>
- <namespaces name="j" value="java.lang"/>
- <namespaces name="ppe" value="org.eclipse.papyrus.views.properties.widgets"/>
- <namespaces name="ppel" value="org.eclipse.papyrus.views.properties.widgets.layout"/>
- <namespaces name="ppec" value="org.eclipse.papyrus.views.properties.creation"/>
- <miscClasses label="EMF object factory" class="EcorePropertyEditorFactory" namespace="//@namespaces.5"/>
- <miscClasses label="Property view Edition factory" class="PropertyEditorFactory" namespace="//@namespaces.5"/>
-</environment:Environment>
+<?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">
+ <constraintTypes label="EMF Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/>
+ <constraintTypes label="True Constraint (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/>
+ <constraintTypes label="EMF Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/>
+ <constraintTypes label="Java Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/>
+ <constraintTypes label="Java Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/>
+ <modelElementFactories name="EMF Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.EMFModelElementFactory"/>
+ <modelElementFactories name="Annotation Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.AnnotationModelElementFactory"/>
+ <modelElementFactories name="Basic preferences Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.PreferencesModelElementFactory"/>
+ <widgetTypes label="Label" widgetClass="Label"/>
+ <widgetTypes label="Text" widgetClass="Text"/>
+ <widgetTypes label="Button" widgetClass="Button"/>
+ <propertyEditorTypes label="StringEditor" widgetClass="StringEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringMultiline" widgetClass="StringMultiline" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringLabel (Read-only)" widgetClass="StringLabel" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringCombo" widgetClass="StringCombo" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="FileSelector" widgetClass="StringFileSelector" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="BooleanCombo" widgetClass="BooleanCombo" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="BooleanCheckbox" widgetClass="BooleanCheckbox" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="BooleanRadio" widgetClass="BooleanRadio" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="BooleanToggle" widgetClass="BooleanToggle" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="IntegerEditor" widgetClass="IntegerEditor" namespace="//@namespaces.3" type="Integer"/>
+ <propertyEditorTypes label="IntegerSpinner" widgetClass="IntegerSpinner" namespace="//@namespaces.3" type="Integer"/>
+ <propertyEditorTypes label="EnumCombo" widgetClass="EnumCombo" namespace="//@namespaces.3" type="Enumeration"/>
+ <propertyEditorTypes label="EnumRadio (No preview)" widgetClass="EnumRadio" namespace="//@namespaces.3" type="Enumeration"/>
+ <propertyEditorTypes label="ReferenceCombo" widgetClass="ReferenceCombo" namespace="//@namespaces.3" type="Reference"/>
+ <propertyEditorTypes label="ReferenceDialog" widgetClass="ReferenceDialog" namespace="//@namespaces.3" type="Reference"/>
+ <propertyEditorTypes label="ViewEditor" widgetClass="ViewEditor" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
+ <propertyEditorTypes label="ReferenceLabel (Read-only)" widgetClass="ReferenceLabel" namespace="//@namespaces.3" type="Reference"/>
+ <propertyEditorTypes label="MultiReference" widgetClass="MultiReference" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
+ <propertyEditorTypes label="MultiReferenceWithPropertyView" widgetClass="MultiReferencePropertyEditorWithPropertyView" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
+ <propertyEditorTypes label="MultiString" widgetClass="MultiString" namespace="//@namespaces.3" multiplicity="-1"/>
+ <propertyEditorTypes label="MultipleFileEditor" widgetClass="MultiStringFile" namespace="//@namespaces.3" multiplicity="-1"/>
+ <propertyEditorTypes label="MultiInteger" widgetClass="MultiInteger" namespace="//@namespaces.3" type="Integer" multiplicity="-1"/>
+ <propertyEditorTypes label="InvalidWidget" widgetClass="InvalidWidget" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringMultiline with References" widgetClass="StringMultilineWithReferences" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="FloatEditor" widgetClass="FloatEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="DoubleEditor" widgetClass="DoubleEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="UnlimitedNaturalEditor" widgetClass="UnlimitedNaturalEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="Browse Path Button" widgetClass="BrowseFilePropertyEditor" namespace="//@namespaces.3"/>
+ <compositeWidgetTypes label="Composite" widgetClass="Composite"/>
+ <compositeWidgetTypes label="Group" widgetClass="Group"/>
+ <layoutTypes label="GridLayout" widgetClass="GridLayout"/>
+ <layoutTypes label="FillLayout" widgetClass="FillLayout"/>
+ <layoutTypes label="RowLayout" widgetClass="RowLayout"/>
+ <layoutTypes label="PropertiesLayout" widgetClass="PropertiesLayout" namespace="//@namespaces.4"/>
+ <namespaces prefix="" name="" value="http://www.eclipse.org/xwt/presentation"/>
+ <namespaces prefix="" name="x" value="http://www.eclipse.org/xwt"/>
+ <namespaces name="j" value="java.lang"/>
+ <namespaces name="ppe" value="org.eclipse.papyrus.views.properties.widgets"/>
+ <namespaces name="ppel" value="org.eclipse.papyrus.views.properties.widgets.layout"/>
+ <namespaces name="ppec" value="org.eclipse.papyrus.views.properties.creation"/>
+ <miscClasses label="EMF object factory" class="EcorePropertyEditorFactory" namespace="//@namespaces.5"/>
+ <miscClasses label="Property view Edition factory" class="PropertyEditorFactory" namespace="//@namespaces.5"/>
+</environment:Environment>
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java
new file mode 100644
index 0000000..a2d0f07
--- /dev/null
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.widgets;
+
+import org.eclipse.papyrus.infra.widgets.editors.BrowseFileEditor;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * Property editor for attribute that need a file selection.
+ * Its display have unique button with an associated menu to choice where file comes frome.
+ */
+public class BrowseFilePropertyEditor extends AbstractPropertyEditor {
+
+ /** The browse file editor. */
+ private BrowseFileEditor browseFileEditor = null;
+
+ /** The filtered extensions This should be a 1-1 mapping with {@link #filterNames}. */
+ protected String[] filterExtensions = null;
+
+ /**
+ * The name of the filters.
+ * This should be a 1-1 mapping with {@link #filterExtensions}
+ */
+ protected String[] filterNames = null;
+
+ /** Enables the "browse workspace" feature. */
+ protected boolean allowWorkspace = true;
+
+ /** Enables the "browse file system" feature. */
+ protected boolean allowFileSystem = true;
+
+ /**
+ * Instantiates a new browse file property editor.
+ *
+ * @param parent
+ * the parent
+ * @param style
+ * the style
+ */
+ public BrowseFilePropertyEditor(Composite parent, int style) {
+ browseFileEditor = createBrowseFileEditor(parent, style);
+ super.setEditor(browseFileEditor);
+ }
+
+ /**
+ * Set label to browse button.
+ *
+ * @param buttonLabel
+ * Label to set
+ */
+ public void setButtonLabel(String buttonLabel) {
+ browseFileEditor.setButtonLabel(buttonLabel);
+ }
+
+
+ /**
+ * @return Label of browse button
+ */
+ public String getButtonLabel() {
+ return browseFileEditor.getButtonLabel();
+ }
+
+ /**
+ * Creates the browse file editor.
+ *
+ * @param parent
+ * the parent
+ * @param style
+ * the style
+ * @return the browse file editor
+ */
+ private BrowseFileEditor createBrowseFileEditor(Composite parent, int style) {
+
+ return new BrowseFileEditor(parent, style);
+ }
+
+ /**
+ * Sets the filter extensions.
+ *
+ * @param filterExtensions
+ * the new filter extensions
+ */
+ public void setFilterExtensions(String[] filterExtensions) {
+ this.filterExtensions = filterExtensions;
+ checkFilters();
+ }
+
+ /**
+ * Gets the filter extensions.
+ *
+ * @return the filter extensions
+ */
+ public String[] getFilterExtensions() {
+ return this.filterExtensions;
+ }
+
+ /**
+ * Sets the filter names.
+ *
+ * @param filterNames
+ * the new filter names
+ */
+ public void setFilterNames(String[] filterNames) {
+ this.filterNames = filterNames;
+ checkFilters();
+ }
+
+ /**
+ * Gets the filter names.
+ *
+ * @return the filter names
+ */
+ public String[] getFilterNames() {
+ return this.filterNames;
+ }
+
+ /**
+ * Checks if the filters are valid.
+ */
+ protected void checkFilters() {
+ if(filterExtensions != null && filterNames != null) {
+ browseFileEditor.setFilters(filterExtensions, filterNames);
+ }
+ }
+
+ /**
+ * Indicates whether the editor should allow browsing the workspace or not.
+ *
+ * @param allowWorkspace
+ * the new allow workspace
+ */
+ public void setAllowWorkspace(boolean allowWorkspace) {
+ this.allowWorkspace = allowWorkspace;
+ browseFileEditor.setAllowWorkspace(allowWorkspace);
+ }
+
+ /**
+ * Gets the allow workspace.
+ *
+ * @return true if the editor can browse the workspace
+ */
+ public boolean getAllowWorkspace() {
+ return allowWorkspace;
+ }
+
+ /**
+ * Indicates whether the editor should allow browsing the file system or not.
+ *
+ * @param allowFileSystem
+ * the new allow file system
+ */
+ public void setAllowFileSystem(boolean allowFileSystem) {
+ this.allowFileSystem = allowFileSystem;
+ browseFileEditor.setAllowFileSystem(allowFileSystem);
+ }
+
+ /**
+ * Gets the allow file system.
+ *
+ * @return true if the editor can browse the fileSystem
+ */
+ public boolean getAllowFileSystem() {
+ return allowFileSystem;
+ }
+}