Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Removing hidden nodes via API
Removing hidden nodes via API [message #1005633] Sun, 27 January 2013 15:38 Go to next message
Pawel Pogorzelski is currently offline Pawel Pogorzelski
Messages: 26
Registered: July 2009
Junior Member
I need to implement an action that strips all the comments in the open editor. Comments are marked as hidden in the grammar. Any clue on how to do this?

Thanks,
Pawel
Re: Removing hidden nodes via API [message #1005675 is a reply to message #1005633] Mon, 28 January 2013 03:58 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Here is roughly what you have to do inside such an action
-Iterate the node model (XtextResource.getParseResult().getRootNode())
-Find those nodes belonging to the comment rule (node.getGrammarElement())
-Compose a MultiTextEdit with ReplaceEdits for the code segments of the
comments
-apply the MultiTextEdit to the document

Am 27.01.13 21:38, schrieb Pawel Pogorzelski:
> I need to implement an action that strips all the comments in the open
> editor. Comments are marked as hidden in the grammar. Any clue on how to
> do this?
>
> Thanks,
> Pawel


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Removing hidden nodes via API [message #1005704 is a reply to message #1005675] Mon, 28 January 2013 05:58 Go to previous message
Pawel Pogorzelski is currently offline Pawel Pogorzelski
Messages: 26
Registered: July 2009
Junior Member
Thanks Jan.

Pawel
Previous Topic:Noobie Q: Problem to run the Generated IDE Plug-in of my DSL (Xtext) with Eclipse Juno.
Next Topic:ParserBasedContentAssistContextFactory.StatefulFactory mixing instances of the same grammar
Goto Forum:
  


Current Time: Fri Aug 22 00:17:47 EDT 2014

Powered by FUDForum. Page generated in 0.01873 seconds