Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Use GMF Editor without file system backend
Use GMF Editor without file system backend [message #207969] Tue, 07 October 2008 23:07 Go to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: July 2009
Junior Member
Good morning,

i have a big problem using the graphical editor generated by the gmf:

I don't want to work with files.

My application has (for examlpe) a list of roadmaps (as java objects) and
i want so open theese objects in the editor without giving any files as
input.

My (very bad) solution:

generate a temporarily model file from the model
generate a temporarily diagram file from the model
and then open the diagram file.
...do some things..
close editor
delete the 2 files

This cannot be the best way ;-)

Ss there any other solution?

Thank you very much for reading and (hopefully) help
Uwe Breitenbuecher (Germany)
Re: Use GMF Editor without file system backend [message #207988 is a reply to message #207969] Wed, 08 October 2008 04:48 Go to previous messageGo to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi Uwe,

This thread might be helpful:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg13026.html

Cheers
Jevon

Uwe Breitenbuecher wrote:
> Good morning,
>
> i have a big problem using the graphical editor generated by the gmf:
>
> I don't want to work with files.
>
> My application has (for examlpe) a list of roadmaps (as java objects)
> and i want so open theese objects in the editor without giving any files
> as input.
>
> My (very bad) solution:
>
> generate a temporarily model file from the model
> generate a temporarily diagram file from the model
> and then open the diagram file.
> ..do some things..
> close editor
> delete the 2 files
>
> This cannot be the best way ;-)
>
> Ss there any other solution?
>
> Thank you very much for reading and (hopefully) help
> Uwe Breitenbuecher (Germany)
>
Re: Use GMF Editor without file system backend [message #208020 is a reply to message #207988] Wed, 08 October 2008 09:28 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: July 2009
Junior Member
Hey

Thank you for your help!

The problem is, that i can't use a database for "live object storing".

I have to use a data-storage class (for example a class containing
List<roadmaps> roadmapList = ...) and use the roadmaps from this list to
open the editor.

A Use Case:

All theese objects are in a tree and by double click i want to open the
clicked roadmap (a java object (pojo))

i.e. I need a solution without any backend system => only working with
java objects.

Thank you for your efforts
Uwe
Re: Use GMF Editor without file system backend [message #208035 is a reply to message #208020] Wed, 08 October 2008 09:35 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Uwe,

You still have to use URIEditorInput for openning diagram editor.
You have to implement/register Resource.Factory to handle URIs passed as
a parameter into URIEditorInput on step 1.

-----------------
Alex Shatalin
Re: Use GMF Editor without file system backend [message #208062 is a reply to message #208035] Wed, 08 October 2008 10:26 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: July 2009
Junior Member
Hello Alex,

thank you for your support!

Your solution is the one i was afraid of! ;)

Have you any links, PDF'S, Documentation or tutorials how to do this? My
research in the internet was not succesfull when i tried it a few days ago.

Have a nice day,
Uwe
Re: Use GMF Editor without file system backend [message #208069 is a reply to message #208062] Wed, 08 October 2008 10:37 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Uwe,

I have no referencces except java doc..

-----------------
Alex Shatalin
Re: Use GMF Editor without file system backend [message #208076 is a reply to message #208069] Wed, 08 October 2008 10:40 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: July 2009
Junior Member
Hey Alex,

have you maybe an example code or code snippets or anything else? The
"register" step is my problem..

Thanks!
Uwe
Re: Use GMF Editor without file system backend [message #208082 is a reply to message #208076] Wed, 08 October 2008 12:09 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Uwe,

Here is an example from ecore diagram editor plugin.xml:

<extension point="org.eclipse.emf.ecore.extension_parser">
<?gmfgen generated="true"?>
<parser
type="ecore_diagram"
class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y ">
</parser>
</extension>

-----------------
Alex Shatalin
Re: Use GMF Editor without file system backend [message #208120 is a reply to message #208082] Wed, 08 October 2008 21:34 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: July 2009
Junior Member
Hey Alex,

i don't understand how this should work:

how can i "lead" the uri to my java object? when opening the editor, the
openEditor takes the resource and calls .getUri() ...

somewhere i have to tell the application, how to "map" uri's to java
objects..can you tell me where? (and how)

Sorry for my many questions and thank you for your support!

Greetings from Germany,
Uwe
Re: Use GMF Editor without file system backend [message #208660 is a reply to message #208120] Wed, 15 October 2008 10:19 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Uwe,

> how can i "lead" the uri to my java object? when opening the editor,
> the openEditor takes the resource and calls .getUri() ...
The contract is quite simple - each time EMF is going to load EObject using
URI (for example - URI from the URIEditorInput) it first gets corresponding
Resource URI (part of the EObject URI) and loads corresponding resource through
the central registry. All you have to do is register your own ResourceFactory
into this registry handling some specific resource URIs (instantiating corresponding
resource and returning it back). EMF resource is just a container of EObjects,
so your custom resource have to implement all org.eclipse.emf.ecore.resource.Resource
methods including getContents() one returning "java" objects.

You can google for some more information. For example - this article: http://blog.cypal-solutions.com/2008/03/how-does-emf-finds-r ight-parser.html

-----------------
Alex Shatalin
Re: Use GMF Editor without file system backend [message #209619 is a reply to message #208660] Mon, 27 October 2008 13:05 Go to previous message
No real name is currently offline No real nameFriend
Messages: 6
Registered: July 2009
Junior Member
Hey,

Thank you! It works! :-)

I have extended the xmiresourceimpl. This saves a lot of time ;)

Now i understand how it works (resources, factorys, ...).

I will write a tutorial for this problem.

Thank you all very much!!!
Previous Topic:Model and Notation is still in the memory after diagram is closed
Next Topic:Source/Target Anchor question
Goto Forum:
  


Current Time: Thu Apr 25 18:56:35 GMT 2024

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

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

Back to the top