Skip to main content



      Home
Home » Eclipse Projects » GEF » [draw2d] EventDispatcher/Paint Problem
[draw2d] EventDispatcher/Paint Problem [message #86158] Tue, 01 July 2003 11:31 Go to next message
Eclipse UserFriend
Originally posted by: ulimei.gmx.de

Hi!

I'm trying to integrate the draw2d Tree Example into an Eclipse editor.
I'm using Eclipse 2.0.2 and draw2d 2.1 . My Code in the Editor calling the
Tree stuff:

public void createPartControl(Composite parent) {
TreeExample tr = new TreeExample();
tr.run(parent);
}

And my Version of TreeExample.run():

public void run(Composite parent){
parent.setLayout(new GridLayout(2, false));
setFigureCanvas(new FigureCanvas(parent));
getFigureCanvas().setContents(contents = getContents());
getFigureCanvas().setLayoutData(new GridData(GridData.FILL_BOTH));
hookShell(parent);
LightweightSystem lws = new LightweightSystem(getFigureCanvas());
getFigureCanvas().setBackground(ColorConstants.blue);
SWTEventDispatcher dis = new SWTEventDispatcher();
lws.setEventDispatcher(dis);
}

As in the standalone example I have all the parts of the TreeExample in my
Editor window. But where the Tree should be I just see a blue Rectangle
(respective a white one in origin). If click somewhere in the Rectangle an
hit the Tree (and/or parts of it) it shows up, also when I click on the
Controls like "Horizontal Orientation". When I minimize my Workbench
window the tree again is gone. My assumption is the the tree doesn't get
any kind of Event to paint itself from the Workbench. I tried to use the
SWTEventDispatcher but as
I'm not very familiar with Eventhandling I have no idea how to go on.

Thanks for any help you can provide me!

Uli
Re: [draw2d] EventDispatcher/Paint Problem [message #86189 is a reply to message #86158] Tue, 01 July 2003 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Step 1) Use a supported version of Eclipse. draw2d 2.1.0 is only supported
on Eclipse 2.1.x.

Step 2) The class FigureCanvas creates its own LightweightSystem and event
dispatcher. You are creating a second one. Don't do this! You're adding
multiple paint listeners to the canvas, which may be causing problems.

"Uli" <ulimei@gmx.de> wrote in message news:bds9fn$cmb$1@rogue.oti.com...
> Hi!
>
> I'm trying to integrate the draw2d Tree Example into an Eclipse editor.
> I'm using Eclipse 2.0.2 and draw2d 2.1 . My Code in the Editor calling the
> Tree stuff:
>
> public void createPartControl(Composite parent) {
> TreeExample tr = new TreeExample();
> tr.run(parent);
> }
>
> And my Version of TreeExample.run():
>
> public void run(Composite parent){
> parent.setLayout(new GridLayout(2, false));
> setFigureCanvas(new FigureCanvas(parent));
> getFigureCanvas().setContents(contents = getContents());
> getFigureCanvas().setLayoutData(new GridData(GridData.FILL_BOTH));
> hookShell(parent);
> LightweightSystem lws = new LightweightSystem(getFigureCanvas());
> getFigureCanvas().setBackground(ColorConstants.blue);
> SWTEventDispatcher dis = new SWTEventDispatcher();
> lws.setEventDispatcher(dis);
> }
>
> As in the standalone example I have all the parts of the TreeExample in my
> Editor window. But where the Tree should be I just see a blue Rectangle
> (respective a white one in origin). If click somewhere in the Rectangle an
> hit the Tree (and/or parts of it) it shows up, also when I click on the
> Controls like "Horizontal Orientation". When I minimize my Workbench
> window the tree again is gone. My assumption is the the tree doesn't get
> any kind of Event to paint itself from the Workbench. I tried to use the
> SWTEventDispatcher but as
> I'm not very familiar with Eventhandling I have no idea how to go on.
>
> Thanks for any help you can provide me!
>
> Uli
>
Re: [draw2d] EventDispatcher/Paint Problem [message #86305 is a reply to message #86189] Wed, 02 July 2003 04:23 Go to previous message
Eclipse UserFriend
Originally posted by: ulimei.gmx.de

Thanks for your help, I didn't know that. Now I have it up and running!

Uli

Randy Hudson wrote:

> Step 1) Use a supported version of Eclipse. draw2d 2.1.0 is only supported
> on Eclipse 2.1.x.

> Step 2) The class FigureCanvas creates its own LightweightSystem and event
> dispatcher. You are creating a second one. Don't do this! You're adding
> multiple paint listeners to the canvas, which may be causing problems.

> "Uli" <ulimei@gmx.de> wrote in message news:bds9fn$cmb$1@rogue.oti.com...
> > Hi!
> >
> > I'm trying to integrate the draw2d Tree Example into an Eclipse editor.
> > I'm using Eclipse 2.0.2 and draw2d 2.1 . My Code in the Editor calling the
> > Tree stuff:
> >
> > public void createPartControl(Composite parent) {
> > TreeExample tr = new TreeExample();
> > tr.run(parent);
> > }
> >
> > And my Version of TreeExample.run():
> >
> > public void run(Composite parent){
> > parent.setLayout(new GridLayout(2, false));
> > setFigureCanvas(new FigureCanvas(parent));
> > getFigureCanvas().setContents(contents = getContents());
> > getFigureCanvas().setLayoutData(new GridData(GridData.FILL_BOTH));
> > hookShell(parent);
> > LightweightSystem lws = new LightweightSystem(getFigureCanvas());
> > getFigureCanvas().setBackground(ColorConstants.blue);
> > SWTEventDispatcher dis = new SWTEventDispatcher();
> > lws.setEventDispatcher(dis);
> > }
> >
> > As in the standalone example I have all the parts of the TreeExample in my
> > Editor window. But where the Tree should be I just see a blue Rectangle
> > (respective a white one in origin). If click somewhere in the Rectangle an
> > hit the Tree (and/or parts of it) it shows up, also when I click on the
> > Controls like "Horizontal Orientation". When I minimize my Workbench
> > window the tree again is gone. My assumption is the the tree doesn't get
> > any kind of Event to paint itself from the Workbench. I tried to use the
> > SWTEventDispatcher but as
> > I'm not very familiar with Eventhandling I have no idea how to go on.
> >
> > Thanks for any help you can provide me!
> >
> > Uli
> >
Previous Topic:Property change does not make the editor dirty
Next Topic:Transparancy of EditPart for some requests
Goto Forum:
  


Current Time: Thu Jul 17 22:01:33 EDT 2025

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

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

Back to the top