public static boolean isListRewriteOnGeneratedNode(org.eclipse.jdt.core.dom.rewrite.ListRewrite rewrite) { return isGenerated(rewrite.getParent()); }
/** * Removes an existing accessor method. * * @param accessor the accessor method to remove * @param rewrite the list rewrite to use * @throws JavaModelException if an error occurs */ private void removeExistingAccessor(final IMethod accessor, final ListRewrite rewrite) throws JavaModelException { final MethodDeclaration declaration= ASTNodes.getParent(NodeFinder.perform(rewrite.getParent().getRoot(), accessor.getNameRange()), MethodDeclaration.class); if (declaration != null) rewrite.remove(declaration, null); }
/** * Removes an existing accessor method. * * @param accessor the accessor method to remove * @param rewrite the list rewrite to use * @throws JavaModelException if an error occurs */ private void removeExistingAccessor(final IMethod accessor, final ListRewrite rewrite) throws JavaModelException { final MethodDeclaration declaration= (MethodDeclaration) ASTNodes.getParent(NodeFinder.perform(rewrite.getParent().getRoot(), accessor.getNameRange()), MethodDeclaration.class); if (declaration != null) rewrite.remove(declaration, null); }
/** * Removes an existing accessor method. * * @param accessor the accessor method to remove * @param rewrite the list rewrite to use * @throws JavaModelException if an error occurs */ private void removeExistingAccessor(final IMethod accessor, final ListRewrite rewrite) throws JavaModelException { final MethodDeclaration declaration= (MethodDeclaration) ASTNodes.getParent(NodeFinder.perform(rewrite.getParent().getRoot(), accessor.getNameRange()), MethodDeclaration.class); if (declaration != null) rewrite.remove(declaration, null); }
if (trackedFallback == null) { trackedFallback= fModifierRewrite.getASTRewrite().track(fModifierRewrite.getParent());
if (trackedFallback == null) { trackedFallback = fModifierRewrite.getASTRewrite().track(fModifierRewrite.getParent());
if (trackedFallback == null) { trackedFallback= fModifierRewrite.getASTRewrite().track(fModifierRewrite.getParent());
AST ast= rewriter.getAST(); ImportRewriteContext context= null; ASTNode bodyDeclaration= ASTResolving.findParentBodyDeclaration(listRewriter.getParent()); if (bodyDeclaration != null) { context= new ContextSensitiveImportRewriteContext(bodyDeclaration, getImportRewrite());
AST ast= rewriter.getAST(); ImportRewriteContext context= null; ASTNode bodyDeclaration= ASTResolving.findParentBodyDeclaration(listRewriter.getParent()); if (bodyDeclaration != null) { context= new ContextSensitiveImportRewriteContext(bodyDeclaration, getImportRewrite());
/** * Generates a new getter method for the specified field * * @param field the field * @param rewrite the list rewrite to use * @throws CoreException if an error occurs * @throws OperationCanceledException if the operation has been cancelled */ private void generateGetterMethod(final IField field, final ListRewrite rewrite) throws CoreException, OperationCanceledException { final IType type= field.getDeclaringType(); final String name= GetterSetterUtil.getGetterName(field, null); final IMethod existing= JavaModelUtil.findMethod(name, EMPTY_STRINGS, false, type); if (existing == null || !querySkipExistingMethods(existing)) { IJavaElement sibling= null; if (existing != null) { sibling= StubUtility.findNextSibling(existing); removeExistingAccessor(existing, rewrite); } else sibling= fInsert; ASTNode insertion= null; if (sibling instanceof IMethod) insertion= ASTNodes.getParent(NodeFinder.perform(rewrite.getParent().getRoot(), ((IMethod) fInsert).getNameRange()), MethodDeclaration.class); addNewAccessor(type, field, GetterSetterUtil.getGetterStub(field, name, fSettings.createComments, fVisibility | (field.getFlags() & Flags.AccStatic)), rewrite, insertion); } }