Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Updating contents of FigureCanvas
Updating contents of FigureCanvas [message #176093] Thu, 07 April 2005 21:51 Go to next message
Eclipse UserFriend
Originally posted by: angelaheenan.eircom.net

Hey everyone,

I'm hoping ye can help me out. I'm not too sure if this is a draw2d issue.

I have the following set up.

1. I have created a new view which has a resource changed listener added
to it.
2. I read in the contents of a file and create a new figure called
dataFigure.
2. In the view's createPartControl(Composite parent) I have created a new
FigureCanvas using parent and a new LightweightSystem.
FigureCanvas figureCanvas = new FigureCanvas(parent, lws);
3. Next I do the following figureCanvas.setContents(dataFigure);

Now this is where I problems begin.

When the contents of the file that is read in is changed I am doing the
following.
1. read in new file and create new dataFigure
2. set the contents of the figureCanvas to the new dataFigure.

I am doing the above but the contents of the figureCanvas are not being
updated. Can anyone see where I am going wrong?? Do I need to call the
lws's
updateManager?

Any pointers would be great as I am really stuck on this. Pointers to
examples
of code in Eclipse would also be appreciated.

Thanks for reading the above.
A.
Re: Updating contents of FigureCanvas [message #176108 is a reply to message #176093] Fri, 08 April 2005 01:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: angelaheenan.eircom.net

Well, I half sorted out the problem

It will now add new items to the view. My
problem lay in the order in which I was calling
things. I'm doubting this is the best way to do
things but it's working...

1. hide view
2. set new contents.
3. show view

The problem now is that I cannot appear to clear
the current contents of the figure. If I clear the
contents using dataFigure.getChildren().clear() it
will not allow me to add new items to the dataFigure.
I'm a bit baffled. I thought then that maybe clear
caused the dataFigure to be null but that isn't the
case.

The error I am getting is

java.lang.IllegalArgumentException: IWAG0003E Figure is not a child of
this parent

Thanks,
A.
Re: Updating contents of FigureCanvas [message #176251 is a reply to message #176108] Fri, 08 April 2005 17:55 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Angi" <angelaheenan@eircom.net> wrote in message
news:04fd316415c155ab7b9da992384f6dd4$1@www.eclipse.org...
> Well, I half sorted out the problem
>
> It will now add new items to the view. My
> problem lay in the order in which I was calling
> things. I'm doubting this is the best way to do
> things but it's working...
>
> 1. hide view
> 2. set new contents.
> 3. show view

What is the view? The workbench view?

>
> The problem now is that I cannot appear to clear
> the current contents of the figure. If I clear the
> contents using dataFigure.getChildren().clear() it

Look at getChildren()'s javadoc. You're not supposed to modify that list.
Call dataFigure.removeAll().

> will not allow me to add new items to the dataFigure.
> I'm a bit baffled. I thought then that maybe clear
> caused the dataFigure to be null but that isn't the
> case.
>
> The error I am getting is
>
> java.lang.IllegalArgumentException: IWAG0003E Figure is not a child of
> this parent
>
> Thanks,
> A.
>
Re: Updating contents of FigureCanvas [message #176277 is a reply to message #176251] Fri, 08 April 2005 20:14 Go to previous message
Eclipse UserFriend
Originally posted by: angelaheenan.eircom.net

Pratik Shah wrote:
> What is the view? The workbench view?

Yes, the view is a workbench view. My view extends ViewPart.

> Look at getChildren()'s javadoc. You're not supposed to modify that list.
> Call dataFigure.removeAll().

Thanks a million for this. I managed to miss the method removeAll
completely.

A.
Previous Topic:Property sheet problems with MPE
Next Topic:Limit number of Lines in TextFlow
Goto Forum:
  


Current Time: Tue Apr 16 11:57:44 GMT 2024

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

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

Back to the top