Krt_Malta
Krt_Malta

Reputation: 9465

Code generation in Eclipse plug-in

I'm developing an Eclipse plug-in and I'd like to insert code automatically... sort of create a sample application automatically when the user presses a button. How can I go about it please?

Thanks and regards, Krt_Malta

Upvotes: 1

Views: 450

Answers (4)

Krt_Malta
Krt_Malta

Reputation: 9465

This helped me out a lot:

http://sdqweb.ipd.kit.edu/wiki/JDT_Tutorial:_Creating_Eclipse_Java_Projects_Programmatically

Using it you can create projects, packages and classes programatically. With some additional code, you could import libraries into the project files programmatically.

Upvotes: 0

Fabian Steeg
Fabian Steeg

Reputation: 45754

A pretty straightforward approach to code generation in Eclipse are Java Emitter Templates. If your use case involves EMF, you could consider Xpand. And there are other options in the Eclipse M2T project.

Upvotes: 0

Zoltán Ujhelyi
Zoltán Ujhelyi

Reputation: 13858

If you want to create a project/files, then you have to use the Resource API of Eclipse. For some initial ideas look at http://www.phurnace.com/blog/the-eclipse-resources-plug-in-2.html.

In a similar fashion you could look for existing files and read them.

Upvotes: 0

Related Questions