Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to apply change to source code?(jdt AST write back to source.)
How to apply change to source code? [message #715932] Tue, 16 August 2011 03:20
Eclipse UserFriend
I want to customize new class wizard, so I new a subclass of org.eclipse.jdt.ui.wizards.NewTypeWizardPage, and plan to add some code in original code which generated by org.eclipse.jdt.ui.wizards.NewTypeWizardPage. I think @Override
protected void createTypeMembers(IType newType, ImportsManager imports,
IProgressMonitor monitor) throws CoreException { is a point.
so I rewrite this method.
createInheritedMethods(newType, false, true, imports,
new SubProgressMonitor(monitor, 1));
ICompilationUnit cu = newType.getCompilationUnit();
CompilationUnit unit = SourceGenerator.merge(cu, getPackageText(), getTypeName(),
getAuthority(), getDatabase(), tableCreators);
So, var cu is original source, unit is merged source, they are individuals.
But I don't known how to apply changes to cu, after wizard finished, the contents of source is cu not unit.
Previous Topic:How can I comment out a method?
Next Topic:F_PRIMARY_WORKING_COPY: should this flag be set when opening the editor?
Goto Forum:
  


Current Time: Tue Feb 11 03:16:52 GMT 2025

Powered by FUDForum. Page generated in 0.03005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top