I want to create an Eclipse plugin which programmatically extends a set of classes through an Interface. For example, I want to make the class A:
class A {
// some code here
}
look like this
class A implements AnInterface {
// some code here
}
I got the IType and ICompilationUnit of all classes I want to extend with an interface but how do I do it? (There are only methods available in IType which let you create fields and other methods..)
Very much thanks in advance to whoever can help me here
Bernd
Creation of code using IType/ICompilationUnit and its methods are good if you have the complete code as part of string. If you look at ICompilation#CreateType(..), it takes the full contents of the class. You could either use this in your case or use ASTRewrite.