Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EEF] Update editor when semantic element change
[EEF] Update editor when semantic element change [message #667351] Thu, 28 April 2011 05:21 Go to next message
Xavier Seignard is currently offline Xavier Seignard
Messages: 52
Registered: June 2010
Member
Hello,
I would like to display (or not) some parts of my editor given the value of a semantic element.

Ex : Imagine an EClass Definition with two EAttributes Type and Unit.
If Type equals String I don't want to display the field Unit in my editor.

To do so, I extended the XXXPropertiesEditionPartImpl and overidden the createControls method in order to provide the behavior I want by modifying the CompositionSequence of the composer.

It works quite well except that the editor is not dynamically updated when I change the value of my semantic element. I need to display another file or close the editor and open it again to see the semantic change reflected in my editor (because createControls is called again).

Now I would like to do it dynamically, so I assume I need to override the createXXXEMFComboViewer (in my case) in order to add a ISelectionChangedListener which will update the editor during the call of selectionChanged. Am I right? Is it the right way to do it?

The problem is I can't figure out how to update the editor. Do you have any idea?

Have a good day,

Regards,

Xavier Seignard

[Updated on: Thu, 28 April 2011 05:25]

Report message to a moderator

Re: [EEF] Update editor when semantic element change [message #667410 is a reply to message #667351] Thu, 28 April 2011 10:43 Go to previous messageGo to next message
Nathalie Lepine is currently offline Nathalie Lepine
Messages: 28
Registered: July 2009
Junior Member
Hello,

Do dynamically update the view, you need to change the
"updateSemanticModel" method of the component using the composer and the
composition sequence. For example : this code change the visibility of
the first widget each time the value of my combo changes :

((CompositePropertiesEditionPart)editingPart).getComposer(). getCompositionSequence().getSubSteps().get(0).getSubSteps(). get(0).switchVisibilty();((CompositePropertiesEditionPart)ed itingPart).refresh();
initPart(partKey, 0, this.semanticObject);

Regards,

Nathalie Lepine.


Le 28/04/2011 11:21, Xavier Seignard a écrit :
> Hello,
> I would like to display (or not) some parts of my editor given the value
> of a semantic element.
>
> Ex : Imagine an EClass Definition with two EAttributes Type and Unit. If
> Type equals String I don't want to display the field Unit in my editor.
>
> To do so, I extended the XXXPropertiesEditionPartImpl and overidden the
> createControls method in order to provide the behavior I want by
> modifying the CompositionSequence of the composer.
>
> It works quite well except that the editor is not dynamically updated
> when I change the value of my semantic element. I need to display
> another file or close the editor and open it again to see the semantic
> change reflected in my editor (because createControls is called again).
>
> Now I would like to do it dynamically, so I assume I need to override
> the createXXXEMFComboViewer (in my case) in order to add a
> ISelectionChangedListener which will update the editor during the call
> of selectionChanged. Am I right? Is it the right way to do it?
>
> The problem is I can't figure out how to update the editor. Do you have
> any idea?
>
> Have a good day,
>
> Regards,
>
> Xavier Seignard
Re: [EEF] Update editor when semantic element change [message #667872 is a reply to message #667410] Mon, 02 May 2011 10:32 Go to previous messageGo to next message
Xavier Seignard is currently offline Xavier Seignard
Messages: 52
Registered: June 2010
Member
Thanks Nathalie! Works quite well!

I also added some code in the intPart method of the component too, in order display the right filtered view at the initialization.

But that's a lot of code outside user code area.

I would like to extend the component and then use a custom provider in order to preserve my code during next generation.

I had a look at this great blog post : http://milesparker.blogspot.com/2010/02/pimping-eef-master-d etail.html

But I'm kinda stuck at step 9. I can't find which class he is overriding according to my generated code.

Could you explain a bit more that step?

Regards,

And thanks again for the quick support! (and obviously for EEF Smile )

Xavier
Re: [EEF] Update editor when semantic element change [message #667883 is a reply to message #667872] Mon, 02 May 2011 11:06 Go to previous messageGo to next message
Nathalie Lepine is currently offline Nathalie Lepine
Messages: 28
Registered: July 2009
Junior Member
Hi Xavier !

Miles blog was done for EEF 0.8, now there is no more
PropertiesEditionProvider, it is replaced by an AdapterFactory. So for
the step 9, you have to redefine the EEFAdapterFactory and its method
createXXXPropertiesEditionProvider. And for step 10, you should use the
EMF adapter factory extension point.

Regards,

Nathalie.

Le 02/05/2011 16:32, Xavier Seignard a écrit :
> Thanks Nathalie! Works quite well!
>
> I also added some code in the intPart method of the component too, in
> order display the right filtered view at the initialization.
>
> But that's a lot of code outside user code area.
>
> I would like to extend the component and then use a custom provider in
> order to preserve my code during next generation.
>
> I had a look at this great blog post :
> http://milesparker.blogspot.com/2010/02/pimping-eef-master-d etail.html
>
> But I'm kinda stuck at step 9. I can't find which class he is overriding
> according to my generated code.
>
> Could you explain a bit more that step?
>
> Regards,
>
> And thanks again for the quick support! (and obviously for EEF :) )
>
> Xavier
Re: [EEF] Update editor when semantic element change [message #668057 is a reply to message #667883] Tue, 03 May 2011 10:50 Go to previous message
Xavier Seignard is currently offline Xavier Seignard
Messages: 52
Registered: June 2010
Member
Thanks again Nathalie for your quick and clear answer!

Everything is now OK in my property sheet in my diagramming tool!

As I also wrote my own edit parts, I also used the org.eclipse.emf.eef.runtime.PropertiesEditionPartProvider extension point to load it.

Work well too.

Regards and thanks for your help!

Xavier
Previous Topic:How to extract all attribute names from my ecore metamodel
Next Topic:[EMF Validation} Changing default validation messages
Goto Forum:
  


Current Time: Wed Jul 23 18:27:46 EDT 2014

Powered by FUDForum. Page generated in 0.02040 seconds