[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
running Swing inside Eclipse
It is possible to run Swing inside Eclipse on Windows, although this is
not officially supported. It does work reasonably well, and if you
restrict yourself to graphics (ie, no widgets) it's not visually
distinguishable.
I used this mechanism to get Shrimp (an information visualization tool)
to work inside of Eclipse, which is discussed in my CASCON 2001 paper
"Integrating SHriMP with the IBM WebSphere Studio Workbench" and the
journal version of it "Visualizing flow diagrams in WebSphere Studio
using SHriMP Views". You probably don't want to read those papers
because they're mostly about flow diagrams, but here's what you want to
know:
- it doesn't work on JDK 1.4 due to some change made by Sun
- the API is undocumented and based on undocumented Sun API
- there may be deadlock problems (but I haven't had any)
- Windows only
Basically, it's one method:
Panel org.eclipse.swt.internal.awt.win32.SWT_AWT.new_Panel(Composite)
The new_Panel method has one parameter, an SWT Composite object, and
it returns an AWT Panel object. The awt Panel is contained within the
swt Composite, and is constructed using a WEmbeddedFrame from Sun's
internal package sun.awt.windows. Sun has changed this internal code
in jdk 1.4, and so this undocumented Eclipse mechanism does not work
with that version.
The other thing that you want to know is that Swing/AWT has a separate
event queue from SWT. This can lead to some complication if your
Swing/AWT stuff is fancy. Shrimp does some programmatic manipulation
of the display when it starts, and one has to ensure that this happens
after SWT has initialized the display. The solution to this
particular problem is to put an event on the tail of one queue that
puts an event on the tail of the other queue, which generates an event
that actually does something. That way everything gets initialized
first. The details of how we did this are in our papers.
On 23 May 2003, Manu Sridharan wrote:
> A possible start for creating the clickable dot graph in Eclipse is
> Grappa, also from the AT&T Graphviz project:
>
> http://www.research.att.com/~john/Grappa/
>
> It renders a graph laid out by dot in a Swing widget using Java2D, with
> context menus on nodes and everything; it's really nice. One would have
> to get rid of the Swing, but it looks like there may be support for
> Java2D in Eclipse:
>
> http://www.holongate.org/j2d/index.html
>
> Might not be too much work to get this all going...too bad I won't have
> time to do it for a while.
>
> -Manu
>
> On Fri, 2003-05-23 at 10:23, Ondrej LHOTAK wrote:
> > In Soot 2.0, we're adding LinkTags. These can be attached to any
> > statement, and are links to some other statement, possibly in another
> > class. In Eclipse, you can click on them to go to the target statement.
> > Our first use of the tags will be for call graph information, so that
> > will give similar functionality to what you have in Janalyzer.
> >
> > I had a look at Janalyzer, and one thing that I really liked was the
> > star-shaped graphical call graph browser (I don't know how best to
> > describe it, but hopefully you know what I mean). I think something like
> > this would be nice in Eclipse, and we don't currently have anything
> > like this. So, if you're planning to integrate something like that into
> > Eclipse, I think it would be very useful.
> >
> > One of the other things that we've talked about is getting a control
> > flow graph representation into Eclipse. Soot has some code to dump out
> > a CFG as input to the "dot" graph drawing tool, which then draws the
> > graph. We generally use dot to produce postscript, but it seems Eclipse
> > doesn't support that; however, dot has various other output formats
> > that might be more suitable. If someone were to implement support for
> > displaying (possible clickable) arbitrary dot graphs in Eclipse, I think
> > that would be very useful. It could be used for a variety of things,
> > including both call graphs and control flow graphs.
> >
> > Ondrej
> >
> > On Thu, May 22, 2003 at 03:30:32PM +0100, Eric Bodden wrote:
> > > Hi!
> > >
> > > Just wanted to tell you that we have released our static analysis tool
> > > Janalyzer, which we developed using SOOT as a university project. The
> > > program is still being developed further at Sourceforge but however we
> > > have released a first stable version.
> > > Suggestions are always welcome as well as volunteers to help with
> > > further coding. We also thought about integrating that into an IDE like
> > > Eclipse. Now I got to know that SOOT already is being integrated there.
> > > What do you think - would it be worthwhile adding graph display like we
> > > provide it in our tool?
> > >
> > > Cheers,
> > > Eric
> > >
> > > ------------------------------------------------------------
> > > Eric Bodden
> > > CS-DIP full time student @ University of Kent at Canterbury
> > > UKC internal phone: 5095
> > > ICQ UIN: 12656220
> > > Website: http://www.bodden.de
> > > PGP key: http://www.bodden.de/pub_key.asc
> > >
>