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 20:38 Go to next message
Pawel Pogorzelski is currently offline Pawel PogorzelskiFriend
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 08:58 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 658
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 10:58 Go to previous message
Pawel Pogorzelski is currently offline Pawel PogorzelskiFriend
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 Nov 28 22:16:15 GMT 2014

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

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