Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » xtext Editor in Papyrus(xtext Editor in Papyrus)
xtext Editor in Papyrus [message #635674] Wed, 27 October 2010 17:17 Go to next message
Dani is currently offline DaniFriend
Messages: 41
Registered: October 2010
Member
Hi ,
I wanted to ask to developers of Papyrus about xtext editors used in papyrus. These are three xtext editor plugins used to define grammer etc for properties.

org.eclipse.papyrus.property.editor.xtext
org.eclipse.papyrus.property.editor.xtext.generator
org.eclipse.papyrus.property.editor.xtext.ui

I have seen all of these three plugins but could not find how you are using it when you drag property on a class then click it and get a text area to write. it gives code completion and code highligting. I wanted to know where can I find this implementation? is it implemented in some other plugin? can any one point me to that code? it would help me alot!

Regards
/Jaguar
Re: xtext Editor in Papyrus [message #635800 is a reply to message #635674] Thu, 28 October 2010 08:02 Go to previous messageGo to next message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 34
Registered: April 2010
Member
Hello Jaguar,

From your eclipse session (provided that Papyrus is installed), you can find documentation on how to embedd an XText editor inside Papyrus in "Help / Help Contents / Papyrus Guide / Developer guide / Papyrus Integration with XText". Any feedback on this tutorial is welcome.

If you want to have access to the sources, you can have a look at the svn repository: svn://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyr us

From this location, sources for the textual property editor can be found following this path: Trunk / plugins / uml

Cheers,

Arnaud
Re: xtext Editor in Papyrus [message #636432 is a reply to message #635800] Mon, 01 November 2010 09:57 Go to previous messageGo to next message
Dani is currently offline DaniFriend
Messages: 41
Registered: October 2010
Member
Hi Arnaud,
its very good tutorial thank you very much for the help. if need to rate your tutorial its 10/10. thankss
Re: xtext Editor in Papyrus [message #652281 is a reply to message #635800] Thu, 03 February 2011 13:01 Go to previous messageGo to next message
Julien Deantoni is currently offline Julien DeantoniFriend
Messages: 45
Registered: July 2009
Member
Hello Arnaud,

I tried to follow the tutorial but I'm a little stuck now...

First I found that various classes referenced in the "message" example code have been deleted from the SVN (for instance org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/ed it/part/IEObjectContextUpdater.java, which is taken from an old revision on the head svn of papyrus)

I can try to launch my editor with a right click on a UML element (Comment in my case) and choosing edit Comment -> using MyComment editor.

However, when doing so, the "public IPopupEditorHelper createPopupEditorHelper(Object editPart)" method is not called and the editor is clearly not the one expected (big windows with only one line and no button). (This a method from my class that extends org.eclipse.xtext.gmf.glue.PopupEditorConfiguration)

I precise that I added the correct extension point with popup editor... but...

It seems that I'm doing something wrong... Have you got any idea ?
By the way, can you tell us what environment (papyrus and xtext revision / version) is expected to use the tutorial ?

thanks in advance,
regards,

julien
Re: xtext Editor in Papyrus [message #652401 is a reply to message #652281] Thu, 03 February 2011 18:27 Go to previous messageGo to next message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 34
Registered: April 2010
Member
Hello Julien,

The tutorial has been written on the basis of the following environment: Papyrus 0.7.0 + XText 1.0.1. The interface IEobjectContextUpdater has indeed been removed in more recent versions of Papyrus, and the tutorial would therefore require to be updated.

For the method "createPopupEditorHelper" to be called, you should perform a direct edit on the graphical element (e.g., in your example, once you have selected your comment in the diagram, you can press F2). Also, please note that if you want your own textual editor to be opened by pressing F2, Papyrus must be configured properly:
- Go to Window/Preferences/Papyrus/Embedded Editors from the menu
- In the window "Elements to edit", select "Comment"
- In the window "Associated editor", your editor should appear. Select it and make it your default editor for comments.
=> If you can't see "Comment" or your associated editor, there is probably a problem with the contribution to the extension point.

Could you please tell us if this works for you?

Best regards,

Arnaud
Re: xtext Editor in Papyrus [message #652492 is a reply to message #652401] Fri, 04 February 2011 09:46 Go to previous messageGo to next message
Julien Deantoni is currently offline Julien DeantoniFriend
Messages: 45
Registered: July 2009
Member
Hello !

So, I changed the default editor in the preference and the good code is now called Smile

However, I use Papyrus 0.8.0 and Xtext 1.0.2...
I checked out the old version of .....gmf.glue to be able to "copy" the code from your examples (to figure out what kind of code must be called in the createPopupEditorHelper)... I have problems with the temporary file in the showEditor() method... (cast problem)

I'm now going to try with the last svn version and give you feedback.

thanks for your answer,

julien
Re: xtext Editor in Papyrus [message #652953 is a reply to message #652401] Mon, 07 February 2011 18:03 Go to previous messageGo to next message
Julien Deantoni is currently offline Julien DeantoniFriend
Messages: 45
Registered: July 2009
Member
Hello Arnaud,

some quick news. I managed having the popup editor and it works well (syntax coloring, completion, etc).... until I close it.

I'm not able to propagate the changes in the model (I edit the body of a comment and just want to set the body with the new edited text)

I think this is a problem with the reconciler but I'm not sure. None of these two methods is called:
reconcile(EObject modelObject, EObject xtextObject)
CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1)


Do you have any idea / hint ?

thanks,

regards,

julien
Re: xtext Editor in Papyrus [message #652966 is a reply to message #652953] Mon, 07 February 2011 19:02 Go to previous messageGo to next message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 34
Registered: April 2010
Member
Hello Julien,

The method "reconcile" is called by PopupXtextEditorHelper::closeEditor(boolean isReconcile). If you have a look at this method, you will see that there are three normal cases where reconciliation does not happen:
- isReconcile == false => It is the case when you close the editor by pressing Esc, otherwise (ctrl+enter or focusLost) it is true.
- the edited text contains parsing errors (=> isDocumentHasErrors(xtextDocument) == true)
- the edited text contains semantic errors (=> semanticValidator.validate() == false)

I suspect that the problem comes from the semanticValidator, which is not documented in the tutorial. We have introduced it since the method isDocumentHasErrors (which was provided by XText) only considers parsing errors, and not the errors that you may have generated using the validation framework.

If you have not written your own semantic validator (or used the DefaultSemanticValidator which is provided in gmf.glue), you should check the type of the semanticValidator which is called in the method "closeEditor". I hope that this will solve your problem.

Best regards,

Arnaud.
Re: xtext Editor in Papyrus [message #653147 is a reply to message #652966] Tue, 08 February 2011 16:44 Go to previous messageGo to next message
Julien Deantoni is currently offline Julien DeantoniFriend
Messages: 45
Registered: July 2009
Member
Hello Arnaud,

thank you for your help !
It works fine now Smile

my problem was that the edited text contained parsing errors (=> isDocumentHasErrors(xtextDocument) == true) :-/

Thank you very much !

Best regards,

Julien

[Updated on: Tue, 08 February 2011 16:44]

Report message to a moderator

Re: xtext Editor in Papyrus [message #1385319 is a reply to message #653147] Thu, 05 June 2014 15:12 Go to previous message
Davincho Huevada is currently offline Davincho HuevadaFriend
Messages: 7
Registered: June 2014
Junior Member
Hi,
Is anyone keen to provide me with updated instructions of how to include a Xtext Editor into Papyrus.
Somehow my editor does not show up under Window/Preferences/Papyrus/Embedded Editors.
Thx & Cheers
Davincho
Previous Topic:Plugin for SOAML and problems witin BPMN plz
Next Topic:How to remove or hide edge decorations?
Goto Forum:
  


Current Time: Fri Nov 27 18:57:58 GMT 2020

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

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

Back to the top