/** * Gets the name of the action. This is the name * that will be used for the menu item text etc. */ public String getName() { return PluginUtilities.getAttribute(extension, ProtegeActionPluginJPFImpl.NAME_PARAM); }
public URL getDefaultViewConfigFile() { PluginUtilities util = PluginUtilities.getInstance(); Bundle contributor = util.getBundle(extension); String resource = PluginProperties.getParameterValue(extension, DEFAULT_VIEW_CONFIG_FILE_NAME_PARAM, null); if (resource != null) { return contributor.getResource(resource); } else { return null; } } }
/** * Gets the one and only instance of <code>PluginUtilities</code>. */ public static synchronized PluginUtilities getInstance() { if (instance == null) { instance = new PluginUtilities(); } return instance; }
public String getDocumentation() { return PluginUtilities.getInstance().getDocumentation(extension); }
/** * Creates an instance of the plugin * @return An instance of type <code>E</code>. Note that a <code>null</code> * value will be returned if there was a problem creating the instance. * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException */ @SuppressWarnings("unchecked") public E instantiate() throws ClassCastException, InstantiationException, IllegalAccessException, ClassNotFoundException { Object o = PluginUtilities.getInstance().getExtensionObject(extension, PluginProperties.CLASS_PARAM_NAME); return (E) o; } }
public Object getExtensionObject(IExtension ext, String property) throws InstantiationException, IllegalAccessException, ClassNotFoundException { Bundle b = getBundle(ext); return b.loadClass(getAttribute(ext, property)).newInstance(); // return config.createExecutableExtension(property); }
private void addReasonerListener(final JMenuBar menuBar) { final IExtensionRegistry registry = PluginUtilities.getInstance().getExtensionRegistry(); final IExtensionPoint point = registry.getExtensionPoint(ProtegeOWL.ID, ProtegeOWLReasonerPlugin.REASONER_PLUGIN_TYPE_ID); registry.addListener(new IRegistryEventListener() { public void added(IExtension[] extensions) { OWLReasonerManagerImpl reasonerManager = (OWLReasonerManagerImpl) getOWLModelManager().getOWLReasonerManager(); Set<ProtegeOWLReasonerPlugin> plugins = new HashSet<>(); for (IExtension extension : extensions) { plugins.add(new ProtegeOWLReasonerPluginJPFImpl(getOWLModelManager(), extension)); } reasonerManager.addReasonerFactories(plugins); rebuildReasonerMenu(menuBar); menuBar.repaint(); } public void added(IExtensionPoint[] extensionPoints) { } public void removed(IExtension[] extensions) { } public void removed(IExtensionPoint[] extensionPoints) { } }, point.getUniqueIdentifier()); }
public AboutPanel() { setLayout(new BorderLayout()); JPanel pluginPanel = new JPanel(new BorderLayout()); pluginPanel.add(new JScrollPane(new PluginInfoTable())); pluginPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plugin information"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); add(pluginPanel); JPanel logoPanel = new JPanel(new BorderLayout(3, 3)); JLabel logoLabel = new JLabel(Icons.getIcon("logo.banner.gif")); logoPanel.add(logoLabel, BorderLayout.NORTH); BundleContext applicationContext = PluginUtilities.getInstance().getApplicationContext(); Bundle application = applicationContext.getBundle(); Version v = PluginUtilities.getBundleVersion(application); String build = PluginUtilities.getBuildNumber(application); String versionString = "Version " + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + " (Build " + build + ")"; JLabel label = new JLabel(versionString, JLabel.CENTER); logoPanel.add(label, BorderLayout.SOUTH); logoPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 20, 5)); add(logoPanel, BorderLayout.NORTH); JLabel copy = new JLabel( "<html><body>Protege is a collaborative development effort between Stanford University and University of Manchester.<br><br>" + "Protege-OWL 4 and Protege-Core Framework Copyright (c) The University of Manchester 2006"); copy.setFont(copy.getFont().deriveFont(10.0f)); copy.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); add(copy, BorderLayout.SOUTH); }
public AboutPanel() { setLayout(new BorderLayout()); BundleContext applicationContext = PluginUtilities.getInstance().getApplicationContext(); Bundle application = applicationContext.getBundle(); Version v = PluginUtilities.getBundleVersion(application); String versionString = String.format("%d.%d.%d", v.getMajor(), v.getMinor(), v.getMicro()); if(!v.getQualifier().isEmpty()) {
public void stop(BundleContext context) throws Exception { BookMarkedURIManager.getInstance().dispose(); RecentEditorKitManager.getInstance().save(); RecentEditorKitManager.getInstance().dispose(); PluginUtilities.getInstance().dispose(); ProtegeManager.getInstance().dispose(); logger.info("Thank you for using Protege. Goodbye."); }
public Bundle getExtensionPointBundle(IExtension extension) { IExtensionRegistry registry = getExtensionRegistry(); String extensionPtId = extension.getExtensionPointUniqueIdentifier(); IExtensionPoint extensionPt = registry.getExtensionPoint(extensionPtId); IContributor contributor = extensionPt.getContributor(); return getBundle(contributor); }
protected ProtegeApplication initApplication() throws Exception { try { PluginUtilities.getInstance().initialise(context); loadDefaults(); initializeLookAndFeel(); setupExceptionHandler(); processCommandLineURIs(); // plugins may set arguments loadRecentEditorKits(); } finally { initialized = true; } return this; }
public static Icon getIcon(String name) { try { Bundle b = PluginUtilities.getInstance().getApplicationBundle(); URL url = b.getResource(name); if (url != null) { return new ImageIcon(url); } return null; } catch (Exception e) { return null; } } }
public Version getCurrentVersion() { return PluginUtilities.getBundleVersion(b); }
private void displayPlatform() { Bundle b = context.getBundle(); Version v = PluginUtilities.getBundleVersion(b); logger.info("Starting Protege 4 OWL Editor (Version " + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + ", Build = " + PluginUtilities.getBuildNumber(b) + ")"); logger.info("Platform:"); logger.info(" Java: JVM " + System.getProperty("java.runtime.version") + " Memory: " + (Runtime.getRuntime().maxMemory() / 1000000) + "M"); logger.info(" Language: " + Locale.getDefault().getLanguage() + ", Country: " + Locale.getDefault().getCountry()); logger.info(" Framework: " + context.getProperty(Constants.FRAMEWORK_VENDOR) + " (" + context.getProperty(Constants.FRAMEWORK_VERSION) + ")"); logger.info(" OS: " + context.getProperty(Constants.FRAMEWORK_OS_NAME) + " (" + context.getProperty(Constants.FRAMEWORK_OS_VERSION) + ")"); logger.info(" Processor: " + context.getProperty(Constants.FRAMEWORK_PROCESSOR)); }
public Bundle getBundle(IExtension extension) { IContributor contributor = extension.getContributor(); return getBundle(contributor); }
public static String getAttribute(IExtension ext, String key) { return getAttributes(ext).get(key); }
private void addReasonerListener(final JMenuBar menuBar) { final IExtensionRegistry registry = PluginUtilities.getInstance().getExtensionRegistry(); final IExtensionPoint point = registry.getExtensionPoint(ProtegeOWL.ID, ProtegeOWLReasonerPlugin.REASONER_PLUGIN_TYPE_ID); registry.addListener(new IRegistryEventListener() { public void added(IExtension[] extensions) { OWLReasonerManagerImpl reasonerManager = (OWLReasonerManagerImpl) getOWLModelManager().getOWLReasonerManager(); Set<ProtegeOWLReasonerPlugin> plugins = new HashSet<>(); for (IExtension extension : extensions) { plugins.add(new ProtegeOWLReasonerPluginJPFImpl(getOWLModelManager(), extension)); } reasonerManager.addReasonerFactories(plugins); rebuildReasonerMenu(menuBar); menuBar.repaint(); } public void added(IExtensionPoint[] extensionPoints) { } public void removed(IExtension[] extensions) { } public void removed(IExtensionPoint[] extensionPoints) { } }, point.getUniqueIdentifier()); }
public AboutPanel() { setLayout(new BorderLayout()); JPanel pluginPanel = new JPanel(new BorderLayout()); pluginPanel.add(new JScrollPane(new PluginInfoTable())); pluginPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plugin information"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); add(pluginPanel); JPanel logoPanel = new JPanel(new BorderLayout(3, 3)); JLabel logoLabel = new JLabel(Icons.getIcon("logo.banner.gif")); logoPanel.add(logoLabel, BorderLayout.NORTH); BundleContext applicationContext = PluginUtilities.getInstance().getApplicationContext(); Bundle application = applicationContext.getBundle(); Version v = PluginUtilities.getBundleVersion(application); String build = PluginUtilities.getBuildNumber(application); String versionString = "Version " + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + " (Build " + build + ")"; JLabel label = new JLabel(versionString, JLabel.CENTER); logoPanel.add(label, BorderLayout.SOUTH); logoPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 20, 5)); add(logoPanel, BorderLayout.NORTH); JLabel copy = new JLabel( "<html><body>Protege is a collaborative development effort between Stanford University and University of Manchester.<br><br>" + "Protege-OWL 4 and Protege-Core Framework Copyright (c) The University of Manchester 2006"); copy.setFont(copy.getFont().deriveFont(10.0f)); copy.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); add(copy, BorderLayout.SOUTH); }
public String getDocumentation() { return PluginUtilities.getInstance().getDocumentation(extension); }