Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Add new Resource File
Add new Resource File [message #650092] Fri, 21 January 2011 17:11 Go to next message
Joao S is currently offline Joao SFriend
Messages: 51
Registered: January 2011
Member
Hello everyone!

I´m facing some problemas here..

I´m trying to add a new resource file to Mindmap project.

My Plugin.xml looks like this:

<plugin>

   <extension point="org.eclipse.emf.ecore.generated_package">
      <package
            uri="http://www.example.org/mindmap"
            class="mindmap.MindmapPackage"
            genModel="model/mindmap.genmodel"/>
   </extension>

   <extension point="org.eclipse.emf.ecore.extension_parser">
      <parser
            type="mindmap"
            class="mindmap.util.MindmapResourceFactoryImpl"/>
      <parser
            type="txt"
            class="mindmap.util.MindmapTextResourceFactoryImpl"/>
   </extension>
</plugin>


All I want to do is to have a new resource file (.txt) besides the .diagram one.

Besides this what I have to do?

Thanks.
Re: Add new Resource File [message #650116 is a reply to message #650092] Fri, 21 January 2011 19:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Joao,

Comments below.

Joao wrote:
> Hello everyone!
>
> I´m facing some problemas here..
>
> I´m trying to add a new resource file to Mindmap project.
>
> My Plugin.xml looks like this:
>
> <plugin>
>
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri="http://www.example.org/mindmap"
> class="mindmap.MindmapPackage"
> genModel="model/mindmap.genmodel"/>
> </extension>
>
> <extension point="org.eclipse.emf.ecore.extension_parser">
> <parser
> type="mindmap"
> class="mindmap.util.MindmapResourceFactoryImpl"/>
> <parser
> type="txt"
> class="mindmap.util.MindmapTextResourceFactoryImpl"/>
> </extension>
> </plugin>
>
> All I want to do is to have a new resource file (.txt) besides the
> .diagram one.
>
> Besides this what I have to do?
Look at how the generated wizard in the generated EMF editor creates a
new resource.
>
> Thanks.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Add new Resource File [message #650297 is a reply to message #650116] Mon, 24 January 2011 10:04 Go to previous messageGo to next message
Joao S is currently offline Joao SFriend
Messages: 51
Registered: January 2011
Member
Hello Ed!

Thank you very much for your answer.

I´ve already done that. Resources are created in MindmapDiagramEditorUtil.java in the createDiagram method.

I tryed to create the resource with something like:

	final Resource textResource = editingDomain.getResourceSet()				.createResource(textURI);


The problem is that when I try to save the diagram, when it gets to doSaveDocument method in MindmapDocumentProvider.java this iterator:

for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
						.hasNext();)


Never gets the new resource.

Any hint?

Thanks,
Joao
Re: Add new Resource File [message #650364 is a reply to message #650297] Mon, 24 January 2011 16:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Joao,

I have no idea what "info" is but questions about
MindmapDocumentProvider sound like an Xtext questions to me.


Joao wrote:
> Hello Ed!
>
> Thank you very much for your answer.
>
> I´ve already done that. Resources are created in
> MindmapDiagramEditorUtil.java in the createDiagram method.
>
> I tryed to create the resource with something like:
>
> final Resource textResource =
> editingDomain.getResourceSet() .createResource(textURI);
>
> The problem is that when I try to save the diagram, when it gets to
> doSaveDocument method in MindmapDocumentProvider.java this iterator:
>
> for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
> .hasNext();)
>
> Never gets the new resource.
>
> Any hint?
>
> Thanks,
> Joao


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Add new Resource File [message #650368 is a reply to message #650364] Mon, 24 January 2011 16:25 Go to previous messageGo to next message
Joao S is currently offline Joao SFriend
Messages: 51
Registered: January 2011
Member
Hello,

Sorry about that. "info" is a ResourceSetInfo while "element" is an IEditorInput.

ResourceSetInfo info = getResourceSetInfo(element);


I guess I´ll have to take a look at Xtext then.

Thanks!
Joao
Re: Add new Resource File [message #650372 is a reply to message #650364] Mon, 24 January 2011 16:36 Go to previous message
Joao S is currently offline Joao SFriend
Messages: 51
Registered: January 2011
Member
Double post.

Sorry,
Joao

[Updated on: Mon, 24 January 2011 16:41]

Report message to a moderator

Previous Topic:ECore reflection
Next Topic:[CDO] enumerate (ocl) query parameter names
Goto Forum:
  


Current Time: Fri Apr 19 11:02:53 GMT 2024

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

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

Back to the top