[EEF] Update editor when semantic element change [message #667351] |
Thu, 28 April 2011 05:21  |
Eclipse User |
|
|
|
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] by Moderator
|
|
|
Re: [EEF] Update editor when semantic element change [message #667410 is a reply to message #667351] |
Thu, 28 April 2011 10:43   |
Eclipse User |
|
|
|
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 #668057 is a reply to message #667883] |
Tue, 03 May 2011 10:50  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.07278 seconds