Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-04-26 11:47:06 +0000
committercletavernie2012-04-26 11:47:06 +0000
commitfa0142f7e4a97f8ae897bd32a016958219296eb6 (patch)
tree1891797890642da24337e186151b139e7a064925 /plugins
parentbdc0ed85fe07d781a2786655370c3026ae1bca3e (diff)
downloadorg.eclipse.papyrus-fa0142f7e4a97f8ae897bd32a016958219296eb6.tar.gz
org.eclipse.papyrus-fa0142f7e4a97f8ae897bd32a016958219296eb6.tar.xz
org.eclipse.papyrus-fa0142f7e4a97f8ae897bd32a016958219296eb6.zip
370797: [Theme] Papyrus should provide a support for CSS files on its diagrams
https://bugs.eclipse.org/bugs/show_bug.cgi?id=370797
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/plugin.xml6
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferencesPage.java35
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java32
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml1
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/initializeView.exsd102
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/IThemeInitializer.java20
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ThemeInitializerManager.java50
10 files changed, 215 insertions, 37 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
index 9d7999611cd..dd9decbdeed 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.infra.core.log;bundle-version="0.9.0",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.gmfdiag.css.xtext,
+ org.eclipse.papyrus.infra.gmfdiag.css.xtext;bundle-version="0.9.0",
org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
org.eclipse.gmf.runtime.draw2d.ui;bundle-version="1.5.0",
org.eclipse.draw2d;bundle-version="3.8.0",
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui/META-INF/MANIFEST.MF
index d8bdc830c95..cf3281dc7fc 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CSS Editor UI (Incubation)
Bundle-Vendor: Eclipse Modeling Project
-Bundle-Version: 0.9.0
+Bundle-Version: 0.9.0.qualifier
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css.xtext,
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/META-INF/MANIFEST.MF
index efbc7ef2e65..d0c7f7d8438 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CSS Editor (Incubation)
Bundle-Vendor: Eclipse Modeling Project
-Bundle-Version: 0.9.0
+Bundle-Version: 0.9.0.qualifier
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css.xtext; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext;bundle-version="2.1.0";visibility:=reexport,
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 4f8a60c1668..30358a25a26 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
@@ -78,4 +78,10 @@
</stylesheet>
</themeContribution>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.gmfdiag.common.initializeView">
+ <initializeView
+ initializeView="org.eclipse.papyrus.infra.gmfdiag.css.provider.CSSThemeInitializer">
+ </initializeView>
+ </extension>
</plugin>
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
index 2d970dbbc47..1a8c9de190f 100644
--- 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
@@ -17,7 +17,6 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
@@ -38,39 +37,7 @@ public class ThemePreferencesPage extends FieldEditorPreferencePage implements I
*
*/
public ThemePreferencesPage() {
- }
-
- /**
- *
- * Constructor.
- *
- * @param style
- */
- public ThemePreferencesPage(int style) {
- super(style);
- }
-
- /**
- *
- * Constructor.
- *
- * @param title
- * @param style
- */
- public ThemePreferencesPage(String title, int style) {
- super(title, style);
- }
-
- /**
- *
- * Constructor.
- *
- * @param title
- * @param image
- * @param style
- */
- public ThemePreferencesPage(String title, ImageDescriptor image, int style) {
- super(title, image, style);
+ super("CSS Theme", org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor("/icons/papyrus.png"), FLAT);
}
public void init(IWorkbench workbench) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java
new file mode 100644
index 00000000000..18fa469f2b0
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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.provider;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.IThemeInitializer;
+import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResource;
+
+/**
+ * A class to skip the PreferenceInitializer when the CSS support is enabled.
+ *
+ * @author Camille Letavernier
+ */
+public class CSSThemeInitializer implements IThemeInitializer {
+
+ /**
+ * Return false when the CSS support is enabled
+ */
+ public boolean usePreferenceInitializer(View view) {
+ return !(view.eResource() instanceof CSSNotationResource);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index a7a80429f2a..2ec61fd7f43 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -3,6 +3,7 @@
<plugin>
<extension-point id="nestedEditor" name="NestedEditor" schema="schema/nestedEditor.exsd"/>
+ <extension-point id="initializeView" name="initializeView" schema="schema/initializeView.exsd"/>
<extension point="org.eclipse.team.core.fileTypes">
<?gmfgen generated="true"?>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/initializeView.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/initializeView.exsd
new file mode 100644
index 00000000000..151f290e9b9
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/initializeView.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.gmfdiag.common" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.gmfdiag.common" id="initializeView" name="initializeView"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element internal="true" />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="initializeView"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="initializeView">
+ <complexType>
+ <attribute name="initializeView" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.gmfdiag.common.providers.IThemeInitializer"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/IThemeInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/IThemeInitializer.java
new file mode 100644
index 00000000000..1ff09244a5a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/IThemeInitializer.java
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * 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.common.providers;
+
+import org.eclipse.gmf.runtime.notation.View;
+
+
+public interface IThemeInitializer {
+
+ public boolean usePreferenceInitializer(View view);
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ThemeInitializerManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ThemeInitializerManager.java
new file mode 100644
index 00000000000..1e601a5b3d1
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ThemeInitializerManager.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * 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.common.providers;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+
+
+public class ThemeInitializerManager {
+
+ private static final String EXTENSION_ID = Activator.ID + ".initializeView";
+
+ public static IThemeInitializer instance = loadThemeInitializer();
+
+ private static IThemeInitializer loadThemeInitializer() {
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ for(IConfigurationElement e : config) {
+ try {
+ final IThemeInitializer initializer = (IThemeInitializer)e.createExecutableExtension("initializeView"); //$NON-NLS-1$
+ if(initializer != null) {
+ return initializer;
+ }
+ } catch (Exception ex) {
+ Activator.log.error("The plugin " + e.getContributor().getName() + " contributed an invalid extension for " + EXTENSION_ID, ex);
+ }
+ }
+
+ return new DefaultThemeInitializer();
+ }
+
+ private static class DefaultThemeInitializer implements IThemeInitializer {
+
+ public boolean usePreferenceInitializer(View view) {
+ return true;
+ }
+
+ }
+}

Back to the top