]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Delete unused objects
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 29 Jul 2010 12:50:40 +0000 (12:50 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 29 Jul 2010 12:50:40 +0000 (12:50 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3726 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/spring/ApplicationContextTracker.java [deleted file]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/spring/SpringExtensionFactory.java [deleted file]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/ui/TreeObject.java [deleted file]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/ui/TreeParent.java [deleted file]

diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/spring/ApplicationContextTracker.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/spring/ApplicationContextTracker.java
deleted file mode 100644 (file)
index be53a97..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.argeo.eclipse.spring;\r
-\r
-import static java.text.MessageFormat.format;\r
-\r
-import org.osgi.framework.Bundle;\r
-import org.osgi.framework.BundleContext;\r
-import org.osgi.framework.FrameworkUtil;\r
-import org.osgi.framework.InvalidSyntaxException;\r
-import org.osgi.util.tracker.ServiceTracker;\r
-import org.springframework.context.ApplicationContext;\r
-\r
-/**\r
- * @author Heiko Seeberger\r
- */\r
-public class ApplicationContextTracker {\r
-\r
-       private static final String FILTER = "(&(objectClass=org.springframework.context.ApplicationContext)" //$NON-NLS-1$\r
-                       + "(org.springframework.context.service.name={0}))"; //$NON-NLS-1$\r
-\r
-       private ServiceTracker applicationContextServiceTracker;\r
-\r
-       /**\r
-        * @param contributorBundle\r
-        *              OSGi bundle for which the Spring application context is to be\r
-        *              tracked. Must not be null!\r
-        * @param factoryBundleContext\r
-        *      BundleContext object which can be used to track services\r
-        * @throws IllegalArgumentException\r
-        *              if the given bundle is null.\r
-        */\r
-       public ApplicationContextTracker(final Bundle contributorBundle, final BundleContext factoryBundleContext) {\r
-               final String filter = format(FILTER, contributorBundle.getSymbolicName());\r
-               try {\r
-                       applicationContextServiceTracker = new ServiceTracker(\r
-                                       factoryBundleContext, FrameworkUtil.createFilter(filter), null);\r
-                       applicationContextServiceTracker.open();\r
-               } catch (final InvalidSyntaxException e) {\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-\r
-       public void close() {\r
-               if (applicationContextServiceTracker != null) {\r
-                       applicationContextServiceTracker.close();\r
-               }\r
-       }\r
-\r
-       public ApplicationContext getApplicationContext() {\r
-               ApplicationContext applicationContext = null;\r
-               if (applicationContextServiceTracker != null) {\r
-                       try {\r
-                               applicationContext = (ApplicationContext) applicationContextServiceTracker\r
-                                               .waitForService(5000);\r
-                       } catch (InterruptedException e) {\r
-                               e.printStackTrace();\r
-                       }\r
-               }\r
-               return applicationContext;\r
-       }\r
-\r
-       @Override\r
-       protected void finalize() throws Throwable {\r
-               close();\r
-               super.finalize();\r
-       }\r
-}\r
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/spring/SpringExtensionFactory.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/spring/SpringExtensionFactory.java
deleted file mode 100644 (file)
index 7e38dde..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.argeo.eclipse.spring;\r
-\r
-import org.argeo.slc.client.ui.ClientUiPlugin;\r
-import org.eclipse.core.runtime.CoreException;\r
-import org.eclipse.core.runtime.IConfigurationElement;\r
-import org.eclipse.core.runtime.IExecutableExtension;\r
-import org.eclipse.core.runtime.IExecutableExtensionFactory;\r
-import org.eclipse.core.runtime.IExtension;\r
-import org.eclipse.core.runtime.Platform;\r
-import org.osgi.framework.Bundle;\r
-import org.osgi.framework.BundleException;\r
-import org.springframework.context.ApplicationContext;\r
-\r
-/**\r
- * The Spring Extension Factory builds a bridge between the Eclipse Extension\r
- * Registry and the Spring Framework (especially Spring Dynamic Modules).\r
- * \r
- * It allows you to define your extension as a spring bean within the spring\r
- * application context of your bundle. If you would like to use this bean as an\r
- * instance of an extension (an Eclipse RCP view, for example) you define the\r
- * extension with this spring extension factory as the class to be created.\r
- * \r
- * To let the spring extension factory pick the right bean from your application\r
- * context you need to set the bean id to the same value as the id of the view\r
- * within the view definition, for example. This is important if your extension\r
- * definition contains more than one element, where each element has its own id.\r
- * \r
- * If the extension definition elements themselves have no id attribute the\r
- * spring extension factory uses the id of the extension itself to identify the\r
- * bean.\r
- * \r
- * @author Martin Lippert\r
- */\r
-public class SpringExtensionFactory implements IExecutableExtensionFactory,\r
-               IExecutableExtension {\r
-\r
-       private Object bean;\r
-\r
-       public Object create() throws CoreException {\r
-               return bean;\r
-       }\r
-\r
-       public void setInitializationData(IConfigurationElement config,\r
-                       String propertyName, Object data) throws CoreException {\r
-               String beanName = getBeanName(data, config);\r
-               ApplicationContext appContext = getApplicationContext(config);\r
-\r
-               if (beanName != null && appContext != null) {\r
-                       this.bean = appContext.getBean(beanName);\r
-                       if (this.bean instanceof IExecutableExtension) {\r
-                               ((IExecutableExtension) this.bean).setInitializationData(\r
-                                               config, propertyName, data);\r
-                       }\r
-               }\r
-       }\r
-\r
-       private String getBeanName(Object data, IConfigurationElement config) {\r
-               \r
-               // try the specific bean id the extension defines\r
-               if (data != null && data.toString().length() > 0) {\r
-                       return data.toString();\r
-               }\r
-\r
-               // try the id of the config element\r
-               if (config.getAttribute("id") != null) {\r
-                       return config.getAttribute("id");\r
-               }\r
-\r
-               // try the id of the extension element itself\r
-               if (config.getParent() != null\r
-                               && config.getParent() instanceof IExtension) {\r
-                       IExtension extensionDefinition = (IExtension) config.getParent();\r
-                       return extensionDefinition.getSimpleIdentifier();\r
-               }\r
-\r
-               return null;\r
-       }\r
-\r
-       private ApplicationContext getApplicationContext(\r
-                       IConfigurationElement config) {\r
-               String contributorName = config.getContributor().getName();\r
-               Bundle contributorBundle = Platform.getBundle(contributorName);\r
-\r
-               if (contributorBundle.getState() != Bundle.ACTIVE && contributorBundle.getState() != Bundle.STARTING) {\r
-                       try {\r
-                               System.out.println("starting bundle: " + contributorBundle.getSymbolicName());\r
-                               contributorBundle.start();\r
-                       } catch (BundleException e) {\r
-                               e.printStackTrace();\r
-                       }\r
-               }\r
-\r
-               final ApplicationContextTracker applicationContextTracker = new ApplicationContextTracker(\r
-                               contributorBundle, ClientUiPlugin.getDefault().getBundleContext());\r
-               ApplicationContext applicationContext = null;\r
-               try {\r
-                       applicationContext = applicationContextTracker\r
-                                       .getApplicationContext();\r
-               } finally {\r
-                       applicationContextTracker.close();\r
-               }\r
-               return applicationContext;\r
-       }\r
-\r
-}\r
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/ui/TreeObject.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/ui/TreeObject.java
deleted file mode 100644 (file)
index d75db78..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.argeo.eclipse.ui;
-
-public class TreeObject {
-       private String name;
-       private TreeParent parent;
-
-       public TreeObject(String name) {
-               this.name = name;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void setParent(TreeParent parent) {
-               this.parent = parent;
-       }
-
-       public TreeParent getParent() {
-               return parent;
-       }
-
-       public String toString() {
-               return getName();
-       }
-}
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/ui/TreeParent.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/eclipse/ui/TreeParent.java
deleted file mode 100644 (file)
index d45844d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.argeo.eclipse.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TreeParent extends TreeObject {
-       private List<TreeObject> children;
-
-       private boolean loaded;
-
-       public TreeParent(String name) {
-               super(name);
-               children = new ArrayList<TreeObject>();
-               loaded = false;
-       }
-
-       public synchronized void addChild(TreeObject child) {
-               loaded = true;
-               children.add(child);
-               child.setParent(this);
-       }
-
-       public synchronized void removeChild(TreeObject child) {
-               children.remove(child);
-               child.setParent(null);
-       }
-
-       public synchronized void clearChildren() {
-               loaded = false;
-               children.clear();
-       }
-
-       public synchronized TreeObject[] getChildren() {
-               return (TreeObject[]) children.toArray(new TreeObject[children.size()]);
-       }
-
-       public synchronized boolean hasChildren() {
-               return children.size() > 0;
-       }
-
-       public synchronized Boolean isLoaded() {
-               return loaded;
-       }
-}