|
Re: EMF AdapterFactory and EEF Editor [message #660523 is a reply to message #660329] |
Fri, 18 March 2011 20:35 |
Nathalie Messages: 22 Registered: July 2009 |
Junior Member |
|
|
Hello,
I just wanted to let you know that I found a fix, well a temporary one at least.
I extended the following classes EEFTreeMDFormPage, EEFTreeMasterDetailsBlock and EEFTreeMasterPart. I contributed my custom EEFTreeMDFormPage to the editor in the InteractiveEEFEditor.contributePages(). And in the custom EEFTreeMDFormPage I set the details block to be my custom EEFTreeMasterDetailsBlock, where I set the master part to be my custom EEFTreeMasterPart.
I then change the EEFTreeMasterPart.setAdapterFactory(AdapterFactory) as follow:
@Override
public void setAdapterFactory(AdapterFactory adapterFact) {
super.setAdapterFactory(adapterFact);
getModelViewer().setContentProvider(new AdapterFactoryContentProvider(getAdapterFactory()));
getModelViewer().setLabelProvider(new AdapterFactoryLabelProvider(getAdapterFactory()));
}
The above code causes the TreeViewer of the editor to receive the value of the AdapterFactory used by the editor object and the property section viewers.
I think this fix is just temporary as the changed method is called when the AbstractEEFEditorPage is refreshed (AbstractEEFEditorPage .refresh()).
So I am not sure I will always run trouble free with this, especially If the current behavior is desired, but at least for now it does the job.
[Updated on: Fri, 18 March 2011 20:37] Report message to a moderator
|
|
|
Re: EMF AdapterFactory and EEF Editor [message #663571 is a reply to message #660523] |
Tue, 05 April 2011 16:57 |
Goulwen Le Fur Messages: 125 Registered: July 2009 |
Senior Member |
|
|
Hello Nathalie,
Le 18/03/2011 21:36, Nathalie a écrit :
> Hello,
>
> I just wanted to let you know that I found a fix, well a temporary one
> at least.
> I extended the following classes EEFTreeMDFormPage,
> EEFTreeMasterDetailsBlock and EEFTreeMasterPart. I contributed my custom
> EEFTreeMDFormPage to the editor in the
> InteractiveEEFEditor.contributePages(). And in the custom
> EEFTreeMDFormPage I set the details block to be my custom
> EEFTreeMasterDetailsBlock, where I set the master part to be my custom
> EEFTreeMasterPart.
> I then change the EEFTreeMasterPart.setAdapterFactory(AdapterFactory) as
> follow:
>
>
> @Override
> public void setAdapterFactory(AdapterFactory adapterFact) {
> super.setAdapterFactory(adapterFact);
> getModelViewer().setContentProvider(new
> AdapterFactoryContentProvider(getAdapterFactory()));
> getModelViewer().setLabelProvider(new
> AdapterFactoryLabelProvider(getAdapterFactory()));
> }
>
>
Great !
> The above code causes the TreeViewer of the editor to receive the
> AdapterFactory that is used by the editor object and the property
> section viewers.
> I think this fix is just temporary as the changed method is called when
> the AbstractEEFEditorPage is refreshed (AbstractEEFEditorPage
> .refresh()). So I am not sure I will always run trouble free with this,
> especially If the current behavior is desired, but at least for now it
> does the job.
>
>
Anway, it's not a good thing that we have 2 factories. I think the
setAdapterFactory() method should be call for each refresh. This was
done to be able to create page contents then set the adapterAdapter or
the opposite set the adapter before the page contents creation.
I need to check the refresh method to give you a better information.
Thanks,
Regards,
--
Goulwen
|
|
|
Powered by
FUDForum. Page generated in 0.03436 seconds