diff options
author | ddunne | 2010-09-24 21:04:44 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2010-09-24 21:04:44 +0000 |
commit | e899d798bb8099aa0c9911a03db5a58e235496f0 (patch) | |
tree | e249b0bc8ef0c07cdd6c6eaf16f73b8c5e2b0fae /plugins/org.eclipse.osee.framework.plugin.core | |
parent | f7668b3e4e34dfe032ee7b68b77d08061f6e155b (diff) | |
download | org.eclipse.osee-e899d798bb8099aa0c9911a03db5a58e235496f0.tar.gz org.eclipse.osee-e899d798bb8099aa0c9911a03db5a58e235496f0.tar.xz org.eclipse.osee-e899d798bb8099aa0c9911a03db5a58e235496f0.zip |
refactor: Cleanup activators and unnecessary usage of OseeUiActivator
Diffstat (limited to 'plugins/org.eclipse.osee.framework.plugin.core')
-rw-r--r-- | plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/OseeActivator.java | 5 | ||||
-rw-r--r-- | plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/PluginUtil.java (renamed from plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/ActivatorHelper.java) | 30 |
2 files changed, 17 insertions, 18 deletions
diff --git a/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/OseeActivator.java b/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/OseeActivator.java index 4666f3b5973..20d1e915031 100644 --- a/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/OseeActivator.java +++ b/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/OseeActivator.java @@ -19,7 +19,8 @@ import org.osgi.framework.BundleContext; * @author Ryan D. Brooks */ public class OseeActivator extends Plugin { - private ActivatorHelper helper; + private PluginUtil helper; + public static String PLUGIN_ID = "PLUGIN_ID"; /** * The constructor. @@ -43,7 +44,7 @@ public class OseeActivator extends Plugin { @Override public void start(BundleContext context) throws Exception { super.start(context); - helper = new ActivatorHelper(context, this); + helper = new PluginUtil(PLUGIN_ID); } } diff --git a/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/ActivatorHelper.java b/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/PluginUtil.java index 4ee982616c7..ec634e55553 100644 --- a/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/ActivatorHelper.java +++ b/plugins/org.eclipse.osee.framework.plugin.core/src/org/eclipse/osee/framework/plugin/core/PluginUtil.java @@ -16,25 +16,19 @@ import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Platform; import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.osgi.framework.BundleContext; +import org.osgi.framework.Bundle; /** * @author Ryan D. Brooks */ -public class ActivatorHelper { - private static Map<String, Plugin> pluginIdToOseePlugin = new HashMap<String, Plugin>(); - private final BundleContext context; - private final Plugin plugin; +public class PluginUtil { + private final String pluginId; - public ActivatorHelper(BundleContext context, Plugin plugin) { - pluginIdToOseePlugin.put(plugin.getBundle().getSymbolicName(), plugin); - this.context = context; - this.plugin = plugin; + public PluginUtil(String pluginId) { + this.pluginId = pluginId; } /** @@ -42,7 +36,8 @@ public class ActivatorHelper { * myworkspace/.metadata/.plugins/org.eclipse.pde.core/myPlugin/... */ public File getPluginStoreFile(String path) { - return context.getDataFile(path); + Bundle bundle = Platform.getBundle(pluginId); + return bundle.getBundleContext().getDataFile(path); } /** @@ -62,15 +57,18 @@ public class ActivatorHelper { } public InputStream getInputStream(String resource) throws IOException { - return plugin.getBundle().getEntry(resource).openStream(); + Bundle bundle = Platform.getBundle(pluginId); + return bundle.getEntry(resource).openStream(); } - public List<URL> getInputStreams(String directory, String pattern, boolean recurse) throws IOException { - Enumeration<?> enumeration = plugin.getBundle().findEntries(directory, pattern, recurse); + public List<URL> getInputStreams(String directory, String pattern, boolean recurse) { + Bundle bundle = Platform.getBundle(pluginId); + Enumeration<?> enumeration = bundle.findEntries(directory, pattern, recurse); List<URL> inputs = new ArrayList<URL>(); while (enumeration.hasMoreElements()) { inputs.add(((URL) enumeration.nextElement())); } return inputs; } + } |