Skip to main content



      Home
Home » Modeling » TMF (Xtext) » UnsupportedOperationException: getEObjectURI
UnsupportedOperationException: getEObjectURI [message #707523] Mon, 01 August 2011 15:10 Go to next message
Eclipse UserFriend
Hello,

I'm having problems doing code generation. I implemented the IXtextBuilderParticipant interface. A new java project containing the generated code is created.

If I do a full clean without generating the code, everything goes well. If I do a full clean with the code generation activated, the first time everything seems to go well, but if I do a second full clean, I get the exception:

java.lang.UnsupportedOperationException: getEObjectURI
	at org.eclipse.xtext.common.types.ui.notification.NameBasedEObjectDescription.getEObjectURI(NameBasedEObjectDescription.java:45)
	at altagracia.builder.XtextAltagraciaBuilderParticipant.build(XtextAltagraciaBuilderParticipant.java:106)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
	at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:160)
	at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:182)
	at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:85)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
	at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:513)
	at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:422)
	at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:180)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


and the building process crash, leaving the xtetx project full of errors and unresolved references.

This is the fragment of code where the exception occurs:

 for (IResourceDescription.Delta delta : context.getDeltas()) {
    if (delta.getNew() != null){	
	//URI uri = getObjectUrl(delta.getNew());
	Iterable<IEObjectDescription> descNew = delta.getNew().getExportedObjects();
	for (IEObjectDescription desc : descNew) {
                //the next line causes the exception
		newFile(context.getResourceSet().getEObject( desc.getEObjectURI(), true)); 
	}
   }
   monitor.worked(1);
 }



Do you have any idea of what is going wrong here or how to debug this problem?

Thank you very much for your help.
Re: UnsupportedOperationException: getEObjectURI [message #707537 is a reply to message #707523] Mon, 01 August 2011 15:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

i guess your way is not the intended one. have a look at JavaProjectBasedBuilderParticipant

Resource resource = context.getResourceSet().getResource(delta.getUri(), true);

~Christian
Re: UnsupportedOperationException: getEObjectURI [message #707583 is a reply to message #707537] Mon, 01 August 2011 16:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

I had a look at it and I'm wondering JavaProjectBasedBuilderParticipant is what I need. I found this:

final IProject builtProject = context.getBuiltProject();
IJavaProject javaProject = JavaCore.create(builtProject);
if (!javaProject.exists())
    return;


The project where the user write code with my DSL is not a Java project, but the generated project during the clean is.

Should I use JavaProjectBasedBuilderParticipant? If you have any example I could look at, I'd really appreciate it.

Thank you very much!
Re: UnsupportedOperationException: getEObjectURI [message #707586 is a reply to message #707583] Mon, 01 August 2011 16:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi, i just pointed at it As a source of Inspiration.
Re: UnsupportedOperationException: getEObjectURI [message #707646 is a reply to message #707523] Mon, 01 August 2011 18:32 Go to previous message
Eclipse UserFriend
Hi Rafael,

please make sure that the file extension of the resource(delta) that you
process is matching your language. The NameBasedEObjectDescription will
most likely point to something with an URI similar to
"java:/Objects/com.foo.bar.Something". I'd assume you are more
interested in "platform:/resource/yourproject/somet/path/file.yourdsl"

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 01.08.11 21:10, Rafael Angarita wrote:
> Hello,
>
> I'm having problems doing code generation. I implemented the
> IXtextBuilderParticipant interface. A new java project containing the
> generated code is created.
>
> If I do a full clean without generating the code, everything goes well.
> If I do a full clean with the code generation activated, the first time
> everything seems to go well, but if I do a second full clean, I get the
> exception:
>
>
> java.lang.UnsupportedOperationException: getEObjectURI
> at
> org.eclipse.xtext.common.types.ui.notification.NameBasedEObjectDescription.getEObjectURI(NameBasedEObjectDescription.java:45)
>
> at
> altagracia.builder.XtextAltagraciaBuilderParticipant.build(XtextAltagraciaBuilderParticipant.java:106)
>
> at
> org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
>
> at
> org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:160)
> at
> org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:182)
>
> at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:85)
> at
> org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at
> org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
>
> at
> org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
>
> at
> org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at
> org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
>
> at
> org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
>
> at
> org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
> at
> org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:513)
>
> at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:422)
> at
> org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:180)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
>
>
> and the building process crash, leaving the xtetx project full of errors
> and unresolved references.
>
> This is the fragment of code where the exception occurs:
>
>
> for (IResourceDescription.Delta delta : context.getDeltas()) {
> if (delta.getNew() != null){
> //URI uri = getObjectUrl(delta.getNew());
> Iterable<IEObjectDescription> descNew =
> delta.getNew().getExportedObjects();
> for (IEObjectDescription desc : descNew) {
> //the next line causes the exception
> newFile(context.getResourceSet().getEObject( desc.getEObjectURI(),
> true)); }
> }
> monitor.worked(1);
> }
>
>
>
> Do you have any idea of what is going wrong here or how to debug this
> problem?
>
> Thank you very much for your help.
Previous Topic:Content Assist error
Next Topic:extend xbase with a binary literal
Goto Forum:
  


Current Time: Sat Jul 26 19:26:09 EDT 2025

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

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

Back to the top