Updating contents of FigureCanvas [message #176093] |
Thu, 07 April 2005 21:51 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #176277 is a reply to message #176251] |
Fri, 08 April 2005 20:14 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03894 seconds