|
Re: Change EMF properties and refresh Property View [message #1059273 is a reply to message #1058845] |
Wed, 15 May 2013 15:19 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Federico,
Comments below.
On 15/05/2013 2:55 PM, Federico De Meo wrote:
> Hello, I'm new to the forum and to EMF models.
> I'm working on a plug-in, initially developed by a colleague of mine,
> structured in three separated projects:
>
>
> One EMF Model (autogenerated)
> One GEF editor (autogenerated)
> One menu
>
>
>
> The EMF Model represent some object we want to draw in a graphical
> interface (along with some config values displayed in the Property View)
>
> The GEF editor allows to draw objects and displays properties in the
> Property View.
>
> The menu classes extend AbstractHandler and I want from it to change
> the value of config variable of the EMF Model and to automatically
> show the changes in the Property View. In the AbstractHandler I'm
> using ResourceSet and Resource to get the instance of the EObject
> related to the diagram shown in the editor.
> From the Resource I'm invoking the setInstantiationFiles method (b
> reported below) to change the variable value.
Aren't you using a command? You'd mess up the undo state if you don't...
> The value is correctly changed but the Property VIew is not
> auto-refreshed.
In EMF's generated editor, the properties view is updated by a command
stack listener that updates it whenever a command is executed, so maybe
that's the missing part.
>
> I tried to retrive the IPropertySheetPage in order to invoke the
> refresh() methods but this doesn't update the Property View.
It does in EMF's generated editor...
> I googled around and what I understood is that the
> setInstantiationFiles should do something more than just change an
> integer variable. It should invoke some sort of notification to notify
> the change (I suppose). Is it correct? How can I do that?
If that call is on a modeled EMF object, it will automatically send out
notifications, but the properties view doesn't update based on
notifications, only by calls to refresh...
>
>
>
> public void setInstantiationFiles(EList<String> inst) {
>
> instantiationFiles = inst;
> }
Is instantiationFiles a modeled feature in the model or what?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Change EMF properties and refresh Property View [message #1059350 is a reply to message #1059326] |
Fri, 17 May 2013 15:23 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Federico,
Comments below.
On 17/05/2013 4:11 PM, Federico De Meo wrote:
> I don't understand what do you mean with this.
>
> Quote:
>> If that call is on a modeled EMF object, it will automatically send
>> out notifications, but the properties view doesn't update based on
>> notifications, only by calls to refresh...
>
>
> Do you mean I should call a different method from the setters
> generated by the EMF framework?
No, I mean that all changes to EMF's models will automatically generate
notifications.
>
> The call to setIinstantiationFiles is in the EMF model, however I
> suspect that this feature was not primarily modelled in the ecore
> model (or at least it has been overwritten because I found @generated
> NOT in the code).
I can't comment on what people do after the code is generated, but the
frameworks will assume that all changes to the model produce
notifications so hand written modifications will need to respect that.
>
> At this moment I'm studying the how-to guide from Vainolo I found in
> the GEF Tutorial page on the eclipse website
> (http://wiki.eclipse.org/GEF/Articles,_Tutorials,_Slides)
> so as to better understand how things work.
Note that frameworks like GMF or Graphiti do a lot of things for you
automatically in terms of providing views for modeled objects...
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02842 seconds