diff options
author | slewis | 2009-03-21 23:53:55 +0000 |
---|---|---|
committer | slewis | 2009-03-21 23:53:55 +0000 |
commit | 7b585d5c720313834c4bc4199954c3bfdbbfe32a (patch) | |
tree | 3363c7cabb54bd333a1f9e072a3b279973247478 /doc | |
parent | 447d1fa8c8b2dcc5cf2391af767149f3c1be6d4a (diff) | |
download | org.eclipse.ecf-7b585d5c720313834c4bc4199954c3bfdbbfe32a.tar.gz org.eclipse.ecf-7b585d5c720313834c4bc4199954c3bfdbbfe32a.tar.xz org.eclipse.ecf-7b585d5c720313834c4bc4199954c3bfdbbfe32a.zip |
Initial checkin of lab1
Diffstat (limited to 'doc')
9 files changed, 269 insertions, 0 deletions
diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.classpath b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.project b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.project new file mode 100644 index 000000000..a8b0eb068 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.tutorial.lab1</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> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.settings/org.eclipse.jdt.core.prefs b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..2127c4893 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Sat Mar 21 16:30:30 PDT 2009 +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/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/META-INF/MANIFEST.MF b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/META-INF/MANIFEST.MF new file mode 100644 index 000000000..fa7816eb5 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ECF EclipseCon2009 Tutorial Lab 1 +Bundle-SymbolicName: org.eclipse.ecf.tutorial.lab1; singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.ecf.tutorial.internal.lab1.Activator +Bundle-Vendor: Eclipse.org +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.ecf.core;version="3.0.0", + org.eclipse.ecf.core.events, + org.eclipse.ecf.core.identity;version="3.0.0", + org.eclipse.ecf.remoteservice, + org.eclipse.ecf.remoteservice.events, + org.eclipse.ecf.remoteservice.util, + org.eclipse.ecf.remoteservice.util.tracker diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/build.properties b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/build.properties new file mode 100644 index 000000000..0d3d3a745 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/ diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/icons/sample.gif b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/icons/sample.gif Binary files differnew file mode 100644 index 000000000..34fb3c9d8 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/icons/sample.gif diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/plugin.xml b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/plugin.xml new file mode 100644 index 000000000..fc60613bc --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/plugin.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + + <extension + point="org.eclipse.ui.actionSets"> + <actionSet + label="Sample Action Set" + visible="true" + id="org.eclipse.ecf.tutorial.lab1.actionSet"> + <menu + label="Sample &Menu" + id="sampleMenu"> + <separator + name="sampleGroup"> + </separator> + </menu> + <action + label="&Sample Action" + icon="icons/sample.gif" + class="org.eclipse.ecf.tutorial.lab1.actions.SampleAction" + tooltip="Hello, Eclipse world" + menubarPath="sampleMenu/sampleGroup" + toolbarPath="sampleGroup" + id="org.eclipse.ecf.tutorial.lab1.actions.SampleAction"> + </action> + </actionSet> + </extension> + +</plugin> diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/src/org/eclipse/ecf/tutorial/internal/lab1/Activator.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/src/org/eclipse/ecf/tutorial/internal/lab1/Activator.java new file mode 100644 index 000000000..e71f27418 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/src/org/eclipse/ecf/tutorial/internal/lab1/Activator.java @@ -0,0 +1,81 @@ +package org.eclipse.ecf.tutorial.internal.lab1; + +import org.eclipse.ecf.core.IContainerManager; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; + +/** + * 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.eclipse.ecf.tutorial.lab1"; + + // The shared instance + private static Activator plugin; + + private ServiceTracker containerManagerTracker; + + private BundleContext context; + + /** + * The constructor + */ + public Activator() { + } + + public IContainerManager getContainerManager() { + if (containerManagerTracker == null) { + containerManagerTracker = new ServiceTracker(context,IContainerManager.class.getName(),null); + containerManagerTracker.open(); + } + return (IContainerManager) containerManagerTracker.getService(); + } + + /* + * (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; + this.context = context; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (containerManagerTracker != null) { + containerManagerTracker.close(); + containerManagerTracker = null; + } + 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/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/src/org/eclipse/ecf/tutorial/lab1/actions/SampleAction.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/src/org/eclipse/ecf/tutorial/lab1/actions/SampleAction.java new file mode 100644 index 000000000..8bfe4b387 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.lab1/src/org/eclipse/ecf/tutorial/lab1/actions/SampleAction.java @@ -0,0 +1,85 @@ +package org.eclipse.ecf.tutorial.lab1.actions; + +import org.eclipse.ecf.core.ContainerCreateException; +import org.eclipse.ecf.core.IContainer; +import org.eclipse.ecf.core.IContainerFactory; +import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter; +import org.eclipse.ecf.tutorial.internal.lab1.Activator; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +/** + * Our sample action implements workbench action delegate. + * The action proxy will be created by the workbench and + * shown in the UI. When the user tries to use the action, + * this delegate will be created and execution will be + * delegated to it. + * @see IWorkbenchWindowActionDelegate + */ +public class SampleAction implements IWorkbenchWindowActionDelegate { + private IWorkbenchWindow window; + + public static final String R_OSGI_TYPE = "ecf.r_osgi.peer"; + public static final String GENERIC_TYPE = "ecf.generic.client"; + + /** + * The constructor. + */ + public SampleAction() { + } + + protected IContainerFactory getContainerFactory() { + return Activator.getDefault().getContainerManager().getContainerFactory(); + } + + protected IContainer createContainer(String type) throws ContainerCreateException { + return getContainerFactory().createContainer(type); + } + + protected IRemoteServiceContainerAdapter getRemoteServicesContainerAdapter(IContainer container) { + return (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class); + } + + /** + * The action has been activated. The argument of the + * method represents the 'real' action sitting + * in the workbench UI. + * @see IWorkbenchWindowActionDelegate#run + */ + public void run(IAction action) { + MessageDialog.openInformation( + window.getShell(), + "ECF EclipseCon2009 Tutorial Lab 1", + "Hello, Eclipse world"); + } + + /** + * Selection in the workbench has been changed. We + * can change the state of the 'real' action here + * if we want, but this can only happen after + * the delegate has been created. + * @see IWorkbenchWindowActionDelegate#selectionChanged + */ + public void selectionChanged(IAction action, ISelection selection) { + } + + /** + * We can use this method to dispose of any system + * resources we previously allocated. + * @see IWorkbenchWindowActionDelegate#dispose + */ + public void dispose() { + } + + /** + * We will cache window object in order to + * be able to provide parent shell for the message dialog. + * @see IWorkbenchWindowActionDelegate#init + */ + public void init(IWorkbenchWindow window) { + this.window = window; + } +}
\ No newline at end of file |