Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How does Eclipse automatically generate code?
How does Eclipse automatically generate code? [message #153664] Mon, 22 May 2006 09:10 Go to next message
Eclipse UserFriend
Originally posted by: smart_eclipser.yahoo.com

How does Eclipse automatically generate code?
For example, I've got the parameters like a package whose name is P, a
class whose name is C, an interface called I which is implemented by the
class C and has an abstract method named abs_f(). After I've got all these
parameters, how can I automatically generate the code like this:
package p;
public class C implements I
{
public void abs_f()
{
}
//The rest of the code...
}
Eclipse is so nice in generate such kind of codes, but how does it
implement this? I mean where is the corresponding code of Eclipse project
that implements this function?

Or does Eclipse leave any interfaces for developers to develop an plug-in
to automatically generate code? I'm new to Eclipse and if anyone know the
answer please do tell me. Thank you guys so much!!!
Re: How does Eclipse automatically generate code? [message #153679 is a reply to message #153664] Mon, 22 May 2006 11:00 Go to previous message
Eclipse UserFriend
Originally posted by: benno_baumgartner.ch.ibm.com

"Bryn" <smart_eclipser@yahoo.com> wrote in message
news:eb3e677dace1453a2202af1414c19684$1@www.eclipse.org...
>
> How does Eclipse automatically generate code?
> For example, I've got the parameters like a package whose name is P, a
> class whose name is C, an interface called I which is implemented by the
> class C and has an abstract method named abs_f(). After I've got all these
> parameters, how can I automatically generate the code like this:
> package p;
> public class C implements I
> {
> public void abs_f()
> {
> }
> //The rest of the code...
> }
> Eclipse is so nice in generate such kind of codes, but how does it
> implement this? I mean where is the corresponding code of Eclipse project
> that implements this function?
> Or does Eclipse leave any interfaces for developers to develop an plug-in
> to automatically generate code? I'm new to Eclipse and if anyone know the
> answer please do tell me. Thank you guys so much!!!

Hi

Have a look at org.eclipse.jdt.core.dom.rewrite.ASTRewrite as a starting
point. But I guess more interessting to you is
org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(IPro gressMonitor).
You may even be able to reuse this code by extending the NewTypeWizardPage.

HTH
Benno
Previous Topic:How to add Javadocs to editor popups/code assist?
Next Topic:problem with null layout
Goto Forum:
  


Current Time: Fri Sep 20 08:46:32 GMT 2024

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

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

Back to the top