Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » refresh all editpart
refresh all editpart [message #179273] Tue, 26 April 2005 12:47 Go to next message
Eclipse UserFriend
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 #179398 is a reply to message #179273] Tue, 26 April 2005 22:38 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
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
Re: refresh all editpart [message #179530 is a reply to message #179398] Thu, 28 April 2005 08:08 Go to previous message
Eclipse UserFriend
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
Previous Topic:canExecute and feedback by MessageBox
Next Topic:How to prevent DirectEdit when the mouse give the focus to the EditorPart?
Goto Forum:
  


Current Time: Sun Feb 05 15:38:02 GMT 2023

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

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

Back to the top