Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Inserting comments above a particular ASTNode
Inserting comments above a particular ASTNode [message #220059] Mon, 05 December 2005 18:53 Go to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
I'm trying to insert a comment before a particular ASTNode.

For example, I try to discover wherever a particular function or class is
used. Then I would like
to add a line comment just before that statement.

Any ideas on how to do that?

Thanks,

James.
Re: Inserting comments above a particular ASTNode [message #220167 is a reply to message #220059] Tue, 06 December 2005 17:54 Go to previous messageGo to next message
Markus KellerFriend
Messages: 294
Registered: July 2009
Senior Member
I assume you use an ASTRewrite. Then you can just create your comment with

astRewrite.createStringPlaceholder("//comment", ASTNode.EMPTY_STATEMENT)

and then insert this node in the statement list before the node to be
documented.

HTH
Markus


James Bruck wrote:

> I'm trying to insert a comment before a particular ASTNode.
>
> For example, I try to discover wherever a particular function or class is
> used. Then I would like
> to add a line comment just before that statement.
>
> Any ideas on how to do that?
>
> Thanks,
>
> James.
>
>
>
Re: Inserting comments above a particular ASTNode [message #220193 is a reply to message #220167] Tue, 06 December 2005 22:05 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Markus

Thanks for the reply.

Pardon the newbie question... but are you suggesting to get a ListRewrite
and then do a listRewrite.insertBefore() ?

When I attempt this I get exceptions ( after numerous attempts ).

Thanks again,

- James.





"Markus Keller" <markus_keller@ch.ibm.com> wrote in message
news:dn4j9p$v53$1@news.eclipse.org...
> I assume you use an ASTRewrite. Then you can just create your comment with
>
> astRewrite.createStringPlaceholder("//comment",
ASTNode.EMPTY_STATEMENT)
>
> and then insert this node in the statement list before the node to be
> documented.
>
> HTH
> Markus
>
>
> James Bruck wrote:
>
> > I'm trying to insert a comment before a particular ASTNode.
> >
> > For example, I try to discover wherever a particular function or class
is
> > used. Then I would like
> > to add a line comment just before that statement.
> >
> > Any ideas on how to do that?
> >
> > Thanks,
> >
> > James.
> >
> >
> >
Re: Inserting comments above a particular ASTNode [message #220208 is a reply to message #220193] Tue, 06 December 2005 22:37 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Markus,

It works!

Thanks.

- James.

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:dn510r$kl8$1@news.eclipse.org...
> Hi Markus
>
> Thanks for the reply.
>
> Pardon the newbie question... but are you suggesting to get a ListRewrite
> and then do a listRewrite.insertBefore() ?
>
> When I attempt this I get exceptions ( after numerous attempts ).
>
> Thanks again,
>
> - James.
>
>
>
>
>
> "Markus Keller" <markus_keller@ch.ibm.com> wrote in message
> news:dn4j9p$v53$1@news.eclipse.org...
> > I assume you use an ASTRewrite. Then you can just create your comment
with
> >
> > astRewrite.createStringPlaceholder("//comment",
> ASTNode.EMPTY_STATEMENT)
> >
> > and then insert this node in the statement list before the node to be
> > documented.
> >
> > HTH
> > Markus
> >
> >
> > James Bruck wrote:
> >
> > > I'm trying to insert a comment before a particular ASTNode.
> > >
> > > For example, I try to discover wherever a particular function or class
> is
> > > used. Then I would like
> > > to add a line comment just before that statement.
> > >
> > > Any ideas on how to do that?
> > >
> > > Thanks,
> > >
> > > James.
> > >
> > >
> > >
>
>
Previous Topic:Task tags priority and sorting
Next Topic:adding javadoc sources
Goto Forum:
  


Current Time: Fri Apr 19 22:57:24 GMT 2024

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

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

Back to the top