Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Resource 'xxx' does not exist(I cannot create an Xtext resource that was defined in a different plugin)
Resource 'xxx' does not exist [message #1065637] Wed, 26 June 2013 19:26 Go to next message
Liliana Pasquale is currently offline Liliana PasqualeFriend
Messages: 6
Registered: June 2013
Junior Member
Hi all,
apologies in advance for the basic question.
I created 2 projects:
1) Project1, which is a GMF diagram project that uses an Xtext resource whose grammar is defined in Project2
2) Project2, which defines the grammar of the resource used in Project1.

Obviously Project1 imports Project2.

This is the code that I use in Project1 to access to the resource:

new EventStandaloneSetup().createInjectorAndDoEMFRegistration();
ResourceSet rs = new ResourceSetImpl();
Resource resource = rs.getResource(URI.createURI(path+"/Domain.event"), true);
return resource.getContents().get(0);


Can anyone help me to solve this problem?
Thank you in advance!


The exception I get is the following:


org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/Users/liliana/Documents/Work/DigitalForensics/openpf-Jun/openpf/runtime-EclipseApplication/ForensicsExample/Domain.event' does not exist.
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.forensics.simpEvent.utility.Utils.retrieveDomainAssumptions(Utils.java:84)
at org.forensics.simpEvent.utility.Utils.getAdditionalEvents(Utils.java:27)
at xml.Translator.translateMonitoring(Translator.java:460)
at xml.Translator.translate(Translator.java:156)
at forensics.diagram.extensions.GenerateHypothesesAction.run(GenerateHypothesesAction.java:84)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4136)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3982)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3621)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/Users/liliana/Documents/Work/DigitalForensics/openpf-Jun/openpf/runtime-EclipseApplication/ForensicsExample/Domain.event' does not exist.
at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:341)
at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:215)
at org.eclipse.core.internal.resources.File.getContents(File.java:287)
at org.eclipse.core.internal.resources.File.getContents(File.java:278)
at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:202)
at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:482)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:354)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1256)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 40 more
Re: Resource 'xxx' does not exist [message #1065645 is a reply to message #1065637] Wed, 26 June 2013 21:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi you should never ever call standalone setup from eclipse.
http://koehnlein.blogspot.de/2012/11/xtext-tip-how-do-i-get-guice-injec
tor.html?m=1
Then you should you platform resource URIs.
Use IResourceSetProvider to obtain a resource set.
And then the depending project should have a pependeny (reference) to
its dependenybprojectb( see projects properties context menu)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resource 'xxx' does not exist [message #1065650 is a reply to message #1065645] Wed, 26 June 2013 22:48 Go to previous messageGo to next message
Liliana Pasquale is currently offline Liliana PasqualeFriend
Messages: 6
Registered: June 2013
Junior Member
Hi Christian,
thank you very much for your help and sorry again for another silly question.
Actually, I do not know how to obtain a IResourceSetProvider.
I guess a "default implementation" should be created by the Xtext generator XXXUIModule class.

How can I get a IResourceSetProvider?

Thank you
Re: Resource 'xxx' does not exist [message #1065681 is a reply to message #1065650] Thu, 27 June 2013 06:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Simply let you inject one (have a look st the blog post)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resource 'xxx' does not exist [message #1065985 is a reply to message #1065637] Fri, 28 June 2013 16:33 Go to previous messageGo to next message
Liliana Pasquale is currently offline Liliana PasqualeFriend
Messages: 6
Registered: June 2013
Junior Member
Hi Christian,
I injected a ResourceSetProvider, but am actually having another problem.


The get method of the ResourceSetProvider requires an IProject as parameter.
Since this is a plugin for another application, I cannot get the IProject from the current workspace, because the resource come from a different workspace.

Any additional help?

Thank you
Re: Resource 'xxx' does not exist [message #1065997 is a reply to message #1065985] Fri, 28 June 2013 17:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
???

I am not sure if i got your setup. how do you execute the code.
from your stacktrace i thought you are executing an action in
an eclipse?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 28 June 2013 18:06]

Report message to a moderator

Re: Resource 'xxx' does not exist [message #1066003 is a reply to message #1065997] Fri, 28 June 2013 19:03 Go to previous messageGo to next message
Liliana Pasquale is currently offline Liliana PasqualeFriend
Messages: 6
Registered: June 2013
Junior Member
Yes, I am executing an action in Eclipse,
but the project from which the action is executed is from a workspace (runtime-EclipseApplication) that is different from the workspace where the xxx.diagram project (which contains the code of the executed action) was developed.
Since to get a resource with a ResourceSetProvider you need to pass the IProject as an argument, I do not have idea how to get this IProject.

Thank you again for your help!

Re: Resource 'xxx' does not exist [message #1066005 is a reply to message #1066003] Fri, 28 June 2013 19:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you where is the file you want to load located? i thougt the project contain the Domain.event was contained
in a project in the runtime workspace??? alternatively you can let you inject a Provider<XtextResourceSet>


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resource 'xxx' does not exist [message #1066013 is a reply to message #1066005] Fri, 28 June 2013 20:51 Go to previous messageGo to next message
Liliana Pasquale is currently offline Liliana PasqualeFriend
Messages: 6
Registered: June 2013
Junior Member
Hi Christian,
apologies, my fault. Sad
The resource is located in the same project so I do not have problems anymore in getting the IProject.
The next issue is that the injected ResourceSetProvider is null.
Do I have to initialize it? I will also have a look at the blog post anyway.

Thank you for your patient.
Re: Resource 'xxx' does not exist [message #1066017 is a reply to message #1066013] Fri, 28 June 2013 22:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi,
this is why i have you a hint on the blogpost.
it shows you ways to make guice working in eclipse ui


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resource 'xxx' does not exist [message #1066020 is a reply to message #1066017] Sat, 29 June 2013 01:10 Go to previous message
Liliana Pasquale is currently offline Liliana PasqualeFriend
Messages: 6
Registered: June 2013
Junior Member
Hi Christian,
I use this to inject the ResourceSetProvider

EventActivator.getInstance().getInjector("org.forensics.simpEvent.Event").injectMembers(this);

it worked perfectly!

Thank you very much Smile
Previous Topic:Error resolving cross references on resource
Next Topic:ignoreCase for Serializer 2.0
Goto Forum:
  


Current Time: Thu Apr 25 03:34:44 GMT 2024

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

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

Back to the top