Adapt RCP bundle to latest conventions
authorBruno Sinou <bsinou@argeo.org>
Wed, 30 Nov 2016 16:01:29 +0000 (16:01 +0000)
committerBruno Sinou <bsinou@argeo.org>
Wed, 30 Nov 2016 16:01:29 +0000 (16:01 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@9341 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

39 files changed:
legacy/plugins/org.argeo.slc.client.rcp/.classpath [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/.project [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/META-INF/spring/commands.xml [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/build.properties [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-icon-256.png [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/plugin.xml [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/plugin_customization.ini [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/pom.xml [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/splash.bmp [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcRcpPlugin.java [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureClientApplication.java [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/ui/specific/OpenJcrFile.java [deleted file]
legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/ui/specific/OpenJcrFileCmdId.java [deleted file]
legacy/plugins/pom.xml [deleted file]
org.argeo.slc.client.rcp/.classpath [new file with mode: 0644]
org.argeo.slc.client.rcp/.project [new file with mode: 0644]
org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.argeo.slc.client.rcp/META-INF/spring/commands.xml [new file with mode: 0644]
org.argeo.slc.client.rcp/META-INF/spring/osgi.xml [new file with mode: 0644]
org.argeo.slc.client.rcp/bnd.bnd [new file with mode: 0644]
org.argeo.slc.client.rcp/build.properties [new file with mode: 0644]
org.argeo.slc.client.rcp/icons/argeo-icon-256.png [new file with mode: 0644]
org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png [new file with mode: 0644]
org.argeo.slc.client.rcp/plugin.xml [new file with mode: 0644]
org.argeo.slc.client.rcp/plugin_customization.ini [new file with mode: 0644]
org.argeo.slc.client.rcp/pom.xml [new file with mode: 0644]
org.argeo.slc.client.rcp/splash.bmp [new file with mode: 0644]
org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcRcpPlugin.java [new file with mode: 0644]
org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureClientApplication.java [new file with mode: 0644]
org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java [new file with mode: 0644]
org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java [new file with mode: 0644]
org.argeo.slc.client.rcp/src/org/argeo/slc/client/ui/specific/OpenJcrFile.java [new file with mode: 0644]
org.argeo.slc.client.rcp/src/org/argeo/slc/client/ui/specific/OpenJcrFileCmdId.java [new file with mode: 0644]
pom.xml

diff --git a/legacy/plugins/org.argeo.slc.client.rcp/.classpath b/legacy/plugins/org.argeo.slc.client.rcp/.classpath
deleted file mode 100644 (file)
index 57ffbb6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" path="src/main/java"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/.project b/legacy/plugins/org.argeo.slc.client.rcp/.project
deleted file mode 100644 (file)
index 75fcdba..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.argeo.slc.client.rcp</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/legacy/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs b/legacy/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 5eb7b03..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#Wed Aug 04 16:32:22 CEST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/META-INF/spring/commands.xml b/legacy/plugins/org.argeo.slc.client.rcp/META-INF/spring/commands.xml
deleted file mode 100644 (file)
index 7bd302c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-       <!-- RCP Specific open JCR file command -->
-       <bean id="org.argeo.slc.client.rcp.openJcrFile" class="org.argeo.slc.client.ui.specific.OpenJcrFile"
-               scope="prototype">
-               <property name="repoService" ref="repoService" />
-       </bean>
-       
-       <bean id="repoService" class="org.argeo.slc.repo.core.RepoServiceImpl">
-               <property name="repositoryFactory" ref="repositoryFactory" />
-               <property name="keyring" ref="keyring" />
-               <property name="nodeRepository" ref="nodeRepository" />
-       </bean>
-</beans>
\ No newline at end of file
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml b/legacy/plugins/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml
deleted file mode 100644 (file)
index 55a940f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
-       xmlns:osgi="http://www.springframework.org/schema/osgi"\r
-       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
-       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
-       http://www.springframework.org/schema/beans   \r
-       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"\r
-       osgi:default-timeout="30000">\r
-\r
-       <beans:description>SLC UI RCP</beans:description>\r
-\r
-       <reference id="nodeRepository" interface="javax.jcr.Repository"\r
-               filter="(argeo.jcr.repository.alias=node)" />\r
-       <reference id="repositoryFactory" interface="javax.jcr.RepositoryFactory" />\r
-       <reference id="keyring" interface="org.argeo.security.crypto.CryptoKeyring" />\r
-\r
-</beans:beans>
\ No newline at end of file
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/build.properties b/legacy/plugins/org.argeo.slc.client.rcp/build.properties
deleted file mode 100644 (file)
index a971175..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-source.. = src/main/java
-output.. = target/classes
-bin.includes = plugin.xml,\
-               META-INF/,\
-               .,\
-               icons/,\
-               splash.bmp,\
-               plugin_customization.ini
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-icon-256.png b/legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-icon-256.png
deleted file mode 100644 (file)
index a9af088..0000000
Binary files a/legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-icon-256.png and /dev/null differ
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png b/legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png
deleted file mode 100644 (file)
index da20cf4..0000000
Binary files a/legacy/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png and /dev/null differ
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/plugin.xml b/legacy/plugins/org.argeo.slc.client.rcp/plugin.xml
deleted file mode 100644 (file)
index 73bfa83..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-   <extension
-         id="org.argeo.slc.client.rcp.product"
-         point="org.eclipse.core.runtime.products">
-      <product
-            application="org.argeo.slc.client.rcp.application"
-            name="SLC">
-         <property
-               name="windowImages"
-               value="icons/argeo-icon-256.png">
-         </property>
-         <property
-               name="appName"
-               value="SLC">
-         </property>
-         <property
-               name="preferenceCustomization"
-               value="plugin_customization.ini">
-         </property>
-      </product>
-   </extension>
-   <extension
-         id="org.argeo.slc.client.rcp.application"
-         point="org.eclipse.core.runtime.applications">
-      <application>
-         <run
-               class="org.argeo.slc.client.rcp.SlcSecureClientApplication">
-         </run>
-      </application>
-   </extension>
-
-    <!-- COMMANDS  --> 
-       <extension
-        point="org.eclipse.ui.commands">
-               <command
-                       id="org.argeo.slc.client.rcp.openJcrFile"
-                       defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-                       name="Open Workspace Editor">
-                       <commandParameter
-                               id="param.repoNodePath"
-                               name="Repo node path">
-                       </commandParameter>
-                       <commandParameter
-                               id="param.repoUri"
-                               name="Repo URI">
-                       </commandParameter>
-                       <commandParameter
-                               id="param.workspaceName"
-                               name="Workspace name">
-                       </commandParameter>
-                       <commandParameter
-                               id="param.filePath"
-                               name="File Path">
-                       </commandParameter>
-       </command>
-       </extension>
-   
-    <!-- RCP Specific, does not work with RAP --> 
-   <extension
-        point="org.eclipse.ui.bindings">
-     <!-- <key
-           commandId="org.argeo.slc.client.ui.refreshExecutionModulesView"
-           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-           sequence="CTRL+R">
-     </key> -->
-  </extension>
-</plugin>
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/plugin_customization.ini b/legacy/plugins/org.argeo.slc.client.rcp/plugin_customization.ini
deleted file mode 100644 (file)
index ed3f69f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight
-org.eclipse.ui/SHOW_TEXT_ON_PERSPECTIVE_BAR=false
-org.eclipse.ui/PERSPECTIVE_BAR_SIZE=100
-org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=true
-org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/pom.xml b/legacy/plugins/org.argeo.slc.client.rcp/pom.xml
deleted file mode 100644 (file)
index c16dd00..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<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.slc</groupId>
-               <artifactId>plugins</artifactId>
-               <version>2.1.1-SNAPSHOT</version>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.slc.client.rcp</artifactId>
-       <name>SLC Client RCP</name>
-       <packaging>jar</packaging>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-Activator>org.argeo.slc.client.rcp.SlcRcpPlugin</Bundle-Activator>
-                                               <Require-Bundle>
-                                                       org.eclipse.ui,
-                                                       org.eclipse.core.runtime
-                                               </Require-Bundle>
-                                               <Import-Package>
-                                                       org.argeo.eclipse.spring,
-                                                       org.argeo.slc.repo.core,
-                                                       javax.jcr.nodetype,
-                                                       *,
-                                               </Import-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <!-- SLC -->
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.repo</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-
-               <!-- Bundles to start -->
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.node.jackrabbit</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.agent</artifactId>
-                       <version>2.1.1-SNAPSHOT</version>
-               </dependency>
-
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.dao.jackrabbit</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.server</groupId>
-                       <artifactId>org.argeo.node.repo.jackrabbit</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-
-               <!-- Security UI -->
-               <dependency>
-                       <groupId>org.argeo.commons.base</groupId>
-                       <artifactId>org.argeo.eclipse.dep.rcp</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.security</groupId>
-                       <artifactId>org.argeo.security.ui.rcp</artifactId>
-                       <version>${version.argeo-commons}</version>
-               </dependency>
-       </dependencies>
-</project>
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/splash.bmp b/legacy/plugins/org.argeo.slc.client.rcp/splash.bmp
deleted file mode 100644 (file)
index ee502f3..0000000
Binary files a/legacy/plugins/org.argeo.slc.client.rcp/splash.bmp and /dev/null differ
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcRcpPlugin.java b/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcRcpPlugin.java
deleted file mode 100644 (file)
index 816e7c0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.client.rcp;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class SlcRcpPlugin extends AbstractUIPlugin {
-       public static final String PLUGIN_ID = "org.argeo.slc.client.rcp";
-       private static SlcRcpPlugin plugin;
-
-       public void start(BundleContext context) throws Exception {
-               super.start(context);
-               plugin = this;
-       }
-
-       public void stop(BundleContext context) throws Exception {
-               plugin = null;
-               super.stop(context);
-       }
-
-       public static SlcRcpPlugin getDefault() {
-               return plugin;
-       }
-
-       @Override
-       protected void initializeImageRegistry(ImageRegistry reg) {
-               // TODO make it configurable
-               reg.put("argeoTrayIcon",
-                               getImageDescriptor("icons/argeo-trayIcon-256.png"));
-       }
-
-       public static ImageDescriptor getImageDescriptor(String path) {
-               return imageDescriptorFromPlugin(PLUGIN_ID, path);
-       }
-}
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureClientApplication.java b/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureClientApplication.java
deleted file mode 100644 (file)
index 97d40c2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.client.rcp;
-
-import org.argeo.security.ui.rcp.SecureRcp;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.window.Window.IExceptionHandler;
-import org.eclipse.ui.application.WorkbenchAdvisor;
-
-/**
- * This class controls all aspects of the application's execution
- */
-public class SlcSecureClientApplication extends SecureRcp {
-
-       @Override
-       protected WorkbenchAdvisor createWorkbenchAdvisor(String username) {
-               Window.setExceptionHandler(new IExceptionHandler() {
-
-                       public void handleException(Throwable t) {
-                               System.err.println("Unexpected SLC UI exception: " + t);
-
-                       }
-               });
-
-               return new SlcSecureWorkbenchAdvisor(username);
-       }
-
-}
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java b/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java
deleted file mode 100644 (file)
index 785197d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.client.rcp;
-
-import org.argeo.security.ui.rcp.SecureWorkbenchAdvisor;
-import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
-import org.eclipse.ui.application.WorkbenchWindowAdvisor;
-
-/**
- * Custom {@link SecureWorkbenchAdvisor} in order to create a
- * {@link SlcSecureWorkbenchWindowAdvisor}.
- */
-public class SlcSecureWorkbenchAdvisor extends SecureWorkbenchAdvisor {
-       public SlcSecureWorkbenchAdvisor(String username) {
-               super(username);
-       }
-
-       public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
-                       IWorkbenchWindowConfigurer configurer) {
-               return new SlcSecureWorkbenchWindowAdvisor(configurer, getUsername());
-       }
-}
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java b/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java
deleted file mode 100644 (file)
index 7eecc9e..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.client.rcp;
-
-import org.argeo.security.ui.rcp.SecureWorkbenchWindowAdvisor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tray;
-import org.eclipse.swt.widgets.TrayItem;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
-import org.eclipse.ui.part.EditorInputTransfer;
-
-/**
- * Custom {@link SecureWorkbenchWindowAdvisor} which can add a tray. TODO: to
- * be factorized in Argeo Commons and made more generic.
- */
-public class SlcSecureWorkbenchWindowAdvisor extends
-               SecureWorkbenchWindowAdvisor {
-       public final static String IN_TRAY_PROPERTY = "org.argeo.slc.ui.inTray";
-
-       private TrayItem trayItem;
-
-       public SlcSecureWorkbenchWindowAdvisor(
-                       IWorkbenchWindowConfigurer configurer, String username) {
-               super(configurer, username);
-       }
-
-       public void postWindowOpen() {
-               String inTray = System.getProperty(IN_TRAY_PROPERTY);
-               if (inTray != null && inTray.equals("true")) {
-                       initTray();
-               }
-       }
-
-       @Override
-       public void preWindowOpen() {
-               getWindowConfigurer().addEditorAreaTransfer(
-                               EditorInputTransfer.getInstance());
-               getWindowConfigurer().configureEditorAreaDropListener(
-                               new DropTargetAdapter() {
-
-                                       @Override
-                                       public void dragEnter(DropTargetEvent event) {
-                                               System.out.println("DROP enter!!! " + event);
-                                       }
-
-                                       @Override
-                                       public void dragLeave(DropTargetEvent event) {
-                                               System.out.println("DROP leave!!! " + event);
-                                       }
-
-                                       public void drop(DropTargetEvent event) {
-                                               System.out.println("DROP drop!!! " + event);
-
-                                       }
-
-                                       @Override
-                                       public void dropAccept(DropTargetEvent event) {
-                                               System.out.println("DROP accept!!! " + event);
-                                               super.dropAccept(event);
-                                       }
-
-                               });
-               super.preWindowOpen();
-       }
-
-       @Override
-       public boolean preWindowShellClose() {
-               // hide but do not dispose if tray is supported
-               if (trayItem != null) {
-                       getWindowConfigurer().getWindow().getShell().setVisible(false);
-                       return false;
-               } else
-                       return true;
-       }
-
-       /** Init tray support */
-       protected void initTray() {
-               IWorkbenchWindow window = getWindowConfigurer().getWindow();
-               Shell shell = window.getShell();
-               final Tray tray = shell.getDisplay().getSystemTray();
-               trayItem = new TrayItem(tray, SWT.NONE);
-               if (trayItem == null)
-                       return;
-
-               // image
-               Image trayImage = SlcRcpPlugin.getDefault().getImageRegistry()
-                               .get("argeoTrayIcon");
-               trayItem.setImage(trayImage);
-               trayItem.setToolTipText("Argeo SLC");
-
-               // add pop-menu
-               // TODO: contribute more commands
-               trayItem.addListener(SWT.MenuDetect, new Listener() {
-                       public void handleEvent(Event event) {
-                               IWorkbenchWindow window = getWindowConfigurer().getWindow();
-                               Menu menu = new Menu(window.getShell(), SWT.POP_UP);
-                               MenuItem exit = new MenuItem(menu, SWT.NONE);
-                               exit.setText("Exit");
-                               exit.addListener(SWT.Selection, new Listener() {
-                                       public void handleEvent(Event event) {
-                                               getWindowConfigurer().getWorkbenchConfigurer()
-                                                               .getWorkbench().close();
-                                       }
-                               });
-                               menu.setVisible(true);
-                       }
-               });
-
-               // add behavior when clicked upon
-               trayItem.addListener(SWT.Selection, new Listener() {
-                       public void handleEvent(Event event) {
-                               Shell shell = getWindowConfigurer().getWindow().getShell();
-                               if (shell.isVisible()) {
-                                       if (shell.getMinimized())
-                                               shell.setMinimized(false);
-                                       else {
-                                               shell.setVisible(false);
-                                               shell.setMinimized(true);
-                                       }
-                               } else {
-                                       shell.setVisible(true);
-                                       shell.setActive();
-                                       shell.setFocus();
-                                       shell.setMinimized(false);
-                               }
-                       }
-               });
-
-               // start hidden
-               // shell.setVisible(false);
-       }
-
-       @Override
-       public void dispose() {
-               if (trayItem != null)
-                       trayItem.dispose();
-       }
-
-}
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/ui/specific/OpenJcrFile.java b/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/ui/specific/OpenJcrFile.java
deleted file mode 100644 (file)
index 5c73a60..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.client.ui.specific;
-
-import java.awt.Desktop;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.nodetype.NodeType;
-
-import org.apache.commons.io.IOUtils;
-import org.argeo.jcr.JcrUtils;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.repo.RepoService;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-/**
- * RCP specific command handler to open a file retrieved from a local or distant
- * JCR Repository.
- */
-public class OpenJcrFile extends AbstractHandler {
-       // private final static Log log = LogFactory.getLog(OpenJcrFile.class);
-
-       // Here is the trick that enable single sourcing: the ID is determined at
-       // runtime so use (new OpenJcrFileCmdId()).getCmdId() instead of the usual
-       // public final String ID = SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
-
-       public final static String PARAM_REPO_NODE_PATH = "param.repoNodePath";
-       public final static String PARAM_REPO_URI = "param.repoUri";
-       public final static String PARAM_WORKSPACE_NAME = "param.workspaceName";
-       public final static String PARAM_FILE_PATH = "param.filePath";
-
-       /* DEPENDENCY INJECTION */
-       private RepoService repoService;
-
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-
-               String repoNodePath = event.getParameter(PARAM_REPO_NODE_PATH);
-               String repoUri = event.getParameter(PARAM_REPO_URI);
-               String wkspName = event.getParameter(PARAM_WORKSPACE_NAME);
-               String filePath = event.getParameter(PARAM_FILE_PATH);
-
-               // TODO sanity check
-               if (filePath == null || "".equals(filePath.trim()))
-                       return null;
-               retrieveAndOpen(repoNodePath, repoUri, wkspName, filePath);
-
-               return null;
-       }
-
-       protected void retrieveAndOpen(String repoNodePath, String repoUri,
-                       String wkspName, String filePath) {
-               Session businessSession = null;
-               try {
-                       businessSession = repoService.getRemoteSession(repoNodePath,
-                                       repoUri, wkspName);
-                       Node result = businessSession.getNode(filePath);
-
-                       boolean isValid = true;
-                       Node child = null;
-                       if (!result.isNodeType(NodeType.NT_FILE))
-                               isValid = false;
-                       else {
-                               child = result.getNode(Property.JCR_CONTENT);
-                               if (!(child.isNodeType(NodeType.NT_RESOURCE) || child
-                                               .hasProperty(Property.JCR_DATA)))
-                                       isValid = false;
-                       }
-
-                       if (!isValid)
-                               return;
-
-                       InputStream fis = null;
-                       String prefix = "", extension = "";
-                       String fileName = JcrUtils.lastPathElement(filePath);
-                       int ind = fileName.lastIndexOf('.');
-                       if (ind > 0) {
-                               prefix = fileName.substring(0, ind);
-                               extension = fileName.substring(ind);
-                       }
-                       try {
-
-                               fis = (InputStream) child.getProperty(Property.JCR_DATA)
-                                               .getBinary().getStream();
-                               File file = createTmpFile(prefix, extension, fis);
-                               Desktop desktop = null;
-                               if (Desktop.isDesktopSupported()) {
-                                       desktop = Desktop.getDesktop();
-                               }
-                               desktop.open(file);
-                       } catch (Exception e) {
-                               throw new SlcException(
-                                               "Stream error while opening file " + filePath
-                                                               + " from repo " + repoUri == null ? repoNodePath
-                                                               : repoUri, e);
-                       } finally {
-                               IOUtils.closeQuietly(fis);
-                       }
-               } catch (RepositoryException e) {
-                       throw new SlcException("Unexpected error while "
-                                       + "getting repoNode info for repoNode at path "
-                                       + repoNodePath, e);
-               } finally {
-                       JcrUtils.logoutQuietly(businessSession);
-               }
-       }
-
-       private File createTmpFile(String prefix, String suffix, InputStream is) {
-               File tmpFile = null;
-               OutputStream os = null;
-               try {
-                       tmpFile = File.createTempFile(prefix, suffix);
-                       os = new FileOutputStream(tmpFile);
-                       IOUtils.copy(is, os);
-               } catch (IOException e) {
-                       throw new SlcException("Cannot open file " + prefix + "." + suffix,
-                                       e);
-               } finally {
-                       IOUtils.closeQuietly(os);
-               }
-               return tmpFile;
-       }
-
-       /* DEPENDENCY INJECTION */
-       public void setRepoService(RepoService repoService) {
-               this.repoService = repoService;
-       }
-}
\ No newline at end of file
diff --git a/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/ui/specific/OpenJcrFileCmdId.java b/legacy/plugins/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/ui/specific/OpenJcrFileCmdId.java
deleted file mode 100644 (file)
index fb0ad74..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.argeo.slc.client.ui.specific;
-
-import org.argeo.slc.client.rcp.SlcRcpPlugin;
-
-/**
- * Workaround a single sourcing problem:
- * 
- * final static variable are imported at compilation time (we build against RCP)
- * and we still must have a different ID (the prefix must be the PLUGIN ID) for
- * RAP and RCP in order to be able to inject beans in the corresponding commands
- */
-public class OpenJcrFileCmdId {
-
-       public String getCmdId() {
-               return SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
-       }
-}
diff --git a/legacy/plugins/pom.xml b/legacy/plugins/pom.xml
deleted file mode 100644 (file)
index 4dc3fe3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<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.slc</groupId>
-               <artifactId>argeo-slc</artifactId>
-               <version>2.1.1-SNAPSHOT</version>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>plugins</artifactId>
-       <name>SLC Eclipse Plugins</name>
-       <packaging>pom</packaging>
-       <modules>
-               <module>org.argeo.slc.client.rcp</module>
-               <module>org.argeo.slc.client.rap</module>
-               <module>org.argeo.slc.client.ui</module>
-               <module>org.argeo.slc.client.ui.dist</module>
-       </modules>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
-                                               <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-source-plugin</artifactId>
-                               <configuration>
-                                       <!-- Prevents source jars to contain misleading data -->
-                                       <excludes>
-                                               <exclude>plugin.xml</exclude>
-                                               <exclude>META-INF/MANIFEST.MF</exclude>
-                                       </excludes>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-</project>
diff --git a/org.argeo.slc.client.rcp/.classpath b/org.argeo.slc.client.rcp/.classpath
new file mode 100644 (file)
index 0000000..6e7c599
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src/main/java"/>
+       <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="output" path="target/classes"/>
+</classpath>
diff --git a/org.argeo.slc.client.rcp/.project b/org.argeo.slc.client.rcp/.project
new file mode 100644 (file)
index 0000000..75fcdba
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.slc.client.rcp</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.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs b/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..5eb7b03
--- /dev/null
@@ -0,0 +1,8 @@
+#Wed Aug 04 16:32:22 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.argeo.slc.client.rcp/META-INF/spring/commands.xml b/org.argeo.slc.client.rcp/META-INF/spring/commands.xml
new file mode 100644 (file)
index 0000000..7bd302c
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+       <!-- RCP Specific open JCR file command -->
+       <bean id="org.argeo.slc.client.rcp.openJcrFile" class="org.argeo.slc.client.ui.specific.OpenJcrFile"
+               scope="prototype">
+               <property name="repoService" ref="repoService" />
+       </bean>
+       
+       <bean id="repoService" class="org.argeo.slc.repo.core.RepoServiceImpl">
+               <property name="repositoryFactory" ref="repositoryFactory" />
+               <property name="keyring" ref="keyring" />
+               <property name="nodeRepository" ref="nodeRepository" />
+       </bean>
+</beans>
\ No newline at end of file
diff --git a/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml b/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml
new file mode 100644 (file)
index 0000000..55a940f
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
+       xmlns:osgi="http://www.springframework.org/schema/osgi"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
+       http://www.springframework.org/schema/beans   \r
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"\r
+       osgi:default-timeout="30000">\r
+\r
+       <beans:description>SLC UI RCP</beans:description>\r
+\r
+       <reference id="nodeRepository" interface="javax.jcr.Repository"\r
+               filter="(argeo.jcr.repository.alias=node)" />\r
+       <reference id="repositoryFactory" interface="javax.jcr.RepositoryFactory" />\r
+       <reference id="keyring" interface="org.argeo.security.crypto.CryptoKeyring" />\r
+\r
+</beans:beans>
\ No newline at end of file
diff --git a/org.argeo.slc.client.rcp/bnd.bnd b/org.argeo.slc.client.rcp/bnd.bnd
new file mode 100644 (file)
index 0000000..b1d059b
--- /dev/null
@@ -0,0 +1,12 @@
+Bundle-SymbolicName: org.argeo.slc.client.rcp;singleton=true
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.argeo.slc.client.rcp.SlcRcpPlugin
+Require-Bundle: org.eclipse.ui,\
+org.eclipse.core.runtime
+
+Import-Package: javax.jcr.nodetype,\
+org.argeo.eclipse.spring,\
+org.argeo.slc.repo.core,\
+org.argeo.cms.util,\
+*
+                                                       
\ No newline at end of file
diff --git a/org.argeo.slc.client.rcp/build.properties b/org.argeo.slc.client.rcp/build.properties
new file mode 100644 (file)
index 0000000..8b65761
--- /dev/null
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               icons/,\
+               splash.bmp,\
+               plugin_customization.ini
diff --git a/org.argeo.slc.client.rcp/icons/argeo-icon-256.png b/org.argeo.slc.client.rcp/icons/argeo-icon-256.png
new file mode 100644 (file)
index 0000000..a9af088
Binary files /dev/null and b/org.argeo.slc.client.rcp/icons/argeo-icon-256.png differ
diff --git a/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png b/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png
new file mode 100644 (file)
index 0000000..da20cf4
Binary files /dev/null and b/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png differ
diff --git a/org.argeo.slc.client.rcp/plugin.xml b/org.argeo.slc.client.rcp/plugin.xml
new file mode 100644 (file)
index 0000000..73bfa83
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         id="org.argeo.slc.client.rcp.product"
+         point="org.eclipse.core.runtime.products">
+      <product
+            application="org.argeo.slc.client.rcp.application"
+            name="SLC">
+         <property
+               name="windowImages"
+               value="icons/argeo-icon-256.png">
+         </property>
+         <property
+               name="appName"
+               value="SLC">
+         </property>
+         <property
+               name="preferenceCustomization"
+               value="plugin_customization.ini">
+         </property>
+      </product>
+   </extension>
+   <extension
+         id="org.argeo.slc.client.rcp.application"
+         point="org.eclipse.core.runtime.applications">
+      <application>
+         <run
+               class="org.argeo.slc.client.rcp.SlcSecureClientApplication">
+         </run>
+      </application>
+   </extension>
+
+    <!-- COMMANDS  --> 
+       <extension
+        point="org.eclipse.ui.commands">
+               <command
+                       id="org.argeo.slc.client.rcp.openJcrFile"
+                       defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
+                       name="Open Workspace Editor">
+                       <commandParameter
+                               id="param.repoNodePath"
+                               name="Repo node path">
+                       </commandParameter>
+                       <commandParameter
+                               id="param.repoUri"
+                               name="Repo URI">
+                       </commandParameter>
+                       <commandParameter
+                               id="param.workspaceName"
+                               name="Workspace name">
+                       </commandParameter>
+                       <commandParameter
+                               id="param.filePath"
+                               name="File Path">
+                       </commandParameter>
+       </command>
+       </extension>
+   
+    <!-- RCP Specific, does not work with RAP --> 
+   <extension
+        point="org.eclipse.ui.bindings">
+     <!-- <key
+           commandId="org.argeo.slc.client.ui.refreshExecutionModulesView"
+           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+           sequence="CTRL+R">
+     </key> -->
+  </extension>
+</plugin>
diff --git a/org.argeo.slc.client.rcp/plugin_customization.ini b/org.argeo.slc.client.rcp/plugin_customization.ini
new file mode 100644 (file)
index 0000000..ed3f69f
--- /dev/null
@@ -0,0 +1,5 @@
+org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight
+org.eclipse.ui/SHOW_TEXT_ON_PERSPECTIVE_BAR=false
+org.eclipse.ui/PERSPECTIVE_BAR_SIZE=100
+org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=true
+org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false
diff --git a/org.argeo.slc.client.rcp/pom.xml b/org.argeo.slc.client.rcp/pom.xml
new file mode 100644 (file)
index 0000000..da389c2
--- /dev/null
@@ -0,0 +1,50 @@
+<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.slc</groupId>
+               <artifactId>argeo-slc</artifactId>
+               <version>2.1.6-SNAPSHOT</version>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.slc.client.rcp</artifactId>
+       <name>SLC Client RCP</name>
+       <packaging>jar</packaging>
+       <!-- <build> -->
+       <!-- <plugins> -->
+       <!-- <plugin> -->
+       <!-- <groupId>org.apache.felix</groupId> -->
+       <!-- <artifactId>maven-bundle-plugin</artifactId> -->
+       <!-- <configuration> -->
+       <!-- <instructions> -->
+       <!-- <Bundle-Activator>org.argeo.slc.client.rcp.SlcRcpPlugin</Bundle-Activator> -->
+       <!-- <Require-Bundle> -->
+       <!-- org.eclipse.ui, -->
+       <!-- org.eclipse.core.runtime -->
+       <!-- </Require-Bundle> -->
+       <!-- <Import-Package> -->
+       <!-- org.argeo.eclipse.spring, -->
+       <!-- org.argeo.slc.repo.core, -->
+       <!-- javax.jcr.nodetype, -->
+       <!-- *, -->
+       <!-- </Import-Package> -->
+       <!-- </instructions> -->
+       <!-- </configuration> -->
+       <!-- </plugin> -->
+       <!-- </plugins> -->
+       <!-- </build> -->
+       <dependencies>
+               <!-- SLC -->
+               <dependency>
+                       <groupId>org.argeo.slc</groupId>
+                       <artifactId>org.argeo.slc.repo</artifactId>
+                       <version>2.1.6-SNAPSHOT</version>
+               </dependency>
+               <!-- Argeo common distribution for Secured UI -->
+               <dependency>
+                       <groupId>org.argeo.commons.rcp</groupId>
+                       <artifactId>org.argeo.cms.ui.workbench.rcp</artifactId>
+                       <version>${version.argeo-rcp}</version>
+               </dependency>
+       </dependencies>
+</project>
diff --git a/org.argeo.slc.client.rcp/splash.bmp b/org.argeo.slc.client.rcp/splash.bmp
new file mode 100644 (file)
index 0000000..ee502f3
Binary files /dev/null and b/org.argeo.slc.client.rcp/splash.bmp differ
diff --git a/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcRcpPlugin.java b/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcRcpPlugin.java
new file mode 100644 (file)
index 0000000..816e7c0
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.client.rcp;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SlcRcpPlugin extends AbstractUIPlugin {
+       public static final String PLUGIN_ID = "org.argeo.slc.client.rcp";
+       private static SlcRcpPlugin plugin;
+
+       public void start(BundleContext context) throws Exception {
+               super.start(context);
+               plugin = this;
+       }
+
+       public void stop(BundleContext context) throws Exception {
+               plugin = null;
+               super.stop(context);
+       }
+
+       public static SlcRcpPlugin getDefault() {
+               return plugin;
+       }
+
+       @Override
+       protected void initializeImageRegistry(ImageRegistry reg) {
+               // TODO make it configurable
+               reg.put("argeoTrayIcon",
+                               getImageDescriptor("icons/argeo-trayIcon-256.png"));
+       }
+
+       public static ImageDescriptor getImageDescriptor(String path) {
+               return imageDescriptorFromPlugin(PLUGIN_ID, path);
+       }
+}
diff --git a/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureClientApplication.java b/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureClientApplication.java
new file mode 100644 (file)
index 0000000..97d40c2
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.client.rcp;
+
+import org.argeo.security.ui.rcp.SecureRcp;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.window.Window.IExceptionHandler;
+import org.eclipse.ui.application.WorkbenchAdvisor;
+
+/**
+ * This class controls all aspects of the application's execution
+ */
+public class SlcSecureClientApplication extends SecureRcp {
+
+       @Override
+       protected WorkbenchAdvisor createWorkbenchAdvisor(String username) {
+               Window.setExceptionHandler(new IExceptionHandler() {
+
+                       public void handleException(Throwable t) {
+                               System.err.println("Unexpected SLC UI exception: " + t);
+
+                       }
+               });
+
+               return new SlcSecureWorkbenchAdvisor(username);
+       }
+
+}
diff --git a/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java b/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureWorkbenchAdvisor.java
new file mode 100644 (file)
index 0000000..785197d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.client.rcp;
+
+import org.argeo.security.ui.rcp.SecureWorkbenchAdvisor;
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchWindowAdvisor;
+
+/**
+ * Custom {@link SecureWorkbenchAdvisor} in order to create a
+ * {@link SlcSecureWorkbenchWindowAdvisor}.
+ */
+public class SlcSecureWorkbenchAdvisor extends SecureWorkbenchAdvisor {
+       public SlcSecureWorkbenchAdvisor(String username) {
+               super(username);
+       }
+
+       public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
+                       IWorkbenchWindowConfigurer configurer) {
+               return new SlcSecureWorkbenchWindowAdvisor(configurer, getUsername());
+       }
+}
diff --git a/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java b/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/SlcSecureWorkbenchWindowAdvisor.java
new file mode 100644 (file)
index 0000000..7eecc9e
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.client.rcp;
+
+import org.argeo.security.ui.rcp.SecureWorkbenchWindowAdvisor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tray;
+import org.eclipse.swt.widgets.TrayItem;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.part.EditorInputTransfer;
+
+/**
+ * Custom {@link SecureWorkbenchWindowAdvisor} which can add a tray. TODO: to
+ * be factorized in Argeo Commons and made more generic.
+ */
+public class SlcSecureWorkbenchWindowAdvisor extends
+               SecureWorkbenchWindowAdvisor {
+       public final static String IN_TRAY_PROPERTY = "org.argeo.slc.ui.inTray";
+
+       private TrayItem trayItem;
+
+       public SlcSecureWorkbenchWindowAdvisor(
+                       IWorkbenchWindowConfigurer configurer, String username) {
+               super(configurer, username);
+       }
+
+       public void postWindowOpen() {
+               String inTray = System.getProperty(IN_TRAY_PROPERTY);
+               if (inTray != null && inTray.equals("true")) {
+                       initTray();
+               }
+       }
+
+       @Override
+       public void preWindowOpen() {
+               getWindowConfigurer().addEditorAreaTransfer(
+                               EditorInputTransfer.getInstance());
+               getWindowConfigurer().configureEditorAreaDropListener(
+                               new DropTargetAdapter() {
+
+                                       @Override
+                                       public void dragEnter(DropTargetEvent event) {
+                                               System.out.println("DROP enter!!! " + event);
+                                       }
+
+                                       @Override
+                                       public void dragLeave(DropTargetEvent event) {
+                                               System.out.println("DROP leave!!! " + event);
+                                       }
+
+                                       public void drop(DropTargetEvent event) {
+                                               System.out.println("DROP drop!!! " + event);
+
+                                       }
+
+                                       @Override
+                                       public void dropAccept(DropTargetEvent event) {
+                                               System.out.println("DROP accept!!! " + event);
+                                               super.dropAccept(event);
+                                       }
+
+                               });
+               super.preWindowOpen();
+       }
+
+       @Override
+       public boolean preWindowShellClose() {
+               // hide but do not dispose if tray is supported
+               if (trayItem != null) {
+                       getWindowConfigurer().getWindow().getShell().setVisible(false);
+                       return false;
+               } else
+                       return true;
+       }
+
+       /** Init tray support */
+       protected void initTray() {
+               IWorkbenchWindow window = getWindowConfigurer().getWindow();
+               Shell shell = window.getShell();
+               final Tray tray = shell.getDisplay().getSystemTray();
+               trayItem = new TrayItem(tray, SWT.NONE);
+               if (trayItem == null)
+                       return;
+
+               // image
+               Image trayImage = SlcRcpPlugin.getDefault().getImageRegistry()
+                               .get("argeoTrayIcon");
+               trayItem.setImage(trayImage);
+               trayItem.setToolTipText("Argeo SLC");
+
+               // add pop-menu
+               // TODO: contribute more commands
+               trayItem.addListener(SWT.MenuDetect, new Listener() {
+                       public void handleEvent(Event event) {
+                               IWorkbenchWindow window = getWindowConfigurer().getWindow();
+                               Menu menu = new Menu(window.getShell(), SWT.POP_UP);
+                               MenuItem exit = new MenuItem(menu, SWT.NONE);
+                               exit.setText("Exit");
+                               exit.addListener(SWT.Selection, new Listener() {
+                                       public void handleEvent(Event event) {
+                                               getWindowConfigurer().getWorkbenchConfigurer()
+                                                               .getWorkbench().close();
+                                       }
+                               });
+                               menu.setVisible(true);
+                       }
+               });
+
+               // add behavior when clicked upon
+               trayItem.addListener(SWT.Selection, new Listener() {
+                       public void handleEvent(Event event) {
+                               Shell shell = getWindowConfigurer().getWindow().getShell();
+                               if (shell.isVisible()) {
+                                       if (shell.getMinimized())
+                                               shell.setMinimized(false);
+                                       else {
+                                               shell.setVisible(false);
+                                               shell.setMinimized(true);
+                                       }
+                               } else {
+                                       shell.setVisible(true);
+                                       shell.setActive();
+                                       shell.setFocus();
+                                       shell.setMinimized(false);
+                               }
+                       }
+               });
+
+               // start hidden
+               // shell.setVisible(false);
+       }
+
+       @Override
+       public void dispose() {
+               if (trayItem != null)
+                       trayItem.dispose();
+       }
+
+}
diff --git a/org.argeo.slc.client.rcp/src/org/argeo/slc/client/ui/specific/OpenJcrFile.java b/org.argeo.slc.client.rcp/src/org/argeo/slc/client/ui/specific/OpenJcrFile.java
new file mode 100644 (file)
index 0000000..5c73a60
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.slc.client.ui.specific;
+
+import java.awt.Desktop;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.commons.io.IOUtils;
+import org.argeo.jcr.JcrUtils;
+import org.argeo.slc.SlcException;
+import org.argeo.slc.repo.RepoService;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * RCP specific command handler to open a file retrieved from a local or distant
+ * JCR Repository.
+ */
+public class OpenJcrFile extends AbstractHandler {
+       // private final static Log log = LogFactory.getLog(OpenJcrFile.class);
+
+       // Here is the trick that enable single sourcing: the ID is determined at
+       // runtime so use (new OpenJcrFileCmdId()).getCmdId() instead of the usual
+       // public final String ID = SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
+
+       public final static String PARAM_REPO_NODE_PATH = "param.repoNodePath";
+       public final static String PARAM_REPO_URI = "param.repoUri";
+       public final static String PARAM_WORKSPACE_NAME = "param.workspaceName";
+       public final static String PARAM_FILE_PATH = "param.filePath";
+
+       /* DEPENDENCY INJECTION */
+       private RepoService repoService;
+
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+
+               String repoNodePath = event.getParameter(PARAM_REPO_NODE_PATH);
+               String repoUri = event.getParameter(PARAM_REPO_URI);
+               String wkspName = event.getParameter(PARAM_WORKSPACE_NAME);
+               String filePath = event.getParameter(PARAM_FILE_PATH);
+
+               // TODO sanity check
+               if (filePath == null || "".equals(filePath.trim()))
+                       return null;
+               retrieveAndOpen(repoNodePath, repoUri, wkspName, filePath);
+
+               return null;
+       }
+
+       protected void retrieveAndOpen(String repoNodePath, String repoUri,
+                       String wkspName, String filePath) {
+               Session businessSession = null;
+               try {
+                       businessSession = repoService.getRemoteSession(repoNodePath,
+                                       repoUri, wkspName);
+                       Node result = businessSession.getNode(filePath);
+
+                       boolean isValid = true;
+                       Node child = null;
+                       if (!result.isNodeType(NodeType.NT_FILE))
+                               isValid = false;
+                       else {
+                               child = result.getNode(Property.JCR_CONTENT);
+                               if (!(child.isNodeType(NodeType.NT_RESOURCE) || child
+                                               .hasProperty(Property.JCR_DATA)))
+                                       isValid = false;
+                       }
+
+                       if (!isValid)
+                               return;
+
+                       InputStream fis = null;
+                       String prefix = "", extension = "";
+                       String fileName = JcrUtils.lastPathElement(filePath);
+                       int ind = fileName.lastIndexOf('.');
+                       if (ind > 0) {
+                               prefix = fileName.substring(0, ind);
+                               extension = fileName.substring(ind);
+                       }
+                       try {
+
+                               fis = (InputStream) child.getProperty(Property.JCR_DATA)
+                                               .getBinary().getStream();
+                               File file = createTmpFile(prefix, extension, fis);
+                               Desktop desktop = null;
+                               if (Desktop.isDesktopSupported()) {
+                                       desktop = Desktop.getDesktop();
+                               }
+                               desktop.open(file);
+                       } catch (Exception e) {
+                               throw new SlcException(
+                                               "Stream error while opening file " + filePath
+                                                               + " from repo " + repoUri == null ? repoNodePath
+                                                               : repoUri, e);
+                       } finally {
+                               IOUtils.closeQuietly(fis);
+                       }
+               } catch (RepositoryException e) {
+                       throw new SlcException("Unexpected error while "
+                                       + "getting repoNode info for repoNode at path "
+                                       + repoNodePath, e);
+               } finally {
+                       JcrUtils.logoutQuietly(businessSession);
+               }
+       }
+
+       private File createTmpFile(String prefix, String suffix, InputStream is) {
+               File tmpFile = null;
+               OutputStream os = null;
+               try {
+                       tmpFile = File.createTempFile(prefix, suffix);
+                       os = new FileOutputStream(tmpFile);
+                       IOUtils.copy(is, os);
+               } catch (IOException e) {
+                       throw new SlcException("Cannot open file " + prefix + "." + suffix,
+                                       e);
+               } finally {
+                       IOUtils.closeQuietly(os);
+               }
+               return tmpFile;
+       }
+
+       /* DEPENDENCY INJECTION */
+       public void setRepoService(RepoService repoService) {
+               this.repoService = repoService;
+       }
+}
\ No newline at end of file
diff --git a/org.argeo.slc.client.rcp/src/org/argeo/slc/client/ui/specific/OpenJcrFileCmdId.java b/org.argeo.slc.client.rcp/src/org/argeo/slc/client/ui/specific/OpenJcrFileCmdId.java
new file mode 100644 (file)
index 0000000..fb0ad74
--- /dev/null
@@ -0,0 +1,17 @@
+package org.argeo.slc.client.ui.specific;
+
+import org.argeo.slc.client.rcp.SlcRcpPlugin;
+
+/**
+ * Workaround a single sourcing problem:
+ * 
+ * final static variable are imported at compilation time (we build against RCP)
+ * and we still must have a different ID (the prefix must be the PLUGIN ID) for
+ * RAP and RCP in order to be able to inject beans in the corresponding commands
+ */
+public class OpenJcrFileCmdId {
+
+       public String getCmdId() {
+               return SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
+       }
+}
diff --git a/pom.xml b/pom.xml
index 43b715d2f6473009976cd12ce397ce292eb9f51a..0d22a4c4a462191d03cd85d85e54bf6d28bb2268 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -13,6 +13,7 @@
        <properties>
                <developmentCycle.slc>2.1</developmentCycle.slc>
                <developmentCycle.startDate>2015-02-12</developmentCycle.startDate>
+               <version.argeo-rcp>2.1.12-SNAPSHOT</version.argeo-rcp>
                <version.slc>2.1.6-SNAPSHOT</version.slc>
        </properties>
        <modules>
@@ -33,6 +34,7 @@
                <module>org.argeo.slc.client.ui</module>
                <module>org.argeo.slc.client.ui.dist</module>
                <module>org.argeo.slc.client.rap</module>
+               <module>org.argeo.slc.client.rcp</module>
 
                <module>lib</module>
                <module>dep</module>
@@ -126,6 +128,16 @@ limitations under the License.
                                <checksumPolicy>warn</checksumPolicy>
                        </releases>
                </repository>
+               <repository>
+                       <id>argeo-rcp</id>
+                       <url>http://forge.argeo.org/data/public/java/argeo-rcp-2.1</url>
+                       <releases>
+                               <enabled>true</enabled>
+                               <updatePolicy>daily</updatePolicy>
+                               <checksumPolicy>warn</checksumPolicy>
+                       </releases>
+               </repository>
+               
                <!-- Disable Maven default repository -->
                <repository>
                        <id>central</id>