Introduce CMS Theme
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 15 Mar 2018 17:51:58 +0000 (18:51 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 15 Mar 2018 17:51:58 +0000 (18:51 +0100)
12 files changed:
dep/org.argeo.dep.cms.node/pom.xml
org.argeo.cms.ui.theme/.classpath [new file with mode: 0644]
org.argeo.cms.ui.theme/.gitignore [new file with mode: 0644]
org.argeo.cms.ui.theme/.project [new file with mode: 0644]
org.argeo.cms.ui.theme/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.argeo.cms.ui.theme/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
org.argeo.cms.ui.theme/META-INF/.gitignore [new file with mode: 0644]
org.argeo.cms.ui.theme/bnd.bnd [new file with mode: 0644]
org.argeo.cms.ui.theme/build.properties [new file with mode: 0644]
org.argeo.cms.ui.theme/pom.xml [new file with mode: 0644]
org.argeo.cms.ui.theme/src/org/argeo/cms/ui/theme/CmsImages.java [new file with mode: 0644]
pom.xml

index 21537c4771ccd5147445c1664589e69f8649c7b8..bf2b9a3a4619777ad3fd54d9e9369c737f4e68b6 100644 (file)
                        <artifactId>org.argeo.cms.ui</artifactId>
                        <version>2.1.73-SNAPSHOT</version>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.commons</groupId>
+                       <artifactId>org.argeo.cms.ui.theme</artifactId>
+                       <version>2.1.73-SNAPSHOT</version>
+               </dependency>
                <dependency>
                        <groupId>org.argeo.commons</groupId>
                        <artifactId>org.argeo.enterprise</artifactId>
diff --git a/org.argeo.cms.ui.theme/.classpath b/org.argeo.cms.ui.theme/.classpath
new file mode 100644 (file)
index 0000000..eca7bdb
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.argeo.cms.ui.theme/.gitignore b/org.argeo.cms.ui.theme/.gitignore
new file mode 100644 (file)
index 0000000..09e3bc9
--- /dev/null
@@ -0,0 +1,2 @@
+/bin/
+/target/
diff --git a/org.argeo.cms.ui.theme/.project b/org.argeo.cms.ui.theme/.project
new file mode 100644 (file)
index 0000000..5f90021
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.cms.ui.theme</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.argeo.cms.ui.theme/.settings/org.eclipse.jdt.core.prefs b/org.argeo.cms.ui.theme/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..0c68a61
--- /dev/null
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.argeo.cms.ui.theme/.settings/org.eclipse.pde.core.prefs b/org.argeo.cms.ui.theme/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..f29e940
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.argeo.cms.ui.theme/META-INF/.gitignore b/org.argeo.cms.ui.theme/META-INF/.gitignore
new file mode 100644 (file)
index 0000000..4854a41
--- /dev/null
@@ -0,0 +1 @@
+/MANIFEST.MF
diff --git a/org.argeo.cms.ui.theme/bnd.bnd b/org.argeo.cms.ui.theme/bnd.bnd
new file mode 100644 (file)
index 0000000..2b2a02f
--- /dev/null
@@ -0,0 +1 @@
+Bundle-ActivationPolicy: lazy
diff --git a/org.argeo.cms.ui.theme/build.properties b/org.argeo.cms.ui.theme/build.properties
new file mode 100644 (file)
index 0000000..34d2e4d
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/org.argeo.cms.ui.theme/pom.xml b/org.argeo.cms.ui.theme/pom.xml
new file mode 100644 (file)
index 0000000..c69ab2f
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <artifactId>argeo-commons</artifactId>
+               <version>2.1.73-SNAPSHOT</version>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.cms.ui.theme</artifactId>
+       <name>CMS UI Theme</name>
+       <packaging>jar</packaging>
+       <dependencies>
+               <!-- UI -->
+               <dependency>
+                       <groupId>org.argeo.tp.rap.e4</groupId>
+                       <artifactId>org.eclipse.rap.rwt</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.rap.e4</groupId>
+                       <artifactId>org.eclipse.rap.jface</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               
+       </dependencies>
+</project>
\ No newline at end of file
diff --git a/org.argeo.cms.ui.theme/src/org/argeo/cms/ui/theme/CmsImages.java b/org.argeo.cms.ui.theme/src/org/argeo/cms/ui/theme/CmsImages.java
new file mode 100644 (file)
index 0000000..1c4d79e
--- /dev/null
@@ -0,0 +1,49 @@
+package org.argeo.cms.ui.theme;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+
+public class CmsImages {
+       private static BundleContext themeBc = FrameworkUtil.getBundle(CmsImages.class).getBundleContext();
+
+       final public static String ICONS_BASE = "icons/";
+       final public static String TYPES_BASE = ICONS_BASE + "types/";
+       final public static String ACTIONS_BASE = ICONS_BASE + "actions/";
+
+       public static Image createIcon(String name) {
+               return createImg(CmsImages.ICONS_BASE + name);
+       }
+
+       public static Image createAction(String name) {
+               return createImg(CmsImages.ACTIONS_BASE + name);
+       }
+
+       public static Image createType(String name) {
+               return createImg(CmsImages.TYPES_BASE + name);
+       }
+
+       public static Image createImg(String name) {
+               return CmsImages.createDesc(name).createImage(Display.getDefault());
+       }
+
+       public static ImageDescriptor createDesc(String name) {
+               return createDesc(themeBc, name);
+       }
+
+       public static ImageDescriptor createDesc(BundleContext bc, String name) {
+               URL url = bc.getBundle().getResource(name);
+               if (url == null)
+                       return ImageDescriptor.getMissingImageDescriptor();
+               return ImageDescriptor.createFromURL(url);
+       }
+
+       public static Image createImg(BundleContext bc, String name) {
+               return createDesc(bc, name).createImage(Display.getDefault());
+       }
+
+}
diff --git a/pom.xml b/pom.xml
index 24e17a28c0c33e043528299bb10c1029127333d2..cab81d11715fa13905d17dd13a265b07bde5207e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -31,6 +31,7 @@
                <module>org.argeo.node.api</module>
                <module>org.argeo.maintenance</module>
                <module>org.argeo.cms</module>
+               <module>org.argeo.cms.ui.theme</module>
                <module>org.argeo.cms.ui</module>
                <!-- CMS Workbench -->
                <module>org.argeo.cms.ui.workbench</module>