Issue
I need to extend a rather simple existing code generator that generates a subclass to an existing class. Until now the base class was basically always the same well known class and the superclass based constructors were added through some fixed code.
A new use case involves inheriting from arbitrary classes where the superclass constructor signatures are not known in advance.
Eclipse has a great feature that does exactly what I need via a menu
command.
(Menu > Source > generate constructors from superclass...)
Is there any way I could just evoke that command programmatically (or rather create a tool based on that functionality that does the same in the given context)?
The Project I am working on is OSGI based. So I would expect it should be possible. What I basically need as a starting point is the Name of the OSGI package the includes the functionality and a link to the source code.
Thanks very much!
Solution
The class that does the add is
org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedConstructorsOperation
This is heavily based on the Eclipse JDT Abstract Syntax Tree code.
Also note that this is an internal class so it is not part of the official API and should not be used directly.
Answered By - greg-449
Answer Checked By - Marilyn (JavaFixing Volunteer)