How does Eclipse automatically generate code? [message #153664] |
Mon, 22 May 2006 05:10  |
Eclipse User |
|
|
|
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 07:00  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.08540 seconds