public void setup(WorkspaceTabPlugin plugin) { this.id = plugin.getId(); this.label = plugin.getLabel(); this.icon = plugin.getIcon(); this.workspace = plugin.getWorkspace(); this.defaultViewConfigurationFile = plugin.getDefaultViewConfigFile(); }
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.error("An error occurred when attempting to instantiate a tab plugin. " + "Tab plugin Id: {}. Error details: {}", plugin.getId(), e); } return tab; }
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); } } });
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("Exception caught (re)building tab menu", ex); } } }); item.setSelected(workspace.containsTab(plugin.getId())); thisMenuItem.add(item); }
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; }
/** * 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 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 Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b1, int i, int i1) { if (o instanceof WorkspaceTabPlugin){ o = ((WorkspaceTabPlugin)o).getLabel(); } return super.getTableCellRendererComponent(jTable, o, b, b1, i, i1); } });
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); } } });
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 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; }
/** * 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 Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b1, int i, int i1) { if (o instanceof WorkspaceTabPlugin){ o = ((WorkspaceTabPlugin)o).getLabel(); } return super.getTableCellRendererComponent(jTable, o, b, b1, i, i1); } });
public void setup(WorkspaceTabPlugin plugin) { this.id = plugin.getId(); this.label = plugin.getLabel(); this.icon = plugin.getIcon(); this.workspace = plugin.getWorkspace(); this.defaultViewConfigurationFile = plugin.getDefaultViewConfigFile(); }
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); } } });
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("Exception caught (re)building tab menu", 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 Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b1, int i, int i1) { if (o instanceof WorkspaceTabPlugin){ o = ((WorkspaceTabPlugin)o).getLabel(); } return super.getTableCellRendererComponent(jTable, o, b, b1, i, i1); } });