refresh all editpart [message #179273] |
Tue, 26 April 2005 12:47 |
Eclipse User |
|
|
|
Originally posted by: timm.rueger.gmx.de
Hi there,
is there a way to refresh all editparts of a graphicalviewer? I have to do
that, because I have to seperate business and diagram models (like in the
ediagram) and the business model can be changed in another editor at the
same time. In order to be able to reflect changes that happened in one
editor I use a ResourceChangeListener, that reloads the business model, if
required. But I still need to refresh the visuals of all visible editparts,
because notification in this case does not work.
I currently use the following code fragment in my GEF diagram editor class
to achieve that:
// is called if the GEF editor is activated
protected void handleActivate() {
....
ScalableFreeformRootEditPart root =
(ScalableFreeformRootEditPart) getGraphicalViewer()
.getRootEditPart();
refresh(root.getChildren());
}
private void refresh(List children){
for (Iterator i = children.iterator(); i.hasNext();) {
EditPart p = (AbstractEditPart) i.next();
p.refresh();
refresh(p.getChildren());
}
}
Is there a better way to do that?
thanx,
timm
|
|
|
|
Re: refresh all editpart [message #179530 is a reply to message #179398] |
Thu, 28 April 2005 08:08 |
Eclipse User |
|
|
|
Originally posted by: timm.rueger.gmx.de
Thanks, Pratik!
"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:d4mg27$2kh$1@news.eclipse.org...
> Yes, that's the way to do it. However, make sure that this is required.
If
> the other editor that is editing the business model worked on the same
> in-memory model as your editor, you wouldn't need to do this. Even if the
> two editors are not working on the same model, depending on your set-up,
it
> might be possible to avoid having to refresh every single editpart.
>
>
> "Timm R
|
|
|
Powered by
FUDForum. Page generated in 0.02087 seconds