Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Can I open a Xtext editor for a element tree contained in another model?
icon5.gif  Can I open a Xtext editor for a element tree contained in another model? [message #837555] Thu, 05 April 2012 16:37 Go to next message
Eclipse UserFriend
Hi,

I have a ecore model that has the following structure:

RootContainer
- ContainedTreeOne
-- ContainedElement1
-- ContainedElement2

- ContainedTreeTwo
-- ContainedElement3
-- ContainedElement4

Currently the model is being visualized using a SWT treeviewer and edited in a SWT form editor that is opened when the element is double clicked.

I would like to add another child in RootContainer, let's call it ContainedTreeTwo. This submodel is like the EntityModel example, so I would like to edit it using a Xtext editor that should be opened by double clicking the item in the view.

could I do such thing ?

If yes, could someone point me to some path ?

regards,

Cristiano

[Updated on: Thu, 05 April 2012 16:51] by Moderator

Re: Can I open a Xtext editor for a element tree contained in another model? [message #837569 is a reply to message #837555] Thu, 05 April 2012 17:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

did you already had a look at this thread http://www.eclipse.org/forums/index.php/m/776512/

~Christian
Re: Can I open a Xtext editor for a element tree contained in another model? [message #839996 is a reply to message #837569] Mon, 09 April 2012 10:30 Go to previous messageGo to next message
Eclipse UserFriend
Now I did, thanks.

Summaring, It seems that I need to use an EmbeddedEditorFactory and a IEditedResourceProvider implementation, right ?

But I couldn't get there step yet because I couldn't create the Xtext project based on my ecore project. I'm getting this error after select the ecore package, the node and the project starts to be created:

java.lang.reflect.InvocationTargetException
	at org.eclipse.xtext.ui.wizard.XtextNewProjectWizard$1.run(XtextNewProjectWizard.java:57)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: EvaluationException : Couldn't find type or property 'EPackageImportURI'
	org::eclipse::xtext::xtext::ui::wizard::ecore2xtext::Ecore2Xtext.xpt[1403,17] on line 33 'EPackageImportURI'
	org::eclipse::xtext::xtext::ui::wizard::ecore2xtext::Ecore2Xtext.xpt[901,55] on line 20 'EXPAND metamodelImport FOREACH allReferencedEPackages()'
	org::eclipse::xtext::xtext::ui::wizard::ecore2xtext::Ecore2XtextDslProject.xpt[748,27] on line 18 'EXPAND Ecore2Xtext::grammar'

	at org.eclipse.internal.xtend.expression.ast.FeatureCall.evaluateInternal(FeatureCall.java:139)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:51)
	at org.eclipse.internal.xtend.expression.ast.OperationCall.evaluateInternal(OperationCall.java:60)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:51)
	at org.eclipse.internal.xpand2.ast.ExpressionStatement.evaluateInternal(ExpressionStatement.java:45)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:191)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.FileStatement.evaluateInternal(FileStatement.java:86)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:226)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.xpand2.XpandFacade.evaluate2(XpandFacade.java:62)
	at org.eclipse.xpand2.XpandFacade.evaluate(XpandFacade.java:43)
	at org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.createProject(XtextProjectCreator.java:296)
	at org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.createDslProject(XtextProjectCreator.java:170)
	at org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.execute(XtextProjectCreator.java:97)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.xtext.ui.wizard.XtextNewProjectWizard.doFinish(XtextNewProjectWizard.java:82)
	at org.eclipse.xtext.ui.wizard.XtextNewProjectWizard$1.run(XtextNewProjectWizard.java:54)
	... 1 more


Any hint about what could be generating this error?

regards

Cristiano

[Updated on: Mon, 09 April 2012 10:33] by Moderator

Re: Can I open a Xtext editor for a element tree contained in another model? [message #840016 is a reply to message #839996] Mon, 09 April 2012 11:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

No I have no idea, can you share a minimal reproducable ecore +
genmodel

Regards Christian
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840171 is a reply to message #840016] Mon, 09 April 2012 15:06 Go to previous messageGo to next message
Eclipse UserFriend
I think I've discovered the motive of the error.
In my ecore I was using the registered package from http://www.eclipse.org/xtext/common/JavaVMTypes (I've use the runtime version). So, I had something like this:

<eClassifiers xsi:type="ecore:EClass" name="Feature" abstract="true">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="ecore:EClass http://www.eclipse.org/xtext/common/JavaVMTypes#//JvmTypeReference"
        containment="true"/>


change to this makes the project to be created:
  <eClassifiers xsi:type="ecore:EClass" name="Feature" abstract="true">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="ecore:EClass platform:/plugin/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore#//JvmTypeReference"
        containment="true"/>
  </eClassifiers>


But when I try to run the .mwe2 file I got this error:
2133 [main] ERROR ipse.xtext.generator.LanguageConfig  - [XtextLinkingDiagnostic: null:8 

Couldn't resolve reference to EPackage 'platform:/plugin/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore'.]


I've tried to add this to the mwe2 file :
		registerGenModelFile = "platform:/plugin/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"


But this not work. Could you point me to the right way of doing such importing?

thanks

Cristiano
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840182 is a reply to message #840171] Mon, 09 April 2012 15:18 Go to previous messageGo to next message
Eclipse UserFriend
It should work with the nsURI if you add a registerGeneratedEPacke
(or something like that) with the full qualified name of the package
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840192 is a reply to message #840182] Mon, 09 April 2012 15:42 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, couldn't follow you. What do you mean with "with the full qualified name of the package"? could you give more detail on that?

btw, I've tried this and seems to be working (at least do not throw errors):

	bean = StandaloneSetup {
		scanClassPath  = true
		registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
		registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
		registerGenModelFile = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
	}


[Updated on: Mon, 09 April 2012 15:42] by Moderator

Re: Can I open a Xtext editor for a element tree contained in another model? [message #840201 is a reply to message #840192] Mon, 09 April 2012 15:53 Go to previous messageGo to next message
Eclipse UserFriend
hi you ( implicitely) already did what I meant so nothing to explain
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840236 is a reply to message #840201] Mon, 09 April 2012 17:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

Come back to zero again. I've created a new ecore project based on the .ecore generated by Domain example.

I've modified the imports on it to platform:/plugin/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore as I did before with the other project. but I can't run the xtext wizard with it. Sad

eclipse.buildId=I20120315-1300
java.version=1.6.0_31
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -keyring /Users/cvgaviao/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -keyring /Users/cvgaviao/.eclipse_keyring -showlocation

Error
Mon Apr 09 18:02:11 BRT 2012
org.eclipse.xtext.ui.wizard.XtextNewProjectWizard  - 


java.lang.reflect.InvocationTargetException
	at org.eclipse.xtext.ui.wizard.XtextNewProjectWizard$1.run(XtextNewProjectWizard.java:57)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: EvaluationException : Nullevaluation!
	org::eclipse::xtext::xtext::ui::wizard::ecore2xtext::Ecore2Xtext.xpt[2530,21] on line 73 'needsDispatcherRule()'
	org::eclipse::xtext::xtext::ui::wizard::ecore2xtext::Ecore2Xtext.xpt[997,89] on line 22 'EXPAND subClassDispatcherRule FOREACH allDispatcherRuleClasses().remove(rootElementClass)'
	org::eclipse::xtext::xtext::ui::wizard::ecore2xtext::Ecore2XtextDslProject.xpt[748,27] on line 18 'EXPAND Ecore2Xtext::grammar'

	at org.eclipse.internal.xpand2.ast.IfStatement.evaluateInternal(IfStatement.java:88)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:191)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.FileStatement.evaluateInternal(FileStatement.java:86)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:226)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.xpand2.XpandFacade.evaluate2(XpandFacade.java:62)
	at org.eclipse.xpand2.XpandFacade.evaluate(XpandFacade.java:43)
	at org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.createProject(XtextProjectCreator.java:296)
	at org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.createDslProject(XtextProjectCreator.java:170)
	at org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.execute(XtextProjectCreator.java:97)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.xtext.ui.wizard.XtextNewProjectWizard.doFinish(XtextNewProjectWizard.java:82)
	at org.eclipse.xtext.ui.wizard.XtextNewProjectWizard$1.run(XtextNewProjectWizard.java:54)
	... 1 more




Could you please let a look in the attached project?

thanks

Cristiano
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840242 is a reply to message #840236] Mon, 09 April 2012 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Please file a ticket into bugzilla
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840249 is a reply to message #840242] Mon, 09 April 2012 17:31 Go to previous messageGo to next message
Eclipse UserFriend
Ok, I will...

But just to know, have you been able to reproduce it in your environment ?

regards
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840498 is a reply to message #840249] Tue, 10 April 2012 02:50 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

i actually dont get an error. which Xtext version do you use?

~Christian
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840647 is a reply to message #840498] Tue, 10 April 2012 06:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Humm... bit strange :/

The version that I was using is Xtext SDK 2.3.0.v201204031826 with Juno M6 in a MacOS.

I've update to version 2.3.0.v201204050926, but still getting the same error in the attached project.

regards

Cristiano

[Updated on: Tue, 10 April 2012 06:52] by Moderator

Re: Can I open a Xtext editor for a element tree contained in another model? [message #840655 is a reply to message #840647] Tue, 10 April 2012 06:44 Go to previous messageGo to next message
Eclipse UserFriend
I tested 2.2.1 so please file a ticket for this regression
Re: Can I open a Xtext editor for a element tree contained in another model? [message #840715 is a reply to message #840655] Tue, 10 April 2012 08:35 Go to previous messageGo to next message
Eclipse UserFriend
I've opened the ticket here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=376362

As I have one goal to accomplish, that is to open an xtext editor with one nodetree in my model, I've tried Xtext SDK version 2.2.1.v201112130541 with Indigo.

Sorry to say, unfortunately I got the same error. Sad

I'll remove the links to other packages just to try to resolve the open editor thing...

thanks

[Updated on: Tue, 10 April 2012 08:36] by Moderator

Re: Can I open a Xtext editor for a element tree contained in another model? [message #843685 is a reply to message #840715] Fri, 13 April 2012 05:18 Go to previous message
Eclipse UserFriend
Hi,

A similar need where I need to partially edit a model as part of the tree. Used EmbeddedXtextEditor to open a partial element of the model for editing. This has been achieved as embeddedEditor.createPartialEditor("", editableText, "", true), where editable text is the partial part of the model. But my content assist & other handlers are not working correctly or as required.

I am not using text editor classes as my base class for editor class & have used form page. Let me know if I have gone down the wrong path or something else would be needed to go ahead.

Not sure whether editableText is the correct way for being the partial model as in Xtext 1.0 while integrating with GMF we used to attach with rule rather than string?

Regards
Vishal
Previous Topic:dangling references on reparse of a resource
Next Topic:reference
Goto Forum:
  


Current Time: Sat Jul 19 19:21:30 EDT 2025

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

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

Back to the top