|
|
|
Re: Column oriented editors [message #762867 is a reply to message #762851] |
Thu, 08 December 2011 13:28  |
Eclipse User |
|
|
|
On 2011-08-12 18:51, Jeff MAURY wrote:
> Do you mean in the EMF generated model ?
> I can figure out where the info is ?
> Do you have a sample ?
>
When the text is parsed it builds a node model. It is separate from the
the semantic model, and you can find the node model by using the
NodeModelUtils class (nodes are attached to the semantic model elements
via EMF adapters) - the utils makes it easy to find things.
The closest thing I have written is the comment processing for
cloudsmith/geppetto (at github). You would be doing something similar,
to find the beginning of a line.
Look at
org.cloudsmith.geppetto.pp.dsl.linking.DocumentationAssociator.processCommentNode(INode,
List<PPTask>) as an example.
Basically, the brute force method is:
- get the text of the resource as a string
- for each element to validate, use util to get the node
- get start offset for the node
- scan backwards in the text from the start offset (until start or NL)
- offset diff is the column
You also have to deal with the formatter - it is important that your
model serializes correctly or you will not be able to produce valid
source from model (which is required if you want to perform certain
operations like semantic quick fix). (i.e. if formatting does not place
things where they are required to be, you will get error markers as side
effect of formatting).
Hope that helps.
- henrik
|
|
|
Powered by
FUDForum. Page generated in 0.05609 seconds