public void ancestorAdded(AncestorEvent event) { // add a listener for when the window gets activated ProtegeManager.getInstance().getFrame(workspace).addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent event) { handleWindowActivated(); } }); workspace.removeAncestorListener(this); }
private void handleClose(OWLOntology ont){ if (owlEditorKit.getModelManager().removeOntology(ont)){ ontologies.remove(ont); reload(); } else{ ProtegeManager.getInstance().disposeOfEditorKit(owlEditorKit); } }
public void editURI(URI uri) throws Exception { ProtegeManager pm = ProtegeManager.getInstance(); for (EditorKitFactoryPlugin plugin : pm.getEditorKitFactoryPlugins()) { if (plugin.newInstance().canLoad(uri)) { pm.loadAndSetupEditorKitFromURI(plugin, uri); // welcomeFrame.setVisible(false); break; } } }
/** * Creates and sets up a new (probably empty) . The new <code>EditorKit</code> will be passed to the * <code>EditorKitManager</code> for installation. * * @param plugin The <code>EditorKitFactoryPlugin</code> that describes the <code>EditorKitFactory</code> which will * be used to create the <code>EditorKit</code>. */ public synchronized boolean createAndSetupNewEditorKit(EditorKitFactoryPlugin plugin) throws Exception { EditorKitFactory editorKitFactory = getEditorKitFactory(plugin); return createAndSetupNewEditorKit(editorKitFactory) != null; }
@Override protected void editFile(String fileName) throws Exception { ProtegeManager.getInstance().getApplication().editURI(new File(fileName).toURI()); }
public void handleClose() { if (!quitting) { final EditorKitManager eKitMngr = ProtegeManager.getInstance().getEditorKitManager(); if (eKitMngr.getEditorKitCount() == 0) { handleQuit(); } } }
/** * Gets the default (first) editor kit factory plugin and uses it to create and setup and empty editor kit. */ private void createAndSetupDefaultEditorKit() { try { ProtegeManager pm = ProtegeManager.getInstance(); List<EditorKitFactoryPlugin> editorKitFactoryPlugins = pm.getEditorKitFactoryPlugins(); if (!editorKitFactoryPlugins.isEmpty()) { EditorKitFactoryPlugin defaultPlugin = editorKitFactoryPlugins.get(0); pm.createAndSetupNewEditorKit(defaultPlugin); } else { throw new RuntimeException("No editor kit factory plugins available"); } } catch (Exception e) { ErrorLogPanel.showErrorDialog(e); } }
public void openInNewWorkspace() throws Exception { for (EditorKitFactoryPlugin plugin : ProtegeManager.getInstance().getEditorKitFactoryPlugins()) { if (plugin.getId().equals(getEditorKit().getEditorKitFactory().getId())) { ProtegeManager.getInstance().openAndSetupEditorKit(plugin); break; } } }
public boolean openAndSetupRecentEditorKit(EditorKitDescriptor editorKitDescriptor) throws Exception { for (EditorKitFactoryPlugin plugin : getEditorKitFactoryPlugins()) { if (plugin.getId().equals(editorKitDescriptor.getEditorKitFactoryID())) { EditorKitFactory editorKitFactory = getEditorKitFactory(plugin); EditorKit editorKit = editorKitFactory.createEditorKit(); if (editorKit.handleLoadRecentRequest(editorKitDescriptor)) { getEditorKitManager().addEditorKit(editorKit); closeFirstEditorKitIfNotModified(); return true; } } } return false; }
public void actionPerformed(ActionEvent e) { try { if (ProtegeManager.getInstance().createAndSetupNewEditorKit(plugin)) { dispose(); } } catch (Throwable e1) { ErrorLogPanel.showErrorDialog(e1); } } });
public void pruneInvalidDescriptors() { for(EditorKitFactoryPlugin plugin : ProtegeManager.getInstance().getEditorKitFactoryPlugins()) { EditorKitFactory factory = plugin.newInstance(); for(Iterator<EditorKitDescriptor> it = editorKitDescriptors.iterator(); it.hasNext(); ) { if(!factory.isValidDescriptor(it.next())) { it.remove(); } } } }
public boolean openAndSetupRecentEditorKit(EditorKitDescriptor editorKitDescriptor) throws Exception { for (EditorKitFactoryPlugin plugin : getEditorKitFactoryPlugins()) { if (plugin.getId().equals(editorKitDescriptor.getEditorKitFactoryID())) { EditorKitFactory editorKitFactory = getEditorKitFactory(plugin); EditorKit editorKit = editorKitFactory.createEditorKit(); if (editorKit.handleLoadRecentRequest(editorKitDescriptor)) { getEditorKitManager().addEditorKit(editorKit); return true; } } } return false; }
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."); }
private void handleOpenFromURI(EditorKitFactoryPlugin plugin) { try { URI uri = OpenFromURLPanel.showDialog(); if (uri != null) { if (ProtegeManager.getInstance().loadAndSetupEditorKitFromURI(plugin, uri)) { dispose(); } } } catch (Exception e1) { ErrorLogPanel.showErrorDialog(e1); } }
public void actionPerformed(ActionEvent e) { try { ProtegeManager.getInstance().saveEditorKit(getEditorKit()); } catch (Exception e1) { ErrorLogPanel.showErrorDialog(e1); } }
public void actionPerformed(ActionEvent e) { try { ProtegeManager.getInstance().saveEditorKitAs(getEditorKit()); } catch (Exception ex) { ErrorLogPanel.showErrorDialog(ex); } }
public void saveEditorKitAs(EditorKit editorKit) throws Exception { editorKit.handleSaveAs(); getFrame(editorKit.getWorkspace()).updateTitle(); }
/** * This is a convenience method that can be used to obtain the top level frame for a <code>Workspace</code>. This * method actually delegates to the <code>WorkspaceManager</code> * * @param workspace The <code>Workspace</code> for which the top level frame is to be retrieved. * * @return The top level frame for a <code>Workspace</code> or <code>null</code> if there is no such * <code>Workspace</code> or no frame exists. */ public WorkspaceFrame getFrame(Workspace workspace) { return getEditorKitManager().getWorkspaceManager().getFrame(workspace); }
public boolean loadAndSetupEditorKitFromURI(EditorKitFactoryPlugin plugin, URI uri) throws Exception { EditorKitFactory editorKitFactory = getEditorKitFactory(plugin); if (editorKitFactory != null) { boolean success = false; EditorKit editorKit = editorKitFactory.createEditorKit(); try { if (editorKit.handleLoadFrom(uri)) { getEditorKitManager().addEditorKit(editorKit); success = true; return true; } } finally { if (!success) { editorKit.dispose(); } } } return false; }
/** * Gets hold of the one and only <code>ProtegeManager</code> */ public static synchronized ProtegeManager getInstance() { if (instance == null) { instance = new ProtegeManager(); } return instance; }