Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Draw2d in ViewPart
Draw2d in ViewPart [message #90124] Fri, 08 August 2003 17:43 Go to next message
Eclipse UserFriend
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 #90139 is a reply to message #90124] Fri, 08 August 2003 17:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

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 #90153 is a reply to message #90139] Fri, 08 August 2003 18:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Randy Hudson" <none@us.ibm.com> wrote in message
news:bh0o1a$306$1@eclipse.org...
> 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.

:-)
And, the point of mentioning that was that there is a new view called Plugin
Dependencies, which uses Draw2d inside a Viewpart
Re: Draw2d in ViewPart [message #90167 is a reply to message #90139] Fri, 08 August 2003 19:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rpenner.cs.usask.ca

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 #90182 is a reply to message #90153] Fri, 08 August 2003 19:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.planet-wagenknecht.de

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
Re: Draw2d in ViewPart [message #90195 is a reply to message #90167] Fri, 08 August 2003 20:17 Go to previous messageGo to next message
Eclipse UserFriend
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] Sat, 09 August 2003 03:25 Go to previous message
Eric Bordeau is currently offline Eric BordeauFriend
Messages: 259
Registered: July 2009
Senior Member
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
>
>
Previous Topic:draw2D as WYSIWYG editor
Next Topic:Copy and Paste
Goto Forum:
  


Current Time: Tue Jul 16 10:01:25 GMT 2024

Powered by FUDForum. Page generated in 0.03698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top