Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Get text from texteditor
Get text from texteditor [message #1006739] Fri, 01 February 2013 16:23 Go to next message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
How can I get the text from the texteditor as a string. I have to validate the entire content of the text editor.
I should be able to get the content based on an EObject.

Thanks
Re: Get text from texteditor [message #1006758 is a reply to message #1006739] Fri, 01 February 2013 16:52 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2013-01-02 17:23, Mr Manner wrote:
> How can I get the text from the texteditor as a string. I have to
> validate the entire content of the text editor.
> I should be able to get the content based on an EObject.
>
> Thanks

That sounds a bit strange, not sure what you mean - you typically
validate the model, or you would have to parse the text again...

You can get the text of any semantic object by finding the corresponding
Node and then getting the text from that.

You can get the text from the editor/document itself.

etc.

Answer depends on what you are trying to do, when and why.

Regards
- henrik
Re: Get text from texteditor [message #1006765 is a reply to message #1006758] Fri, 01 February 2013 17:37 Go to previous messageGo to next message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
I try to clarify with an example:
Take this validator:

	@Check
	public void checkTotalText(Object object) {
                String text = get_text_that_object_is_part_of();
		SomethingNotRelatedToXText.validate(text);
		}
	}


I want to know "how" to get this text based on the EObject object.
If I can get this text from the editor/document then how can I get to the editor/document starting from object.
I am using a validator that is not rela`ted to xtext and does not fit its model, I'll need to call this validator for some EObject types.

Thanks
Re: Get text from texteditor [message #1006766 is a reply to message #1006765] Fri, 01 February 2013 17:55 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi have a look AT nodemodelutils

--
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
Previous Topic:Dynamic Syntax Highlighting
Next Topic:writing to IXtextDocument
Goto Forum:
  


Current Time: Fri Apr 19 16:36:40 GMT 2024

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

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

Back to the top