Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create a ResourceSet of Filesystem
Create a ResourceSet of Filesystem [message #802171] Sun, 19 February 2012 09:38 Go to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Hello,

i currently using GMF facing the following problem.
I want to create a ResourceSet out of a filesystem. This means i have a set of files, all belonging to the same gmfmodel.

Is there any chance to read this files and create a big ResourceSet out of it ?
Could somebody give me a hint on how to do that ?

Greetings
Re: Create a ResourceSet of Filesystem [message #802196 is a reply to message #802171] Sun, 19 February 2012 10:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 24564
Registered: July 2009
Senior Member
Comments below.

On 19/02/2012 3:38 PM, Snakebyte Mising name wrote:
> Hello,
>
> i currently using GMF facing the following problem.
> I want to create a ResourceSet out of a filesystem.
ResourceSets aren't created out of a file system. They contain
resources and the URIs of those resources determines from where things
are loaded and to where things are saved. So if you use file: URIs (as
created by URI.createFileURI then you'll have resources from the file
system. When working in the Eclipse IDE though, you'll generally want
to use platform:/resource URIs to work with the Eclipse workspace.
> This means i have a set of files, all belonging to the same gmfmodel.
A ResourceSet can contain any resources from anywhere for any models.
>
> Is there any chance to read this files and create a big ResourceSet
> out of it ?
Just load them. ResourceSet.getResource specifying the URIs of the
things you want in the resource set.
> Could somebody give me a hint on how to do that ?
>
> Greetings
Re: Create a ResourceSet of Filesystem [message #802254 is a reply to message #802196] Sun, 19 February 2012 12:37 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Ok this works great.

But when im trying to load a resource containing references to other files it crahes with an IllegalValueException.

What can i do to load these missing resources recursivly and automatically ?

The problem is i dont know the references before loading. And there can be many of such references in my application. So i cant load the resources in a tree-like structure.

Is it possible to load a set of resources ?
Or other ways to handle this?

Greetings

[Updated on: Sun, 19 February 2012 13:07]

Report message to a moderator

Re: Create a ResourceSet of Filesystem [message #802279 is a reply to message #802254] Sun, 19 February 2012 13:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 24564
Registered: July 2009
Senior Member
Are the cross document references absolute or relative?


On 19/02/2012 6:37 PM, Snakebyte Mising name wrote:
> Ok this works great.
>
> But when im trying to load a resource containing references to other
> files it crahes with an IllegalValueException.
>
> What can i do to load these missing resources automatically ?
>
> Greetings
Re: Create a ResourceSet of Filesystem [message #802280 is a reply to message #802279] Sun, 19 February 2012 13:27 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
They "can" be set dynamically during runtime. But they dont need to be set. The respektive attribute can still be empty.

I have some objects in my model that contain this references.

Maybe this exeption explains it a bit more :

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'gsnModel.impl.GoalImpl@42f25b18 (eProxyURI: file:/C:/Users/Snakebyte/runtime-EclipseApplication/newTreeTest/Top.model_diagram#_S07Z4FixEeG3ktPfKTiLJw)' is not legal. (file:/C:/Users/Snakebyte/runtime-EclipseApplication/newTreeTest/FirstSub.model_diagram, 12, 101)



The File "Top.model_diagram" contains an object, containing an attribute that can be set to an object (Goal) in File "FirstSub.model_diagram".

So i cant load FirstSub without loading Top
But what if Top has such references in FirstSub too ?
Is that not possible at all ?

The source seems to raise this exception if there is such a proxy value that cant be found. Is it not found because it is not contained in the ResourceSet ?

If i try to load a file dont containing any cross-references it works great.

Greetings

[Updated on: Sun, 19 February 2012 13:47]

Report message to a moderator

Re: Create a ResourceSet of Filesystem [message #802322 is a reply to message #802280] Sun, 19 February 2012 15:08 Go to previous message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
ok i think it was my own fault.
The error is related to a null pointer exception done in a stupid listener. Wink

[Updated on: Sun, 19 February 2012 15:27]

Report message to a moderator

Previous Topic:GMF Loading time
Next Topic:GMF + Dawn Codegen
Goto Forum:
  


Current Time: Sun May 26 05:08:54 EDT 2013

Powered by FUDForum. Page generated in 0.01923 seconds