From 166532a9db4e21987d3732c576efb74872eec210 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Fri, 9 Dec 2011 22:05:25 +0000 Subject: [PATCH] Improve Maven and RPM Structure git-svn-id: https://svn.argeo.org/slc/trunk@4931 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org.argeo.slc.dep.rap-maven.target | 810 ++++++++++++++++++ .../p2.inf | 0 .../pom.xml | 2 +- .../org.argeo.slc.dep.rcp-maven.target | 760 ++++++++++++++++ .../p2.inf | 0 .../pom.xml | 27 +- .../src/main/rpm/etc/slc-rcp/config.ini | 64 ++ .../src/main/rpm/etc/slc-rcp/log4j.properties | 25 + .../src/main/rpm/usr/bin/slc-rcp | 23 + .../src/main/scripts/postinstall | 32 + dep/pom.xml | 4 +- dist/slc/pom.xml | 35 +- dist/slc/src/main/rpm/etc/slc-cl/config.ini | 22 + .../src/main/rpm/etc/slc-cl/log4j.properties | 25 + dist/slc/src/main/rpm/usr/bin/slc | 30 +- dist/slc/src/main/scripts/preinstall | 4 +- dist/slc/src/main/scripts/preremove | 4 +- .../argeo/slc/client/rcp/ClientRcpPlugin.java | 38 +- .../client/rcp/SlcSecureWorkbenchAdvisor.java | 21 +- .../rcp/SlcSecureWorkbenchWindowAdvisor.java | 17 +- 20 files changed, 1848 insertions(+), 95 deletions(-) create mode 100644 dep/org.argeo.slc.dep.rap/org.argeo.slc.dep.rap-maven.target rename dep/{org.argeo.slc.dep.sdk.rap => org.argeo.slc.dep.rap}/p2.inf (100%) rename dep/{org.argeo.slc.dep.sdk.rap => org.argeo.slc.dep.rap}/pom.xml (98%) create mode 100644 dep/org.argeo.slc.dep.rcp/org.argeo.slc.dep.rcp-maven.target rename dep/{org.argeo.slc.dep.sdk.rcp => org.argeo.slc.dep.rcp}/p2.inf (100%) rename dep/{org.argeo.slc.dep.sdk.rcp => org.argeo.slc.dep.rcp}/pom.xml (80%) create mode 100644 dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/config.ini create mode 100644 dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/log4j.properties create mode 100644 dep/org.argeo.slc.dep.rcp/src/main/rpm/usr/bin/slc-rcp create mode 100644 dep/org.argeo.slc.dep.rcp/src/main/scripts/postinstall create mode 100644 dist/slc/src/main/rpm/etc/slc-cl/config.ini create mode 100644 dist/slc/src/main/rpm/etc/slc-cl/log4j.properties diff --git a/dep/org.argeo.slc.dep.rap/org.argeo.slc.dep.rap-maven.target b/dep/org.argeo.slc.dep.rap/org.argeo.slc.dep.rap-maven.target new file mode 100644 index 000000000..602855c4e --- /dev/null +++ b/dep/org.argeo.slc.dep.rap/org.argeo.slc.dep.rap-maven.target @@ -0,0 +1,810 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dep/org.argeo.slc.dep.sdk.rap/p2.inf b/dep/org.argeo.slc.dep.rap/p2.inf similarity index 100% rename from dep/org.argeo.slc.dep.sdk.rap/p2.inf rename to dep/org.argeo.slc.dep.rap/p2.inf diff --git a/dep/org.argeo.slc.dep.sdk.rap/pom.xml b/dep/org.argeo.slc.dep.rap/pom.xml similarity index 98% rename from dep/org.argeo.slc.dep.sdk.rap/pom.xml rename to dep/org.argeo.slc.dep.rap/pom.xml index 71bc73857..6a43fdbd5 100644 --- a/dep/org.argeo.slc.dep.sdk.rap/pom.xml +++ b/dep/org.argeo.slc.dep.rap/pom.xml @@ -8,7 +8,7 @@ .. org.argeo.slc.dep - org.argeo.slc.dep.sdk.rap + org.argeo.slc.dep.rap SLC Eclipse RAP Dependencies diff --git a/dep/org.argeo.slc.dep.rcp/org.argeo.slc.dep.rcp-maven.target b/dep/org.argeo.slc.dep.rcp/org.argeo.slc.dep.rcp-maven.target new file mode 100644 index 000000000..e4d016d48 --- /dev/null +++ b/dep/org.argeo.slc.dep.rcp/org.argeo.slc.dep.rcp-maven.target @@ -0,0 +1,760 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dep/org.argeo.slc.dep.sdk.rcp/p2.inf b/dep/org.argeo.slc.dep.rcp/p2.inf similarity index 100% rename from dep/org.argeo.slc.dep.sdk.rcp/p2.inf rename to dep/org.argeo.slc.dep.rcp/p2.inf diff --git a/dep/org.argeo.slc.dep.sdk.rcp/pom.xml b/dep/org.argeo.slc.dep.rcp/pom.xml similarity index 80% rename from dep/org.argeo.slc.dep.sdk.rcp/pom.xml rename to dep/org.argeo.slc.dep.rcp/pom.xml index 7d9f4b403..4bbd58c1f 100644 --- a/dep/org.argeo.slc.dep.sdk.rcp/pom.xml +++ b/dep/org.argeo.slc.dep.rcp/pom.xml @@ -8,7 +8,7 @@ .. org.argeo.slc.dep - org.argeo.slc.dep.sdk.rcp + org.argeo.slc.dep.rcp SLC Eclipse RCP Dependencies @@ -99,10 +99,35 @@ + + /usr/bin + root + root + 755 + false + + + src/main/rpm/usr/bin + + + + + /etc/slc-rcp + root + root + 644 + false + + + src/main/rpm/etc/slc-rcp + + + slc-eclipse argeo-node-rcp + osgi-boot diff --git a/dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/config.ini b/dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/config.ini new file mode 100644 index 000000000..53aa78d79 --- /dev/null +++ b/dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/config.ini @@ -0,0 +1,64 @@ +argeo.osgi.start=\ +org.springframework.osgi.extender,\ +org.argeo.node.repofactory.jackrabbit,\ +org.argeo.node.repo.jackrabbit,\ +org.argeo.security.dao.os,\ +org.argeo.slc.node.jackrabbit,\ +org.argeo.security.equinox,\ +org.argeo.security.ui,\ +org.argeo.security.ui.rcp,\ +org.argeo.slc.client.ui,\ +org.argeo.slc.client.rcp,\ +org.argeo.slc.agent,\ +org.argeo.slc.agent.jcr,\ + +org.argeo.security.ui.initialPerspective=org.argeo.jcr.ui.explorer.perspective + +## LOGGING +log4j.configuration=file:/etc/slc-rcp/log4j.properties + +# TOMCAT PORTS +argeo.server.port.http=17080 +argeo.server.port.https=17083 +argeo.server.port.ajp=17089 + +org.argeo.slc.ui.inTray=true + +# DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING +eclipse.application=org.argeo.slc.client.rcp.application +eclipse.activateRuntimePlugins=false +eclipse.noRegistryCache=true + +osgi.bundles=/usr/share/osgi/boot/org.argeo.osgi.boot.jar@start,\ +org.eclipse.core.runtime@start,\ +org.eclipse.equinox.common@start,\ +com.ibm.icu,\ +org.eclipse.core.commands,\ +org.eclipse.core.contenttype,\ +org.eclipse.core.databinding,\ +org.eclipse.core.databinding.observable,\ +org.eclipse.core.databinding.property,\ +org.eclipse.core.expressions,\ +org.eclipse.core.jobs,\ +org.eclipse.equinox.app,\ +org.eclipse.equinox.launcher,\ +org.eclipse.equinox.preferences,\ +org.eclipse.equinox.registry,\ +org.eclipse.equinox.security,\ +org.eclipse.help,\ +org.eclipse.jface,\ +org.eclipse.jface.databinding,\ +org.eclipse.swt,\ +org.eclipse.swt.gtk.linux.x86_64,\ +org.eclipse.swt.gtk.linux.i386,\ +org.eclipse.ui,\ +org.eclipse.ui.forms,\ +org.eclipse.ui.workbench + +argeo.osgi.bundles=\ +${user.home}/.slc/modules;in=*,\ +/etc/slc-ui/modules;in=*,\ +/usr/share/slc/lib;in=*.jar,\ +/usr/share/osgi;in=*.jar,\ +/usr/share/osgi/eclipse;in=*.jar,\ +/usr/share/osgi/rcp;in=*.jar,\ diff --git a/dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/log4j.properties b/dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/log4j.properties new file mode 100644 index 000000000..97c4d4a5b --- /dev/null +++ b/dep/org.argeo.slc.dep.rcp/src/main/rpm/etc/slc-rcp/log4j.properties @@ -0,0 +1,25 @@ +#log4j.rootLogger=WARN, file +log4j.rootLogger=WARN, console + +## Levels +log4j.logger.org.argeo=INFO +#log4j.logger.org.springframework=DEBUG +#log4j.logger.org.hibernate=DEBUG +#log4j.logger.org.apache.activemq=DEBUG + +log4j.logger.org.springframework.web.servlet.PageNotFound=ERROR +log4j.logger.org.apache.directory.server.core.schema.SchemaService=ERROR +log4j.logger.org.springframework.security.SpringSecurityMessageSource=ERROR + +log4j.logger.org.apache.directory.server.core.partition=ERROR +log4j.logger.org.apache.directory.server.core.schema.bootstrap.BootstrapAttributeTypeRegistry=ERROR + +## Appenders +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} [%15.15t] %m - %c%n - %t + +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=/var/log/slc/slc.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern= %-5p %d{ISO8601} [%15.15t] %m - %c%n \ No newline at end of file diff --git a/dep/org.argeo.slc.dep.rcp/src/main/rpm/usr/bin/slc-rcp b/dep/org.argeo.slc.dep.rcp/src/main/rpm/usr/bin/slc-rcp new file mode 100644 index 000000000..3a770fca5 --- /dev/null +++ b/dep/org.argeo.slc.dep.rcp/src/main/rpm/usr/bin/slc-rcp @@ -0,0 +1,23 @@ +#!/bin/sh + +LIB_BASE=/usr/lib64 +OSGI_FRAMEWORK=$LIB_BASE/eclipse/plugins/org.eclipse.osgi_3.6.1.R36x_v20100806.jar +ECLIPSE_LAUNCHER=$LIB_BASE/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar +INSTALL_DIR=/usr/share/osgi/rcp + +UI_DIR=~/.slc/rcp +DATA_DIR=$UI_DIR/data +CONF_DIR=$UI_DIR/conf + +if [ ! -f $CONF_DIR/config.ini ]; +then + mkdir -p $CONF_DIR + cp /etc/slc-rcp/config.ini $CONF_DIR +fi + +java -Dosgi.framework=$OSGI_FRAMEWORK \ + -jar $ECLIPSE_LAUNCHER \ + -install $INSTALL_DIR \ + -configuration $CONF_DIR \ + -data $DATA_DIR \ + -clean diff --git a/dep/org.argeo.slc.dep.rcp/src/main/scripts/postinstall b/dep/org.argeo.slc.dep.rcp/src/main/scripts/postinstall new file mode 100644 index 000000000..b9afdaef1 --- /dev/null +++ b/dep/org.argeo.slc.dep.rcp/src/main/scripts/postinstall @@ -0,0 +1,32 @@ +if [ $1 = "1" ];then + APP=%{name} + +cd /usr/lib64/eclipse/plugins +SOURCE=/usr/lib64/eclipse/plugins +TARGET=/usr/lib64/eclipse-rcp + +org.eclipse.core.commands +org.eclipse.core.contenttype +org.eclipse.core.databinding +org.eclipse.core.databinding.observable +org.eclipse.core.databinding.property +org.eclipse.core.expressions +org.eclipse.core.jobs +org.eclipse.core.runtime +org.eclipse.equinox.app +org.eclipse.equinox.common +org.eclipse.equinox.launcher +org.eclipse.equinox.preferences +org.eclipse.equinox.registry +org.eclipse.equinox.security +org.eclipse.help +org.eclipse.jface +org.eclipse.jface.databinding +org.eclipse.osgi +org.eclipse.swt +org.eclipse.swt.gtk.linux.x86_64 +org.eclipse.ui +org.eclipse.ui.forms +org.eclipse.ui.workbench + +fi \ No newline at end of file diff --git a/dep/pom.xml b/dep/pom.xml index d3295ea0a..8a6e45a7c 100644 --- a/dep/pom.xml +++ b/dep/pom.xml @@ -14,8 +14,8 @@ org.argeo.slc.dep.detached org.argeo.slc.dep.backend org.argeo.slc.dep.eclipse - org.argeo.slc.dep.sdk.rcp - org.argeo.slc.dep.sdk.rap + org.argeo.slc.dep.rcp + org.argeo.slc.dep.rap diff --git a/dist/slc/pom.xml b/dist/slc/pom.xml index afd9dadfa..af3da3790 100644 --- a/dist/slc/pom.xml +++ b/dist/slc/pom.xml @@ -35,29 +35,6 @@ - - - org.argeo.slc.dep - org.argeo.slc.dep.sdk.rap - 0.13.1-SNAPSHOT - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.argeo.commons.osgi - org.argeo.osgi.boot - - - - org.argeo.commons.security - org.argeo.security.dep.node.rap - - - - rpmbuild @@ -114,6 +91,18 @@ + + /etc/slc-cl + root + root + 644 + false + + + src/main/rpm/etc/slc-cl + + + src/main/scripts/preinstall diff --git a/dist/slc/src/main/rpm/etc/slc-cl/config.ini b/dist/slc/src/main/rpm/etc/slc-cl/config.ini new file mode 100644 index 000000000..56d0dd95e --- /dev/null +++ b/dist/slc/src/main/rpm/etc/slc-cl/config.ini @@ -0,0 +1,22 @@ +argeo.osgi.start=\ +org.springframework.osgi.extender,\ +org.argeo.node.repofactory.jackrabbit,\ +org.argeo.node.repo.jackrabbit,\ +org.argeo.security.dao.os,\ +org.argeo.slc.node.jackrabbit,\ +org.argeo.security.equinox,\ +org.argeo.slc.agent,\ +org.argeo.slc.agent.jcr,\ +org.argeo.slc.support.equinox,\ + +## LOGGING +log4j.configuration=file:/etc/slc-cl/log4j.properties + +# DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING +osgi.bundles=org.argeo.osgi.boot.jar@start + +argeo.osgi.bundles=\ +${user.home}/.slc/modules;in=*,\ +/etc/slc-cl/modules;in=*,\ +/usr/share/slc/lib;in=*.jar,\ +/usr/share/osgi;in=*.jar,\ diff --git a/dist/slc/src/main/rpm/etc/slc-cl/log4j.properties b/dist/slc/src/main/rpm/etc/slc-cl/log4j.properties new file mode 100644 index 000000000..7edc3f2d4 --- /dev/null +++ b/dist/slc/src/main/rpm/etc/slc-cl/log4j.properties @@ -0,0 +1,25 @@ +log4j.rootLogger=WARN, file +#log4j.rootLogger=WARN, console + +## Levels +log4j.logger.org.argeo=INFO +#log4j.logger.org.springframework=DEBUG +#log4j.logger.org.hibernate=DEBUG +#log4j.logger.org.apache.activemq=DEBUG + +log4j.logger.org.springframework.web.servlet.PageNotFound=ERROR +log4j.logger.org.apache.directory.server.core.schema.SchemaService=ERROR +log4j.logger.org.springframework.security.SpringSecurityMessageSource=ERROR + +log4j.logger.org.apache.directory.server.core.partition=ERROR +log4j.logger.org.apache.directory.server.core.schema.bootstrap.BootstrapAttributeTypeRegistry=ERROR + +## Appenders +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} [%15.15t] %m - %c%n - %t + +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=/var/log/slc/slc.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern= %-5p %d{ISO8601} [%15.15t] %m - %c%n diff --git a/dist/slc/src/main/rpm/usr/bin/slc b/dist/slc/src/main/rpm/usr/bin/slc index 5f72472f3..edf98110d 100644 --- a/dist/slc/src/main/rpm/usr/bin/slc +++ b/dist/slc/src/main/rpm/usr/bin/slc @@ -1,14 +1,24 @@ #!/bin/sh -if [ -d ./lib ];then - OSGI_INSTALL_AREA=`pwd`/lib -else - OSGI_INSTALL_AREA=/usr/share/osgi -fi +OSGI_INSTALL_AREA=/usr/share/osgi/boot +OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar + +CL_DIR=~/.slc/cl +DATA_DIR=$CL_DIR/data +CONF_DIR=$CL_DIR/conf +MODULE=$1 +FLOW=$2 + +if [ ! -f $CONF_DIR/config.ini ]; +then + mkdir -p $CONF_DIR + cp /etc/slc-cl/config.ini $CONF_DIR +fi -java $JAVA_OPTS -jar $OSGI_INSTALL_AREA/org.eclipse.osgi.jar \ - -clean \ - -configuration conf \ - -data data \ - "$@" +java -jar $OSGI_FRAMEWORK \ + -configuration $CONF_DIR \ + -data $DATA_DIR \ + -Dslc.launch.module=$MODULE \ + -Dslc.launch.execution=$FLOW \ + -clean diff --git a/dist/slc/src/main/scripts/preinstall b/dist/slc/src/main/scripts/preinstall index 522d889f4..b3953fc53 100644 --- a/dist/slc/src/main/scripts/preinstall +++ b/dist/slc/src/main/scripts/preinstall @@ -2,10 +2,10 @@ if [ $1 = "1" ];then APP=%{name} # create application user (EL5) - useradd -r --home-dir /var/lib/$APP --shell /sbin/nologin --create-home $APP + #useradd -r --home-dir /var/lib/$APP --shell /sbin/nologin --create-home $APP # create application user (EL6) - #useradd --system --home-dir /var/lib/$APP --shell /sbin/nologin --user-group --create-home $APP + useradd --system --home-dir /var/lib/$APP --shell /sbin/nologin --user-group --create-home $APP # give read access to group on home chmod g+r /var/lib/$APP diff --git a/dist/slc/src/main/scripts/preremove b/dist/slc/src/main/scripts/preremove index ff4f3b58b..9fa0a738e 100644 --- a/dist/slc/src/main/scripts/preremove +++ b/dist/slc/src/main/scripts/preremove @@ -3,5 +3,7 @@ if [ $1 = "0" ];then APP=slc /sbin/chkconfig --del $APP userdel $APP - groupdel $APP + + # necessary for EL5? (breaks EL6) + #groupdel slc fi diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ClientRcpPlugin.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ClientRcpPlugin.java index b919ac1d7..d59018d3e 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ClientRcpPlugin.java +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ClientRcpPlugin.java @@ -9,66 +9,30 @@ import org.osgi.framework.BundleContext; * The activator class controls the plug-in life cycle */ public class ClientRcpPlugin extends AbstractUIPlugin { - - // The plug-in ID public static final String PLUGIN_ID = "org.argeo.slc.client.rcp"; - - // The shared instance private static ClientRcpPlugin plugin; - /** - * The constructor - */ - public ClientRcpPlugin() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); } - /** - * Returns the shared instance - * - * @return the shared instance - */ public static ClientRcpPlugin getDefault() { return plugin; } @Override protected void initializeImageRegistry(ImageRegistry reg) { + // TODO make it configurable reg.put("argeoTrayIcon", getImageDescriptor("icons/argeo-trayIcon-256.png")); } - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path - * - * @param path - * the path - * @return the image descriptor - */ public static ImageDescriptor getImageDescriptor(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java index a9802c536..8bf8df93d 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java @@ -5,20 +5,11 @@ import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor; -/** - * implements initial perspective and saveAndRestore status of the workbench. - * - * @author bsinou - * - */ +/** Implements initial perspective and saveAndRestore status of the workbench. */ public class SlcSecureWorkbenchAdvisor extends WorkbenchAdvisor { - // private static final String PERSPECTIVE_ID = - // "org.argeo.slc.client.ui.perspectives.slcExecution"; - static final String DEFAULT_PERSPECTIVE_ID = "org.argeo.security.ui.securityPerspective"; //$NON-NLS-1$ - public final static String INITIAL_PERSPECTIVE_PROPERTY = "org.argeo.security.ui.initialPerspective"; - private String initialPerspective = System.getProperty( - INITIAL_PERSPECTIVE_PROPERTY, DEFAULT_PERSPECTIVE_ID); + private String initialPerspective = System + .getProperty(INITIAL_PERSPECTIVE_PROPERTY); private String username; public SlcSecureWorkbenchAdvisor(String username) { @@ -32,7 +23,6 @@ public class SlcSecureWorkbenchAdvisor extends WorkbenchAdvisor { } public String getInitialWindowPerspectiveId() { - // return PERSPECTIVE_ID; return initialPerspective; } @@ -41,8 +31,7 @@ public class SlcSecureWorkbenchAdvisor extends WorkbenchAdvisor { super.initialize(configurer); // To remember the user's layout and window size for the next time he // starts the application - // configurer.setSaveAndRestore(true); + //configurer.setSaveAndRestore(true); } - - + } diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java index d83f8c9ea..e0e2de2a8 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java @@ -19,6 +19,7 @@ import org.eclipse.ui.part.EditorInputTransfer; /** Set here initial default size of the UI */ public class SlcSecureWorkbenchWindowAdvisor extends SecureWorkbenchWindowAdvisor { + public final static String IN_TRAY_PROPERTY = "org.argeo.slc.ui.inTray"; private TrayItem trayItem; @@ -28,7 +29,10 @@ public class SlcSecureWorkbenchWindowAdvisor extends } public void postWindowOpen() { - initTray(); + String inTray = System.getProperty(IN_TRAY_PROPERTY); + if (inTray != null && inTray.equals("true")) { + initTray(); + } } @Override @@ -60,6 +64,13 @@ public class SlcSecureWorkbenchWindowAdvisor extends } }); + + // start hidden if in tray + String inTray = System.getProperty(IN_TRAY_PROPERTY); + if (inTray != null && inTray.equals("true")) { + Shell shell = getWindowConfigurer().getWindow().getShell(); + shell.setVisible(false); + } super.preWindowOpen(); } @@ -76,7 +87,8 @@ public class SlcSecureWorkbenchWindowAdvisor extends /** Init tray support */ protected void initTray() { IWorkbenchWindow window = getWindowConfigurer().getWindow(); - final Tray tray = window.getShell().getDisplay().getSystemTray(); + Shell shell = window.getShell(); + final Tray tray = shell.getDisplay().getSystemTray(); trayItem = new TrayItem(tray, SWT.NONE); if (trayItem == null) return; @@ -124,6 +136,7 @@ public class SlcSecureWorkbenchWindowAdvisor extends } } }); + } @Override -- 2.39.2