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 11:23 Go to next message
Mr Manner is currently offline Mr Manner
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 11:52 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
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 12:37 Go to previous messageGo to next message
Mr Manner is currently offline Mr Manner
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 12:55 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6125
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
Previous Topic:Dynamic Syntax Highlighting
Next Topic:writing to IXtextDocument
Goto Forum:
  


Current Time: Wed Jul 23 01:50:46 EDT 2014

Powered by FUDForum. Page generated in 0.02529 seconds