Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » new variable "method_name" for Code Generator?
new variable "method_name" for Code Generator? [message #154868] Sat, 17 April 2004 22:45 Go to next message
Eclipse UserFriend
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi all, I have a suggestion / feature request for
Eclipse, and wanted to run it by the community here
and see what the reaction was. Or possibly find out
that there is already a way to accomplish what I'm
trying to do.

Specifically, I would like to suggest adding a variable
called method_name to the list of variables available
for code generation templates, which would resolve to
the name of the method being created. The purpose of
this would be to allow templates such as this:

${todo} Auto-generated method stuf
throw new RuntimeException( "${method_name} not implemented yet" );

Personally I prefer for stubbed up methods to throw such
an exception, as opposed to just returning null. However,
unless I'm missing something, there currently is no easy
way for me to auto generate such a stub implementation.

Comments / feedback / flames welcome... or, if it turns
out that there IS a way to do this already, and I'm
just ignorant of it, I'd appreciate any suggestions on
how to do so.

Thanks,

Phillip Rhodes
Re: new variable "method_name" for Code Generator? [message #155243 is a reply to message #154868] Tue, 20 April 2004 15:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mrBob.yahoo.com

I think ${enclosing_method} is what you are looking for.

/J

"Phillip Rhodes" <mindcrime@cpphacker.co.uk> wrote in message
news:c5spih$arb$1@eclipse.org...
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
>
> Hi all, I have a suggestion / feature request for
> Eclipse, and wanted to run it by the community here
> and see what the reaction was. Or possibly find out
> that there is already a way to accomplish what I'm
> trying to do.
>
> Specifically, I would like to suggest adding a variable
> called method_name to the list of variables available
> for code generation templates, which would resolve to
> the name of the method being created. The purpose of
> this would be to allow templates such as this:
>
> ${todo} Auto-generated method stuf
> throw new RuntimeException( "${method_name} not implemented yet" );
>
> Personally I prefer for stubbed up methods to throw such
> an exception, as opposed to just returning null. However,
> unless I'm missing something, there currently is no easy
> way for me to auto generate such a stub implementation.
>
> Comments / feedback / flames welcome... or, if it turns
> out that there IS a way to do this already, and I'm
> just ignorant of it, I'd appreciate any suggestions on
> how to do so.
>
> Thanks,
>
> Phillip Rhodes
>
Re: new variable "method_name" for Code Generator? [message #155290 is a reply to message #155243] Tue, 20 April 2004 23:11 Go to previous message
Eclipse UserFriend
Mr Bob Dobolina wrote:

> I think ${enclosing_method} is what you are looking for.
>

D'oh!!!! I don't know how the heck I overlooked that,
but you're absolutely right... that's exactly what
I was looking for...

Although... it would be nice to have a variable that
expands to the full signature (minus return type)
of the method. So if I use Eclipse's code generator
to implement a bunch of stubs for an interface,
and there are overloaded versions, my "not implemented yet"
message would show me exactly which overload isn't
implemented yet.

TTYL,

Phil
Previous Topic:cannot get eclipse to open a local file
Next Topic:Working on existing projects with Eclipse
Goto Forum:
  


Current Time: Mon Jul 14 22:45:53 EDT 2025

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

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

Back to the top