cytoscapeDesktop in 3.0

108 views
Skip to first unread message

giovanni scardoni

unread,
Oct 30, 2012, 12:16:37 PM10/30/12
to cytoscape...@googlegroups.com
Hi all,
I am moving my plugins to 3.0.
How can I get access to the Cytoscape Desktop?
The code for Cytoscape 2.8 was

CytoscapeDesktop desktop = Cytoscape.getDesktop();
CytoPanel cytoPanel = desktop.getCytoPanel(SwingConstants.WEST);


What is the equivalent code for Cytoscape 3?
Thank you,
Giovanni

--
Giovanni Scardoni
The Center for BioMedical Computing (CBMC)
www.cbmc.it
University of Verona
Strada le Grazie, 15 -37134
Verona -Italy

Keiichiro Ono

unread,
Oct 30, 2012, 1:13:08 PM10/30/12
to cytoscape...@googlegroups.com
Hi Giovanni.

You need to inject CySwingAplication via constructor:

private final CySwingApplication app;

Then, you can access the actual JFrame object by:

JFrame desktop = app.getJFrame();


Kei


2012/10/30 giovanni scardoni <giovanni...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
> To post to this group, send email to cytoscape...@googlegroups.com.
> To unsubscribe from this group, send email to cytoscape-helpd...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cytoscape-helpdesk?hl=en.
>



--
Keiichiro Ono http://www.keiono.net/

Julianne Grose

unread,
Oct 30, 2012, 1:17:36 PM10/30/12
to cytoscape...@googlegroups.com
Thank you!

Julianne H. Grose, Ph.D.
Assistant Professor of Microbiology and Molecular Biology
751 WIDB
Brigham Young University
Juliann...@byu.edu
(801) 422-4940
________________________________________
From: cytoscape...@googlegroups.com [cytoscape...@googlegroups.com] on behalf of Keiichiro Ono [kei...@gmail.com]
Sent: Tuesday, October 30, 2012 11:13 AM
To: cytoscape...@googlegroups.com
Subject: Re: [cytoscape-helpdesk] cytoscapeDesktop in 3.0

giovanni scardoni

unread,
Oct 31, 2012, 1:18:02 PM10/31/12
to cytoscape...@googlegroups.com
Hi Kei,
thank you for your help.
I obtained this error:
"variable app may not have been initialized"
CySwingAplication is an interface. Do I have to create a class that
implements this interface?
Thank you,
Giovanni

2012/10/30 Keiichiro Ono <kei...@gmail.com>:

Peng-Liang Wang

unread,
Oct 31, 2012, 5:50:31 PM10/31/12
to cytoscape...@googlegroups.com
You should get the reference of CySwingApplication from OSGi service
in your CyActivator class and then pass the reference to your class.

Look at an example here.
http://chianti.ucsd.edu/svn/core3/samples/trunk/sample04/

Peng

giovanni scardoni

unread,
Nov 7, 2012, 11:58:06 AM11/7/12
to cytoscape...@googlegroups.com
Thank you!
I tried the example and I have a Null pointer exception at:

JOptionPane.showMessageDialog(this.desktopApp.getJFrame(), "My sub
menuitem is clicked", "My message",
JOptionPane.INFORMATION_MESSAGE);

Anyway, What I need is to access to the Cytopanel WEST.
I had access to it but I have to add my startmenu to the Cytopanel and
the old method Cytopanel.add is not available. How to add a menu to
the Cytopanel?

thank you!


2012/10/31 Peng-Liang Wang <plw...@bioeng.ucsd.edu>:

Jason Montojo

unread,
Nov 7, 2012, 12:04:57 PM11/7/12
to cytoscape...@googlegroups.com
Hi Giovanni,

We have sample code here that shows you how to add things to CytoPanels.  You actually don't need to get a CySwingApplication instance:


The code you'd probably be most interested in is here:


Hope this helps,
Jason

giovanni scardoni

unread,
Nov 9, 2012, 12:56:13 PM11/9/12
to cytoscape...@googlegroups.com
Thank you!
I suppose the problem was that I tried a simple plugin instead of a
bundle one. It seems I can't access
to the CytoPanel from a simple application, isn't it?
Now it works!

Just another question:
I am now moving from NetBeans to Eclipse. In Netbeans I could (with
cytoscape 2.8) run
the plugin directly from the IDE, without copying the jar into the
directory and restarting
cytoscape every time.
I simply set some option in NetBeans (the main cytoscape file ) and it
runs cytoscape including the most recent
compiled version of the plugin. This is really useful for programming
and debugging.

How can I do it with Eclipse and Cytoscape 3?
Thank you!
Giovanni

2012/11/7 Jason Montojo <jrr...@gmail.com>:

Tim Hull

unread,
Nov 9, 2012, 1:19:32 PM11/9/12
to cytoscape...@googlegroups.com
You can do two things to help here:

1) Create a symbolic link to the JAR's build location in ~/CytoscapeConfiguration/3/apps/installed/. That way, every time you build a new JAR in Eclipse, Cytoscape will load it. It will try to reload immediately after you build, though with some plugins/major changes you may have to restart Cytoscape.

2) Run Cytoscape in debug mode (use debug as the argument to cytoscape.sh) and connect to the running instance of Cytoscape using Eclipse. To set up debugging in Eclipse, open Run-Debug Configurations and create a new Remote Java Application profile. Specify 12345 as the port number/localhost as the host name, and select the project you want to debug (make sure any Eclipse projects it depends on are added under Source).

Make sure cytoscape.sh is running in debug mode - at which point you can click Debug in Eclipse. You will now be able to set breakpoints/make minor changes to your plugin without redeploying. Note that you do need the JAR installed in Cytoscape before doing this (I recommend creating the symbolic link as in #1 above). You will have to rebuild the JAR (and restart Cytoscape if necessary) if you want to make significant changes to code.

giovanni scardoni

unread,
Nov 16, 2012, 11:52:11 AM11/16/12
to cytoscape...@googlegroups.com
Thank you!
It works!

2012/11/9 Tim Hull <tmh...@eng.ucsd.edu>
Reply all
Reply to author
Forward
0 new messages