Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Custom Figures and Synchronizing the model
Custom Figures and Synchronizing the model [message #21590] Wed, 16 August 2006 15:28 Go to next message
Eclipse UserFriend
Hi,

I have been using GMF and creating custom figures, the custom figures
are made up of images and several label which might or might not be
shown based on some logic that needs to be applied to the model.

I am now trying to work out the cleanest way to add the
synchronization of the model with the figure, I suppose the EditPart
should contain the logic but what is the preferred way to override the
default EditPart?

Cheers

P
Re: Custom Figures and Synchronizing the model [message #21862 is a reply to message #21590] Thu, 17 August 2006 02:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

Hello!

You could override refreshVisuals() in generated edit parts to update
figure on model changes.

See also
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gef.doc.isv/guide/guide.html

Philip Dodds wrote:
> Hi,
>
> I have been using GMF and creating custom figures, the custom figures
> are made up of images and several label which might or might not be
> shown based on some logic that needs to be applied to the model.
>
> I am now trying to work out the cleanest way to add the
> synchronization of the model with the figure, I suppose the EditPart
> should contain the logic but what is the preferred way to override the
> default EditPart?
>
> Cheers
>
> P
>
Re: Custom Figures and Synchronizing the model [message #22724 is a reply to message #21862] Thu, 17 August 2006 15:36 Go to previous messageGo to next message
Eclipse UserFriend
I have tried this appraoch - however refreshVisuals does seem to get
called when the underlying EMF model changes (such as through editing on
the properties view).

Cheers

P
Re: Custom Figures and Synchronizing the model [message #22946 is a reply to message #22724] Fri, 18 August 2006 05:45 Go to previous message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

Hello!

Add the following code in ShipEditPart of TaiPan sample. When you
rename a ship to "Avrora" it becomes red.


protected void refreshVisuals() {
super.refreshVisuals();
Ship ship = (Ship) resolveSemanticElement();
if ("Avrora".equals(ship.getName())) { //$NON-NLS-1$
getPrimaryShape().setBackgroundColor(ColorConstants.red);
} else {
getPrimaryShape().setBackgroundColor(null);
}
}

protected void handleNotificationEvent(Notification notification) {
super.handleNotificationEvent(notification);
if
(TaiPanPackage.eINSTANCE.getShip_Name().equals(notification. getFeature())) {
refreshVisuals();
}
}


Philip Dodds wrote:
> I have tried this appraoch - however refreshVisuals does seem to get
> called when the underlying EMF model changes (such as through editing on
> the properties view).
>
> Cheers
>
> P
>
Previous Topic:EditorŽs Items
Next Topic:How to edit a element by double-clicking the shape in the diagram editor
Goto Forum:
  


Current Time: Mon Jul 14 23:48:59 EDT 2025

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

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

Back to the top