public PluginEvent(String pluginName) { _parentPlugins = new ArrayList<String>(); for (Extension parent : PluginManager.lookup(this).getRegistry().getPluginDescriptor(pluginName).getExtensions()) { _parentPlugins.add(parent.getExtendedPluginId() + "@" + parent.getExtendedPointId()); } _plugin = pluginName; }
private IResources initResources() { ProxySplashscreen.getInstance().displayStatusMessage("Loading Resources..."); // $NON-NLS-1$ AnathemaResources resources = new AnathemaResources(); for (Extension extension : pluginManager.getExtension(IPluginConstants.PLUGIN_CORE, EXTENSION_POINT_RESOURCES)) { for (Parameter param : extension.getParameters(PARAM_BUNDLE)) { resources.addResourceBundle(param.valueAsString(), pluginManager.getClassLoader(extension)); } } return resources; }
public void init() { listeners = new ArrayList<UserListener>(); // Acquire the 'UserListener' extensions of the core plugin PluginRegistry registry = PluginRegistry.getInstance(); Collection<Extension> exts = registry.getExtensions("logicaldoc-core", "UserListener"); // Sort the extensions according to ascending position List<Extension> sortedExts = new ArrayList<Extension>(); for (Extension extension : exts) { sortedExts.add(extension); } Collections.sort( sortedExts, new Comparator<Extension>() { public int compare(Extension e1, Extension e2) { int position1 = Integer.parseInt(e1.getParameter("position").valueAsString()); int position2 = Integer.parseInt(e2.getParameter("position").valueAsString()); if (position1 < position2) return -1; else if (position1 > position2) return 1; else return 0; } }); for (Extension ext : sortedExts) { String className = ext.getParameter("class").valueAsString(); try { Class clazz = Class.forName(className); // Try to instantiate the listener Object listener = clazz.newInstance(); if (!(listener instanceof UserListener)) throw new Exception( "The specified listener " + className + " doesn't implement UserListener interface"); listeners.add((UserListener) listener); log.info( "Added new user listener " + className + " position " + ext.getParameter("position").valueAsString()); } catch (Throwable e) { log.error(e.getMessage()); } } }
public void drawWindow() { HashSet<SettingsExtension> set = new HashSet<SettingsExtension>(); try { for (Extension e : ext.getAvailableExtensions()) { PluginDescriptor pd = e.getDeclaringPluginDescriptor(); // if(manager.isPluginActivated(pd)){ Plugin plugin = manager.getPlugin(pd.getId()); if (plugin instanceof SettingsExtension) { set.add((SettingsExtension) plugin); } // } } } catch (PluginLifecycleException x) { x.printStackTrace(); } set.add(new NTorrentPlugins()); SettingsExtension[] array = new SettingsExtension[set.size()]; set.toArray(array); SettingsWindow window = new SettingsWindow(array); window.validate(); window.pack(); window.setSize(640, 480); window.setVisible(true); }