public OWLEditorKit getOWLEditorKit() { return (OWLEditorKit) getWorkspace().getEditorKit(); }
public void actionPerformed(ActionEvent e) { WorkspaceViewManager viewManager = workspace.getViewManager(); viewManager.showView(plugin.getId());; } };
public void actionPerformed(ActionEvent e) { try { if (!workspace.containsTab(plugin.getId())) { WorkspaceTab tab = plugin.newInstance(); workspace.addTab(tab); } else { WorkspaceTab tab = workspace.getWorkspaceTab(plugin.getId()); workspace.removeTab(tab); tab.dispose(); } } catch (Exception ex) { LOGGER.error("Exception caught (re)building tab menu", ex); } } });
public static WorkspaceTab handleCreateNewTab(TabbedWorkspace workspace) { final String name = JOptionPane.showInputDialog(workspace, "Please enter a name for the new tab"); if (name != null) { CustomWorkspaceTabsManager customTabsManager = workspace.getCustomTabsManager(); WorkspaceTab tab = workspace.addTabForPlugin(customTabsManager.getPluginForTabName(name, workspace)); workspace.setSelectedTab(tab); return tab; } return null; } }
/** * Override of the <code>Workspace</code> initialise method. */ public void initialise() { JPanel tabHolder = new JPanel(new BorderLayout()); workspaceTabs = new HashSet<WorkspaceTab>(); // Create the tabs. tabbedPane = new JTabbedPane(); tabHolder.add(tabbedPane); setContent(tabbedPane); // Here we either need to load the default tabs, or // restore a set of tabs final List<String> visibleTabs = new TabbedWorkspaceStateManager().getTabs(); // If no tabs are set as visible (ie we have yet to customise, show all by default for (WorkspaceTabPlugin plugin : getOrderedPlugins()) { if (visibleTabs.isEmpty() || visibleTabs.contains(plugin.getId())) { addTabForPlugin(plugin); } } }
public void actionPerformed(ActionEvent event) { TabbedWorkspace workspace = (TabbedWorkspace) getWorkspace(); LoadedTabsSelector selector = new LoadedTabsSelector(workspace); int ret = JOptionPaneEx.showConfirmDialog(workspace, "Delete Tabs", selector, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, selector); if (ret == JOptionPane.OK_OPTION){ for (WorkspaceTabPlugin tabPlugin : selector.getSelectedTabs()){ final String id = tabPlugin.getId(); if (workspace.containsTab(id)) { // make sure we remove it from the workspace if it is currently active WorkspaceTab tab = workspace.getWorkspaceTab(id); workspace.removeTab(tab); try { tab.dispose(); } catch (Exception e) { throw new RuntimeException(e); } } workspace.getCustomTabsManager().deleteCustomTab(id); } } }
private void updateEnabledStatus() { setEnabled(((TabbedWorkspace) getWorkspace()).getSelectedTab() instanceof Resettable); }
public List<WorkspaceTabPlugin> getOrderedPlugins() { WorkspaceTabPluginLoader loader = new WorkspaceTabPluginLoader(this); List<WorkspaceTabPlugin> plugins = new ArrayList<WorkspaceTabPlugin>(loader.getPlugins()); CustomWorkspaceTabsManager customTabsManager = getCustomTabsManager(); plugins.addAll(customTabsManager.getCustomTabPlugins(this)); Collections.sort(plugins, new Comparator<WorkspaceTabPlugin>() { public int compare(WorkspaceTabPlugin o1, WorkspaceTabPlugin o2) { return o1.getIndex().compareTo(o2.getIndex()); } }); return plugins; }
public void initialise() { // Here we either need to load the default tabs, or // restore a set of tabs final List<String> visibleTabs = new TabbedWorkspaceStateManager().getTabs(); // If no tabs are set as visible (i.e. we have yet to customise) show all by default for (WorkspaceTabPlugin plugin : getOrderedPlugins()) { if(visibleTabs.isEmpty()) { if(plugin.isProtegeDefaultTab()) { addTabForPlugin(plugin); } } else if (visibleTabs.contains(plugin.getId())) { addTabForPlugin(plugin); } } }
public void dispose() { // Save our workspace! super.dispose(); owlComponentFactory.dispose(); getOWLModelManager().removeListener(owlModelManagerListener); getOWLModelManager().removeOntologyChangeListener(listener); }
public void rebuildChildMenuItems(JMenu thisMenuItem) { if (!(getWorkspace() instanceof TabbedWorkspace)) { // Don't bother to show a tabs menu for non // tabbed workspaces. return; } thisMenuItem.removeAll(); for (final WorkspaceTabPlugin plugin : ((TabbedWorkspace) getWorkspace()).getOrderedPlugins()) { addMenuItem(thisMenuItem, plugin); } }
/** * Convenience method to add a workspace tab. This method initialises the tab. */ public void addTab(final WorkspaceTab workspaceTab) { tabbedPane.addTab(workspaceTab.getLabel(), workspaceTab.getIcon(), workspaceTab); workspaceTabs.add(workspaceTab); try { workspaceTab.initialise(); } catch (Exception e) { tabbedPane.remove(workspaceTab); tabbedPane.addTab(workspaceTab.getLabel(), workspaceTab.getIcon(), createErrorPanel(e)); } }
public WorkspaceTab addTabForPlugin(WorkspaceTabPlugin plugin) { WorkspaceTab tab = null; try { tab = plugin.newInstance(); addTab(tab); } catch (Throwable e) { if (tab != null) { String msg = "An error occurred when creating the " + plugin.getLabel() + " tab."; tab.setLayout(new BorderLayout()); tab.add(ComponentFactory.createExceptionComponent(msg, e, null)); } LOGGER.warn(e); } return tab; }
private void addMenuItem(JMenu thisMenuItem, final WorkspaceTabPlugin plugin) { final TabbedWorkspace workspace = (TabbedWorkspace) getWorkspace(); JCheckBoxMenuItem item = new JCheckBoxMenuItem(new AbstractAction(plugin.getLabel()) { private static final long serialVersionUID = 2331248705801798457L; public void actionPerformed(ActionEvent e) { try { if (!workspace.containsTab(plugin.getId())) { WorkspaceTab tab = plugin.newInstance(); workspace.addTab(tab); } else { WorkspaceTab tab = workspace.getWorkspaceTab(plugin.getId()); workspace.removeTab(tab); tab.dispose(); } } catch (Exception ex) { logger.error("An error occurred whilst adding a menu item. Details: {}", ex); } } }); item.setSelected(workspace.containsTab(plugin.getId())); thisMenuItem.add(item); }
public void actionPerformed(ActionEvent event) { TabbedWorkspace workspace = (TabbedWorkspace) getWorkspace(); LoadedTabsSelector selector = new LoadedTabsSelector(workspace); int ret = JOptionPaneEx.showConfirmDialog(workspace, "Delete Tabs", selector, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, selector); if (ret == JOptionPane.OK_OPTION){ for (WorkspaceTabPlugin tabPlugin : selector.getSelectedTabs()){ final String id = tabPlugin.getId(); if (workspace.containsTab(id)) { // make sure we remove it from the workspace if it is currently active WorkspaceTab tab = workspace.getWorkspaceTab(id); workspace.removeTab(tab); try { tab.dispose(); } catch (Exception e) { throw new RuntimeException(e); } } workspace.getCustomTabsManager().deleteCustomTab(id); } } }
public static WorkspaceTab handleCreateNewTab(TabbedWorkspace workspace) { final String name = JOptionPane.showInputDialog(workspace, "Please enter a name for the new tab"); if (name != null) { CustomWorkspaceTabsManager customTabsManager = workspace.getCustomTabsManager(); WorkspaceTab tab = workspace.addTabForPlugin(customTabsManager.getPluginForTabName(name, workspace)); workspace.setSelectedTab(tab); return tab; } return null; } }
/** * Override of the <code>Workspace</code> initialise method. */ public void initialise() { JPanel tabHolder = new JPanel(new BorderLayout()); workspaceTabs = new HashSet<WorkspaceTab>(); // Create the tabs. tabbedPane = new JTabbedPane(); tabHolder.add(tabbedPane); setContent(tabbedPane); // Here we either need to load the default tabs, or // restore a set of tabs final List<String> visibleTabs = new TabbedWorkspaceStateManager().getTabs(); // If no tabs are set as visible (ie we have yet to customise, show all by default for (WorkspaceTabPlugin plugin : getOrderedPlugins()) { if (visibleTabs.isEmpty() || visibleTabs.contains(plugin.getId())) { addTabForPlugin(plugin); } } }
private void updateEnabledStatus() { setEnabled(((TabbedWorkspace) getWorkspace()).getSelectedTab() instanceof Resettable); }
public List<WorkspaceTabPlugin> getOrderedPlugins() { WorkspaceTabPluginLoader loader = new WorkspaceTabPluginLoader(this); List<WorkspaceTabPlugin> plugins = new ArrayList<WorkspaceTabPlugin>(loader.getPlugins()); CustomWorkspaceTabsManager customTabsManager = getCustomTabsManager(); plugins.addAll(customTabsManager.getCustomTabPlugins(this)); Collections.sort(plugins, new Comparator<WorkspaceTabPlugin>() { public int compare(WorkspaceTabPlugin o1, WorkspaceTabPlugin o2) { return o1.getIndex().compareTo(o2.getIndex()); } }); return plugins; }
public void dispose() { // Save our workspace! super.dispose(); owlComponentFactory.dispose(); getOWLModelManager().removeListener(owlModelManagerListener); getOWLModelManager().removeOntologyChangeListener(listener); }