Introduce RAP main shell addon
authormbaudier <mbaudier@europe>
Tue, 3 Jul 2018 10:27:00 +0000 (12:27 +0200)
committermbaudier <mbaudier@europe>
Tue, 3 Jul 2018 10:27:00 +0000 (12:27 +0200)
org.argeo.suite.e4.rap/build.properties
org.argeo.suite.e4.rap/e4xmi/argeo-suite-rap-addons.e4xmi [new file with mode: 0644]
org.argeo.suite.e4.rap/plugin.xml [new file with mode: 0644]
org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/RapMainShellAddon.java [new file with mode: 0644]
org.argeo.suite.e4/e4xmi/argeo-office.e4xmi

index 5cd458837d533af16a29bff7830a70b80f0f34cf..8a9000c1c55b3853b73fcb8af8a0c758f222206c 100644 (file)
@@ -4,5 +4,7 @@ bin.includes = META-INF/,\
                OSGI-INF/systemE4Service.xml,\
                OSGI-INF/activitiesE4Service.xml,\
                OSGI-INF/peopleE4Service.xml,\
-               OSGI-INF/documentsE4Service.xml
+               OSGI-INF/documentsE4Service.xml,\
+               e4xmi/argeo-suite-rap-addons.e4xmi,\
+               plugin.xml
 source.. = src/
diff --git a/org.argeo.suite.e4.rap/e4xmi/argeo-suite-rap-addons.e4xmi b/org.argeo.suite.e4.rap/e4xmi/argeo-suite-rap-addons.e4xmi
new file mode 100644 (file)
index 0000000..fe4dfc8
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ASCII"?>
+<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmi:id="_aj9i0H6mEeiBecaDe-Vpfw">
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_aj9i0X6mEeiBecaDe-Vpfw" featurename="addons" parentElementId="org.argeo.suite.e4.application">
+    <elements xsi:type="application:Addon" xmi:id="_aj9i0n6mEeiBecaDe-Vpfw" elementId="org.argeo.suite.e4.addon.0" contributionURI="bundleclass://org.argeo.suite.e4.rap/org.argeo.suite.e4.rap.RapMainShellAddon"/>
+  </fragments>
+</fragment:ModelFragments>
diff --git a/org.argeo.suite.e4.rap/plugin.xml b/org.argeo.suite.e4.rap/plugin.xml
new file mode 100644 (file)
index 0000000..27fe8b9
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin>
+
+   <extension
+         id="org.argeo.suite.e4.rap.fragment"
+         point="org.eclipse.e4.workbench.model">
+      <fragment
+            uri="e4xmi/argeo-suite-rap-addons.e4xmi">
+      </fragment>
+   </extension>
+
+</plugin>
diff --git a/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/RapMainShellAddon.java b/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/RapMainShellAddon.java
new file mode 100644 (file)
index 0000000..4564e11
--- /dev/null
@@ -0,0 +1,26 @@
+package org.argeo.suite.e4.rap;
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.swt.SWT;
+
+public class RapMainShellAddon {
+       private final static String STYLE_OVERRIDE = "styleOverride";
+       private final static String SHELL_MAXIMIZED = "shellMaximized";
+
+       @PostConstruct
+       void init(EModelService modelService, MApplication application) {
+               MWindow window = (MWindow) modelService.find("org.argeo.suite.e4.trimmedwindow.main", application);
+               String currentStyle = window.getPersistedState().get(STYLE_OVERRIDE);
+               int style = 8;
+               if (currentStyle != null) {
+                       style = Integer.parseInt(currentStyle);
+               }
+               style = style | SWT.NO_TRIM;
+               window.getPersistedState().put(STYLE_OVERRIDE, Integer.toString(style));
+               window.getTags().add(SHELL_MAXIMIZED);
+       }
+}
index 21bf78e519f3c07d713da8f3c68d44582cd95e41..62a5a0838302e1a0e1ede37060bb2a6dca48b394 100644 (file)
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="ASCII"?>
 <application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_bQjNYDAVEei3AbO1ldMI0w" elementId="org.argeo.suite.e4.application">
   <children xsi:type="basic:TrimmedWindow" xmi:id="_dKIlMDAVEei3AbO1ldMI0w" elementId="org.argeo.suite.e4.trimmedwindow.main">
-    <persistedState key="styleOverride" value="8"/>
-    <tags>shellMaximized</tags>
     <children xsi:type="advanced:PerspectiveStack" xmi:id="_gm_toDAVEei3AbO1ldMI0w" elementId="org.argeo.suite.e4.perspectivestack.main">
       <children xsi:type="advanced:Perspective" xmi:id="_hr-YsDAVEei3AbO1ldMI0w" elementId="org.argeo.suite.e4.perspective.dashboard" label="%dashboard" iconURI="platform:/plugin/org.argeo.theme.argeo2/icons/types/24/dashboard.png" tooltip="%dashboard">
         <children xsi:type="basic:PartSashContainer" xmi:id="_mAC18DAVEei3AbO1ldMI0w" elementId="org.argeo.suite.e4.partsashcontainer.0" horizontal="true">