Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » many small questions
many small questions [message #212821] Thu, 04 December 2008 16:24 Go to next message
Michael Baranov is currently offline Michael BaranovFriend
Messages: 6
Registered: July 2009
Junior Member
Hi everyone!

Sorry for bugging everyone here with stupidities... I'm implementing a
proof-of-concept editor here, so a lot of conceptual questions ;-) I'd
appreciate help with any of the following questions:


1) How can I add/remove children elements in response to a model
property change of this element?

In particular I want to add/remove ports (children) when "resource"
property changes e.g. user points to another resource which has
different ports.



2) Is there a way to have a property in ecore model that is a reference
to a resource (file) in a project.

I suspect it's EResource, but I get a transformation error: attribute is
not transient and thus should be of serializable type (which is
technically true). I really dare to dream of an automagical
resource-selection-dialog as the property editor etc. ;-)



3) Is there a way to listen to element/figure movement and update
external (feature) label location accordingly?

Label is added inside addBorderItem() of the edit part of the element it
corresponds to using BorderItemLocator.


Thank you!!!

Michael
Re: many small questions [message #212872 is a reply to message #212821] Fri, 05 December 2008 19:31 Go to previous messageGo to next message
Michael Baranov is currently offline Michael BaranovFriend
Messages: 6
Registered: July 2009
Junior Member
Anyone, friends?

> Hi everyone!
>
> Sorry for bugging everyone here with stupidities... I'm implementing a
> proof-of-concept editor here, so a lot of conceptual questions ;-) I'd
> appreciate help with any of the following questions:
>
>
> 1) How can I add/remove children elements in response to a model
> property change of this element?
>
> In particular I want to add/remove ports (children) when "resource"
> property changes e.g. user points to another resource which has
> different ports.
>
>
>
> 2) Is there a way to have a property in ecore model that is a reference
> to a resource (file) in a project.
>
> I suspect it's EResource, but I get a transformation error: attribute is
> not transient and thus should be of serializable type (which is
> technically true). I really dare to dream of an automagical
> resource-selection-dialog as the property editor etc. ;-)
>
>
>
> 3) Is there a way to listen to element/figure movement and update
> external (feature) label location accordingly?
>
> Label is added inside addBorderItem() of the edit part of the element it
> corresponds to using BorderItemLocator.
>
>
> Thank you!!!
>
> Michael
Re: many small questions [message #212938 is a reply to message #212821] Mon, 08 December 2008 12:16 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello TDB,

> 1) How can I add/remove children elements in response to a model
> property change of this element?
I suggest you to add appropriate constraint to the corresponding child node
mapping and modify generated code (child node EditPart) to call parent node
update (see F5 action implementation) on receiving corresponding property
change event.

> 2) Is there a way to have a property in ecore model that is a
> reference to a resource (file) in a project.
AFAIK it is not possible now – EMF resources can not be referenced from .ecore
model, but I think you can use EMF “Instance Type Name” property to add references
to external (existing) classes/interfaces with the appropriate implementation
into .ecore model.

> I suspect it's EResource, but I get a transformation error: attribute
Well, I even can not see EResource in my workspace.. Do I miss something?
Do you know a name of plugin providing this class/interface?

> 3) Is there a way to listen to element/figure movement and update
> external (feature) label location accordingly?
Sure. You can listen for appropriate changes in notation model - Node.layoutConstraint
is an attribute keeping a reference to Bounds instance. BTW, I think external
label should be moved together with the original element at least for the
diagram nodes/links it should be implemented this way.

-----------------
Alex Shatalin
Previous Topic:How to get the main Editor from an EditPart
Next Topic:Problem drawing a child of an element
Goto Forum:
  


Current Time: Fri Aug 23 11:15:04 GMT 2024

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

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

Back to the top