|
|
|
Re: invisble views after reload [message #500251 is a reply to message #500225] |
Wed, 25 November 2009 13:59 |
Olivier Marot Messages: 14 Registered: September 2009 |
Junior Member |
|
|
Hi,
I had the same problem in my application.
I can't remember what exactly, but something isn't intialized at startup. It is a registry of some kind, maybe your xxViewProvider.
The thing is, gmf tries to instantiate the class the first time it needs it, but expects a semantic hint, and fails because the CanonicalEditPolicy's method getFactoryHint() returns null. Of course, without the provider the view can't be created.
When creating a new element, the tool provides a factory hint to the request so you get the provider and then the views.
What I did is letting the canonical edit policy provide a semantic hint :
@Override
protected String getFactoryHint(IAdaptable elementAdapter) {
CanonicalElementAdapter element = (CanonicalElementAdapter) elementAdapter;
int VID = xxVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), (EObject)element.getRealObject());
return xxVisualIDRegistry.getType(VID);
}
edit : oh, my bad.
[Updated on: Wed, 25 November 2009 14:01] Report message to a moderator
|
|
|
|
Re: invisble views after reload [message #500281 is a reply to message #500251] |
Wed, 25 November 2009 14:38 |
Sven Krause Messages: 119 Registered: July 2009 |
Senior Member |
|
|
Hi Oliver,
works fine. Its better than persisting everything.
Sven
Olivier Marot schrieb:
> Hi,
>
> I had the same problem in my application.
> I can't remember what exactly, but something isn't intialized at
> startup. It is a registry of some kind, maybe your xxViewProvider.
>
> The thing is, gmf tries to instantiate the class the first time it needs
> it, but expects a factory hint, and fails because the
> CanonicalEditPolicy's method getFactoryHint() returns null. Of course,
> without the provider the view can't be created.
>
> When creating a new element, the tool provides a factory hint to the
> request so you get the provider and then the views.
> What I did is letting the canonical edit policy provide a factory hint :
>
> @Override
> protected String getFactoryHint(IAdaptable elementAdapter) {
> CanonicalElementAdapter element = (CanonicalElementAdapter)
> elementAdapter;
> int VID = xxVisualIDRegistry.getNodeVisualID((View)
> getHost().getModel(), (EObject)element.getRealObject());
> return xxVisualIDRegistry.getType(VID);
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03123 seconds