Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » invisble views after reload
invisble views after reload [message #500225] Wed, 25 November 2009 07:50 Go to next message
Eclipse UserFriend
Hi,

I've a diagram with various view types, nodes, compartments and
terminals. The model and diagram data are stored in a database. The
model is serialized into various predefined tables and the diagram
stored as simple clob. The diagram data are serialized by calling the
ordinary XMLSave's save-method provided by the GMFResource.createXMLSave().
The diagram load goes the opposite way using the XMLLoad provided by the
resource.

So far so good. Everything is fine.

The save optimizes the diagram data skipping all default values
(including nodes located at a default location - what ever that is...).
And of course the load retieves the reduced diagram.

Now the problem: The diagram editor does not restores the nodes skipped
on save. The CanonicalEditPolicies gets activated, but no views/edit
parts are created for these optimized elements. The ViewServices usually
called for view creation are not triggered.

a) is there a resource option forcing to save all views or
b) how can I trigger the corresponding edit policies explicitely (or
invoking the ViewService(s) directly).

Thanks in Advance,
Sven
Re: invisble views after reload [message #500230 is a reply to message #500225] Wed, 25 November 2009 08:04 Go to previous messageGo to next message
Eclipse UserFriend
> Hi,
>
> I've a diagram with various view types, nodes, compartments and
> terminals. The model and diagram data are stored in a database. The
> model is serialized into various predefined tables and the diagram
> stored as simple clob. The diagram data are serialized by calling the
> ordinary XMLSave's save-method provided by the GMFResource.createXMLSave().
> The diagram load goes the opposite way using the XMLLoad provided by the
> resource.
>
> So far so good. Everything is fine.
>
> The save optimizes the diagram data skipping all default values
> (including nodes located at a default location - what ever that is...).
> And of course the load retieves the reduced diagram.
>
> Now the problem: The diagram editor does not restores the nodes skipped
> on save. The CanonicalEditPolicies gets activated, but no views/edit
> parts are created for these optimized elements. The ViewServices usually
> called for view creation are not triggered.
>
> a) is there a resource option forcing to save all views or
> b) how can I trigger the corresponding edit policies explicitely (or
> invoking the ViewService(s) directly).
>
> Thanks in Advance,
> Sven


Forgot thomething:

when I modified the editor by adding new nodes, the invisible nodes
appear and then are recreated properly after relaunching the editor. The
problem happens only on fresh eclipse start. Looks like a cache or
similar isn't properly initialized...
Re: invisble views after reload [message #500248 is a reply to message #500225] Wed, 25 November 2009 08:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

that's a known bug. which was already discussed in forum, a bug is open : https://bugs.eclipse.org/bugs/show_bug.cgi?id=281014

Regards,

Aurelien Pupier
Re: invisble views after reload [message #500251 is a reply to message #500225] Wed, 25 November 2009 08:59 Go to previous messageGo to next message
Eclipse UserFriend
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 09:01] by Moderator

Re: invisble views after reload [message #500260 is a reply to message #500248] Wed, 25 November 2009 08:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi Aurelien,

thanks for the quick response.

I've just moved all transientChildren into persistentChildren list right
before save as workaround. Do you see any drawbacks on that?

Sven
Aurelien Pupier schrieb:
> Hi,
>
> that's a known bug. which was already discussed in forum, a bug is open
> : https://bugs.eclipse.org/bugs/show_bug.cgi?id=281014
>
> Regards,
>
> Aurelien Pupier
Re: invisble views after reload [message #500281 is a reply to message #500251] Wed, 25 November 2009 09:38 Go to previous message
Eclipse UserFriend
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);
> }
Previous Topic:GEF3D
Next Topic:DnD support
Goto Forum:
  


Current Time: Sun Jul 20 12:50:06 EDT 2025

Powered by FUDForum. Page generated in 0.04209 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top