Draw2d in ViewPart [message #90124] |
Fri, 08 August 2003 13:43  |
Eclipse User |
|
|
|
Originally posted by: rpenner.cs.usask.ca
Hello, I am new to GEF and Draw2d and would like to try and implement a
simple Draw2d graph in a ViewPart which is part of a plugin. I am starting
out with the last example included in the Draw2d dodumentation
(Connections and Anchors Demo). However, I am having problems.
As soon as I add any Draw2d code to my ViewPart the view won't initialize
(an error occured when creating this view). If I take out the Draw2d code
the view works properly. I am including the createPartControl code from my
view part for reference.
public void createPartControl(Composite parent) {
// paint canvas
workbenchDisplay = parent.getDisplay();
myCanvas = new Canvas(parent, SWT.NONE);
myCanvas.addPaintListener(new PaintListener () {
public void paintControl(PaintEvent event){
gc = event.gc;
System.out.println("a paint event has occured");
}
});
// RectangleFigure node1 = new RectangleFigure();
// RectangleFigure node2 = new RectangleFigure();
// node1.setBackgroundColor(ColorConstants.red);
// node2.setBackgroundColor(ColorConstants.blue);
// node2.setLocation(new Point(100,100));
// PolylineConnection conn = new PolylineConnection();
// conn.setSourceAnchor(new ChopboxAnchor(node1));
// conn.setTargetAnchor(new ChopboxAnchor(node2));
// conn.setTargetDecoration(new PolygonDecoration());
// Label label = new Label("Midpoint");
// label.setOpaque(true);
// label.setBackgroundColor(ColorConstants.buttonLightest);
// label.setBorder(new LineBorder());
// conn.add(label, new MidpointLocator(conn, 0));
}
The above code works properly. However, as soon as I un comment any of the
Draw2s code it fails. Any help with this would be greatly appreciated.
thanks for your time ........... Reagan
|
|
|
|
|
|
|
Re: Draw2d in ViewPart [message #90195 is a reply to message #90167] |
Fri, 08 August 2003 16:17   |
Eclipse User |
|
|
|
Originally posted by: none.s1.com
Hi Reagan,
The CVSROOT is :pserver:anonymous@dev.eclipse.org:/home/tools. i,e.
host = dev.eclipse.org
path = /home/tools
Raghu.
"Reagan Penenr" <rpenner@cs.usask.ca> wrote in message
news:bh0u7i$9od$1@eclipse.org...
> Hey Randy, thanks for the reply. Quick question though. I am trying to
> check this flow example out via Eclipse and am having trouble finding the
> right Host and Path. I can get all of the Eclipse stuff via Host =
> dev.eclipse.org and Path = /home/eclipse. Any idea what my Host and Path
> (s) are for the gef examples?
>
> thanks ......... Reagan
>
> Randy Hudson wrote:
>
> > Maybe you have classpath problems?
>
> > A new example project "org.eclipse.gef.examples.flow" was just released
to
> > CVS.
> > You could load it via anonymous connection to CVS server.
>
> > "Reagan Penenr" <rpenner@cs.usask.ca> wrote in message
> > news:bh0ngg$2d0$1@eclipse.org...
> > > Hello, I am new to GEF and Draw2d and would like to try and implement
a
> > > simple Draw2d graph in a ViewPart which is part of a plugin. I am
starting
> > > out with the last example included in the Draw2d dodumentation
> > > (Connections and Anchors Demo). However, I am having problems.
> > >
> > > As soon as I add any Draw2d code to my ViewPart the view won't
initialize
> > > (an error occured when creating this view). If I take out the Draw2d
code
> > > the view works properly. I am including the createPartControl code
from my
> > > view part for reference.
> > >
> > > public void createPartControl(Composite parent) {
> > > // paint canvas
> > > workbenchDisplay = parent.getDisplay();
> > > myCanvas = new Canvas(parent, SWT.NONE);
> > >
> > > myCanvas.addPaintListener(new PaintListener () {
> > > public void paintControl(PaintEvent event){
> > > gc = event.gc;
> > > System.out.println("a paint event has occured");
> > > }
> > > });
> > >
> > > // RectangleFigure node1 = new RectangleFigure();
> > > // RectangleFigure node2 = new RectangleFigure();
> > > // node1.setBackgroundColor(ColorConstants.red);
> > > // node2.setBackgroundColor(ColorConstants.blue);
> > > // node2.setLocation(new Point(100,100));
> > >
> > > // PolylineConnection conn = new PolylineConnection();
> > > // conn.setSourceAnchor(new ChopboxAnchor(node1));
> > > // conn.setTargetAnchor(new ChopboxAnchor(node2));
> > > // conn.setTargetDecoration(new PolygonDecoration());
> > >
> > > // Label label = new Label("Midpoint");
> > > // label.setOpaque(true);
> > > // label.setBackgroundColor(ColorConstants.buttonLightest);
> > > // label.setBorder(new LineBorder());
> > > // conn.add(label, new MidpointLocator(conn, 0));
> > >
> > > }
> > >
> > > The above code works properly. However, as soon as I un comment any of
the
> > > Draw2s code it fails. Any help with this would be greatly appreciated.
> > >
> > > thanks for your time ........... Reagan
> > >
>
>
|
|
|
Re: Draw2d in ViewPart [message #90210 is a reply to message #90182] |
Fri, 08 August 2003 23:25  |
Eclipse User |
|
|
|
Sorry, I was supposed to fix that and release it today but I didn't get around
to it. I just released it with just a LineBorder.
Eric
Gunnar Wagenknecht wrote:
> Randy Hudson wrote:
>
>>"Randy Hudson" <none@us.ibm.com> wrote in message
>
>
>>>A new example project "org.eclipse.gef.examples.flow" was just
>>>released to CVS.
>
>
> Thanks Randy,
>
> But actually it doesn't work because PaintedMarginBorder is missing.
>
> Thanks,
> Gunnar
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.09697 seconds