Summary: | [api] make AddUnimplementedMethodsOperation and AddUnimplementedConstructorsOperation api | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Naci Dai <naci.dai> |
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
Status: | ASSIGNED --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P5 | CC: | cbridgha, daniel_megert, david_williams, kaloyan, markus.kell.r, martinae, ramanday |
Version: | 3.2 | Keywords: | api |
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 156173 |
Description
Naci Dai
2006-09-05 05:14:36 EDT
Adding david to CC This case is only relevant when there is an exising imports manager. Actions create operation sthat apply chnages to imports by default (i.e. we cannot set it to false, ar provide our own imports manager). A work around is to temporarily delegate the imports management to JDT, and when these operations are run, create a new imports manager to continue with. See bug 156173. Move to JDT/UI Naci, I have a question here, I was doing similar stuff in WTP 155 based code something like this IType type = javaProject.findType(qName); ASTParser parser= ASTParser.newParser(AST.JLS3); parser.setSource(type.getCompilationUnit()); parser.setResolveBindings(true); CompilationUnit astRoot= (CompilationUnit) parser.createAST(null); AbstractTypeDeclaration decl= (AbstractTypeDeclaration) astRoot.findDeclaringNode(type.getKey()); ITypeBinding binding= decl.resolveBinding(); IWorkspaceRunnable runnable = OverrideMethodsAction.createRunnable(astRoot, binding, null, -1, true); IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.run(runnable, new NullProgressMonitor()); However, I notice since OverrideMethodsAction.createRunnable sets save=false in the AddUnimplementedMethodsOperation constructor There is no way to save the contents of the class after the operation runs, I think this is a bug/unnecessary limitation, After the operation runs, it does not save the contents in the file so it appears as if the operation did not work. Right now the only way I can get that code to work is to have the file open in a editor, run the runnable/operation that dirties the file, and call IWorkbenchPage.saveEditor(IEditorPart, false); By the way I opened a separate bug 196340 to document the problem I mentioned earlier. the plan is to make AddUnimplementedMethodsOperation and AddUnimplementedConstructorsOperation API in jdt.core manipulations. With the imports, I would recommend you to commit your changes before OverrideMethodsAction.createRunnable is called, or set up a new one after. OverrideMethodsAction.createRunnable assumes that the CU it sees is the most current. If you have some changes pending this could lead to problems. The missing save when there are no editors open is an oversight. I'll fix it. Have to move to 3.5, unfortunately. Naci, do you still need this? 3.5 API frozen now. Please raise your voice if you would still need this. |