From: Mathieu Baudier Date: Fri, 6 Aug 2010 14:07:38 +0000 (+0000) Subject: Improve RCP X-Git-Tag: argeo-slc-2.1.7~1197 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=c208feddd6ceb7c4a6861e9a49228edc25a13181;hp=ec2e0c1d626acffcca47349e1d1c7ab3d02726a1;p=gpl%2Fargeo-slc.git Improve RCP git-svn-id: https://svn.argeo.org/slc/trunk@3758 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/dep/org.argeo.slc.dep.eclipse/pom.xml b/dep/org.argeo.slc.dep.eclipse/pom.xml new file mode 100644 index 000000000..685292b67 --- /dev/null +++ b/dep/org.argeo.slc.dep.eclipse/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + + org.argeo.slc + dep + 0.13.0-SNAPSHOT + .. + + org.argeo.slc.dep + org.argeo.slc.dep.eclipse + jar + SLC Eclipse Dependencies + + + org.argeo.slc.eclipse + org.argeo.slc.client.rcp + ${project.version} + + + org.argeo.slc.eclipse + org.argeo.slc.client.ui + ${project.version} + + + \ No newline at end of file diff --git a/dep/org.argeo.slc.dep.sdk/pom.xml b/dep/org.argeo.slc.dep.sdk/pom.xml index d00032396..7cfe3040e 100644 --- a/dep/org.argeo.slc.dep.sdk/pom.xml +++ b/dep/org.argeo.slc.dep.sdk/pom.xml @@ -46,6 +46,11 @@ org.argeo.slc.dep.gis ${project.version} + + org.argeo.slc.dep + org.argeo.slc.dep.eclipse + ${project.version} + org.argeo.slc.runtime diff --git a/dep/pom.xml b/dep/pom.xml index aabde35ea..6e8c62934 100644 --- a/dep/pom.xml +++ b/dep/pom.xml @@ -16,6 +16,7 @@ org.argeo.slc.dep.server org.argeo.slc.dep.detached org.argeo.slc.dep.gis + org.argeo.slc.dep.eclipse org.argeo.slc.dep.sdk org.argeo.slc.dep.sdk.sources diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/.classpath b/eclipse/plugins/org.argeo.slc.client.rcp/.classpath index ad32c83a7..304e86186 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/.classpath +++ b/eclipse/plugins/org.argeo.slc.client.rcp/.classpath @@ -1,7 +1,7 @@ - - + + diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs index 4186daad0..5eb7b030a 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs +++ b/eclipse/plugins/org.argeo.slc.client.rcp/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ -#Tue Jul 27 13:22:37 CEST 2010 +#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.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +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.6 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF index b89b70c1e..b8e715c91 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF @@ -3,9 +3,9 @@ Bundle-ManifestVersion: 2 Bundle-Name: Rcp Bundle-SymbolicName: org.argeo.slc.client.rcp; singleton:=true Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.argeo.slc.client.rcp.Activator +Bundle-Activator: org.argeo.slc.client.rcp.ClientRcpPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 Import-Package: org.argeo.slc.client.ui.views diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png b/eclipse/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png new file mode 100644 index 000000000..da20cf485 Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.rcp/icons/argeo-trayIcon-256.png differ diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml b/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml index e112468cd..9caec033e 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml +++ b/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml @@ -3,7 +3,7 @@ + + + + + + + + @@ -29,6 +45,10 @@ name="windowImages" value="icons/argeo-icon-256.png"> + + diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/pom.xml b/eclipse/plugins/org.argeo.slc.client.rcp/pom.xml new file mode 100644 index 000000000..d283f6c82 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rcp/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + + org.argeo.slc.eclipse + plugins + 0.13.0-SNAPSHOT + .. + + org.argeo.slc.client.rcp + SLC Client RCP + jar + + + + org.argeo.slc.eclipse + org.argeo.slc.client.ui + ${project.version} + + + + org.eclipse.ui + org.eclipse.ui + + + org.eclipse.core + org.eclipse.core.runtime + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86_64 + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86 + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/slc-client-rcp.product b/eclipse/plugins/org.argeo.slc.client.rcp/slc-client-rcp.product new file mode 100644 index 000000000..b091f99a0 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rcp/slc-client-rcp.product @@ -0,0 +1,155 @@ + + + + + + + + + + -console + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Activator.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Activator.java deleted file mode 100644 index 84bc8c0fe..000000000 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Activator.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.argeo.slc.client.rcp; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.argeo.slc.client.rcp"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (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 Activator getDefault() { - return plugin; - } - - /** - * 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/org/argeo/slc/client/rcp/ApplicationWorkbenchWindowAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationWorkbenchWindowAdvisor.java index e660ccf64..17250fa5b 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationWorkbenchWindowAdvisor.java +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationWorkbenchWindowAdvisor.java @@ -1,6 +1,16 @@ package org.argeo.slc.client.rcp; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; +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.ActionBarAdvisor; import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; @@ -8,7 +18,10 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor; public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + private TrayItem trayItem; + + public ApplicationWorkbenchWindowAdvisor( + IWorkbenchWindowConfigurer configurer) { super(configurer); } @@ -19,8 +32,82 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); - configurer.setInitialSize(new Point(600, 400)); + configurer.setInitialSize(new Point(800, 600)); configurer.setShowCoolBar(true); configurer.setShowStatusLine(false); } + + public void postWindowOpen() { + initTray(); + } + + @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(); + final Tray tray = window.getShell().getDisplay().getSystemTray(); + trayItem = new TrayItem(tray, SWT.NONE); + if (trayItem == null) + return; + + // image + Image trayImage = ClientRcpPlugin.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); + } + } + }); + } + + @Override + public void dispose() { + if (trayItem != null) + trayItem.dispose(); + } + } diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ClientRcpPlugin.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ClientRcpPlugin.java new file mode 100644 index 000000000..b919ac1d7 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ClientRcpPlugin.java @@ -0,0 +1,75 @@ +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 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) { + 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.ui/.classpath b/eclipse/plugins/org.argeo.slc.client.ui/.classpath index ad32c83a7..304e86186 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/.classpath +++ b/eclipse/plugins/org.argeo.slc.client.ui/.classpath @@ -1,7 +1,7 @@ - - + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs index 6abb6ecd1..95d6b05d7 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs +++ b/eclipse/plugins/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,12 @@ -#Tue Jul 27 13:26:24 CEST 2010 +#Wed Aug 04 16:31:36 CEST 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF index fb8568d40..ddb16642d 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Require-Bundle: org.eclipse.ui;resolution:=optional, org.eclipse.rap.ui;resolution:=optional, org.eclipse.core.runtime Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.argeo.slc.client.ui, org.argeo.slc.client.ui.actions, org.argeo.slc.client.ui.views diff --git a/eclipse/plugins/org.argeo.slc.client.ui/pom.xml b/eclipse/plugins/org.argeo.slc.client.ui/pom.xml new file mode 100644 index 000000000..1757c5d4a --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.ui/pom.xml @@ -0,0 +1,45 @@ + + 4.0.0 + + org.argeo.slc.eclipse + plugins + 0.13.0-SNAPSHOT + .. + + org.argeo.slc.client.ui + SLC Client UI + jar + + + + org.argeo.slc.runtime + org.argeo.slc.core + ${project.version} + + + + org.argeo.commons.eclipse + org.argeo.eclipse.ui + ${version.argeo-commons} + + + + org.springframework + org.springframework.context + + + + org.eclipse.ui + org.eclipse.ui + + + org.eclipse.core + org.eclipse.core.runtime + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86_64 + + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesContentProvider.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesContentProvider.java index 6bfb921db..8fe82baae 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesContentProvider.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesContentProvider.java @@ -21,7 +21,6 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider { private SlcAgent slcAgent; - @Override public Object[] getChildren(Object parent) { if (parent instanceof ExecutionModuleNode) { ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) parent; @@ -60,7 +59,6 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider { } } - @Override public Object getParent(Object node) { // if (node instanceof TreeObject) { // return ((TreeObject) node).getParent(); @@ -68,7 +66,6 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider { return null; } - @Override public boolean hasChildren(Object parent) { if (parent instanceof TreeParent && ((TreeParent) parent).isLoaded()) { return ((TreeParent) parent).hasChildren(); @@ -80,15 +77,12 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider { return false; } - @Override public void inputChanged(Viewer v, Object oldInput, Object newInput) { } - @Override public void dispose() { } - @Override public Object[] getElements(Object parent) { return getChildren(parent); } diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java index 0f358c36a..bc0cb889a 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java @@ -60,7 +60,6 @@ public class ExecutionModulesView extends ViewPart { viewer.setInput(getViewSite()); viewer.addDoubleClickListener(new IDoubleClickListener() { - @Override public void doubleClick(DoubleClickEvent evt) { Object obj = ((IStructuredSelection) evt.getSelection()) .getFirstElement(); diff --git a/eclipse/plugins/pom.xml b/eclipse/plugins/pom.xml new file mode 100644 index 000000000..c033575b6 --- /dev/null +++ b/eclipse/plugins/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + + org.argeo.slc + eclipse + 0.13.0-SNAPSHOT + .. + + org.argeo.slc.eclipse + plugins + Argeo Eclipse plugins + pom + + org.argeo.slc.client.ui + org.argeo.slc.client.rcp + + + + + . + + plugin.xml + META-INF/** + icons/** + + + + + + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + package + + jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + diff --git a/eclipse/pom.xml b/eclipse/pom.xml new file mode 100644 index 000000000..7ee567fed --- /dev/null +++ b/eclipse/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.argeo.slc + argeo-slc + 0.13.0-SNAPSHOT + .. + + eclipse + SLC Eclipse + pom + + plugins + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 35805260d..fddc1a675 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ runtime modules + eclipse dep server demo