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.
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.
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.