How to programmatically new a java class which implements sepecified interface in eclipse plugin development

http://w3facility.org/question/how-to-programmatically-new-a-java-class-which-implements-sepecified-interface-in-eclipse-plugin-development/

 

OpenNewClassWizardAction wizard = new OpenNewClassWizardAction();

wizard.setOpenEditorOnFinish(false);

NewClassWizardPage page = new NewClassWizardPage();

page.setPackageFragmentRoot(sourceFolder, false);

wizard.setConfiguredWizardPage(page);

wizard.run();

return (IType) wizard.getCreatedElement();

 

add more here:

check which button use is clicked,

if finished button is clicked : wizard.getCreatedElement() will not return null ,otherwise it will return null value.

你可能感兴趣的:(eclipse plugin)