/** * Register NCBIClientPlugin to the Web Service Client Manager. */ public NCBIClientPlugin() throws Exception { // Register this client to the manager. WebServiceClientManager.registerClient(NCBIClient.getClient()); Cytoscape.getDesktop().getCyMenus().getMenuBar().getMenu("File.Import") .add( new JMenuItem(new AbstractAction( "Import Attributes from NCBI Entrez Gene...") { private static final long serialVersionUID = 3263699405477145319L; public void actionPerformed(ActionEvent e) { if (annotationDialog == null) annotationDialog = new NCBIGeneDialog(); annotationDialog.setVisible(true); } })); } }
/** * Creates a new BiomartClientPlugin object. * * @throws Exception */ public BiomartClientPlugin() throws Exception { // Register this client to the manager. WebServiceClientManager.registerClient(BiomartClient.getClient()); final JMenu menu = Cytoscape.getDesktop().getCyMenus().getMenuBar() .getMenu("File.Import"); if (menu != null) { menu.add(new AbstractAction("Import attributes from Biomart...") { private static final long serialVersionUID = -1303677510967797368L; public void actionPerformed(ActionEvent e) { BiomartMainDialog.showUI(); } }); } else { throw new IllegalStateException( "Could not register BioMart Client to Cytoscape menu."); } } }
/** * Takes a CytoscapeAction and will add it to the MenuBar or the Toolbar as * is appropriate. */ public void addCytoscapeAction(CytoscapeAction action) { if (action.isInMenuBar()) { getMenuBar().addAction(action); } if (action.isInToolBar()) { getToolBar().addAction(action); } }
/** * Add the menu item in a specific position * * @param action * @param index */ public void addCytoscapeAction(CytoscapeAction action, int index) { if (action.isInMenuBar()) { getMenuBar().addAction(action, index); } if (action.isInToolBar()) { getToolBar().addAction(action); } }
setJMenuBar(cyMenus.getMenuBar());