From 868df693349bc9216260476abdc0401d8d63e855 Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Mon, 13 Dec 2010 15:54:07 +0000 Subject: [PATCH] Add a meta bundle for SLC to be used with RAP git-svn-id: https://svn.argeo.org/slc/trunk@3974 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../rap/ApplicationActionBarAdvisor.java | 24 +++++++ .../rap/ApplicationWorkbenchAdvisor.java | 22 ++++++ .../ApplicationWorkbenchWindowAdvisor.java | 30 ++++++++ .../org/argeo/slc/client/rap/Perspective.java | 14 ++++ .../client/rap/SlcClientRapApplication.java | 19 ++++++ .../slc/client/rap/SlcClientRapPlugin.java | 68 +++++++++++++++++++ 6 files changed, 177 insertions(+) create mode 100644 eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationActionBarAdvisor.java create mode 100644 eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchAdvisor.java create mode 100644 eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchWindowAdvisor.java create mode 100644 eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/Perspective.java create mode 100644 eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapApplication.java create mode 100644 eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapPlugin.java diff --git a/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationActionBarAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationActionBarAdvisor.java new file mode 100644 index 000000000..62904be5b --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationActionBarAdvisor.java @@ -0,0 +1,24 @@ +package org.argeo.slc.client.rap; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; + +/** + * Creates, adds and disposes actions for the menus and action bars of + * each workbench window. + */ +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + } + + protected void makeActions(IWorkbenchWindow window) { + } + + protected void fillMenuBar(IMenuManager menuBar) { + } + +} diff --git a/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchAdvisor.java new file mode 100644 index 000000000..d3d058144 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,22 @@ +package org.argeo.slc.client.rap; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +/** + * This workbench advisor creates the window advisor, and specifies + * the perspective id for the initial window. + */ +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + private static final String PERSPECTIVE_ID = "org.argeo.slc.client.ui.perspectives.slcExecution"; + + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + public String getInitialWindowPerspectiveId() { + return PERSPECTIVE_ID; + } +} diff --git a/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchWindowAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 000000000..58ef8af95 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,30 @@ +package org.argeo.slc.client.rap; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +/** + * Configures the initial size and appearance of a workbench window. + */ +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + + public ApplicationWorkbenchWindowAdvisor( + IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + public ActionBarAdvisor createActionBarAdvisor( + IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setInitialSize(new Point(1200, 900)); + configurer.setShowCoolBar(false); + configurer.setShowStatusLine(false); + } +} diff --git a/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/Perspective.java b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/Perspective.java new file mode 100644 index 000000000..51c0f24e0 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/Perspective.java @@ -0,0 +1,14 @@ +package org.argeo.slc.client.rap; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +/** + * Configures the perspective layout. This class is contributed + * through the plugin.xml. + */ +public class Perspective implements IPerspectiveFactory { + + public void createInitialLayout(IPageLayout layout) { + } +} diff --git a/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapApplication.java b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapApplication.java new file mode 100644 index 000000000..5b7fc5f59 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapApplication.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.rap; + +import org.eclipse.rwt.lifecycle.IEntryPoint; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.application.WorkbenchAdvisor; + +/** + * This class controls all aspects of the application's execution + * and is contributed through the plugin.xml. + */ +public class SlcClientRapApplication implements IEntryPoint { + + public int createUI() { + Display display = PlatformUI.createDisplay(); + WorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor(); + return PlatformUI.createAndRunWorkbench( display, advisor ); + } +} diff --git a/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapPlugin.java b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapPlugin.java new file mode 100644 index 000000000..60ca36439 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rap/src/main/java/org/argeo/slc/client/rap/SlcClientRapPlugin.java @@ -0,0 +1,68 @@ +package org.argeo.slc.client.rap; + +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 SlcClientRapPlugin extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.argeo.slc.client.rap"; //$NON-NLS-1$ + + // The shared instance + private static SlcClientRapPlugin plugin; + + /** + * The constructor + */ + public SlcClientRapPlugin() { + } + + /* + * (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 SlcClientRapPlugin 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); + } +} -- 2.39.2