public CompilationUnit getRoot() { if (fRoot == null) fRoot= new RefactoringASTParser(AST.JLS3).parse(fCu, fOwner, fResolveBindings, fStatementsRecovery, fBindingsRecovery, null); return fRoot; }
public CompilationUnit getRoot() { if (fRoot == null) fRoot= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(fCu, fOwner, fResolveBindings, fStatementsRecovery, fBindingsRecovery, null); return fRoot; }
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { CompilationUnit rootNode = new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(fCUnit, true, pm); return checkActivationBasics(rootNode); }
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { CompilationUnit rootNode= new RefactoringASTParser(AST.JLS3).parse(fCUnit, true, pm); return checkActivationBasics(rootNode); }
public BodyDeclaration[] getAffectedBodyDeclarations(ICompilationUnit unit, IProgressMonitor pm) { ASTNode root= new RefactoringASTParser(AST.JLS3).parse(unit, true); InvocationFinder finder= new InvocationFinder(fMethodBinding); root.accept(finder); fCurrentBodies= finder.result; Set result= fCurrentBodies.keySet(); fastDone(pm); return (BodyDeclaration[])result.toArray(new BodyDeclaration[result.size()]); }
private static Collection<SearchMatch> getAllSuperConstructorInvocations(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); CompilationUnit cuNode= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(type.getCompilationUnit(), false); List<SearchMatch> result= new ArrayList<>(constructors.length); for (int i= 0; i < constructors.length; i++) { ASTNode superCall= getSuperConstructorCallNode(constructors[i], cuNode); if (superCall != null) result.add(createSearchResult(superCall, constructors[i])); } return result; }
private static Collection getAllSuperConstructorInvocations(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); CompilationUnit cuNode= new RefactoringASTParser(AST.JLS3).parse(type.getCompilationUnit(), false); List result= new ArrayList(constructors.length); for (int i= 0; i < constructors.length; i++) { ASTNode superCall= getSuperConstructorCallNode(constructors[i], cuNode); if (superCall != null) result.add(createSearchResult(superCall, constructors[i])); } return result; }
void initialize(IType type) throws JavaModelException { RefactoringASTParser parser= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL); fUnit= parser.parse(type.getCompilationUnit(), true); fTypeBinding= null; // type cannot be anonymous final AbstractTypeDeclaration declaration= ASTNodes.getParent(NodeFinder.perform(fUnit, type.getNameRange()), AbstractTypeDeclaration.class); if (declaration != null) fTypeBinding= declaration.resolveBinding(); }
void initialize(IType type) throws JavaModelException { RefactoringASTParser parser= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL); fUnit= parser.parse(type.getCompilationUnit(), true); fTypeBinding= null; // type cannot be anonymous final AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(NodeFinder.perform(fUnit, type.getNameRange()), AbstractTypeDeclaration.class); if (declaration != null) fTypeBinding= declaration.resolveBinding(); }
public AddUnimplementedConstructorsContentProvider(IType type) throws JavaModelException { RefactoringASTParser parser= new RefactoringASTParser(AST.JLS3); fUnit= parser.parse(type.getCompilationUnit(), true); AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(NodeFinder.perform(fUnit, type.getNameRange()), AbstractTypeDeclaration.class); if (declaration != null) { ITypeBinding binding= declaration.resolveBinding(); if (binding != null) fMethodsList= StubUtility2.getVisibleConstructors(binding, true, false); } }
private void initialize(IType type) throws JavaModelException { RefactoringASTParser parser= new RefactoringASTParser(AST.JLS3); fUnit= parser.parse(type.getCompilationUnit(), true); fTypeBinding= null; // type cannot be anonymous final AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(NodeFinder.perform(fUnit, type.getNameRange()), AbstractTypeDeclaration.class); if (declaration != null) fTypeBinding= declaration.resolveBinding(); fCandidateFields= fTypeBinding.getDeclaredFields(); }
public AddUnimplementedConstructorsContentProvider(IType type) throws JavaModelException { RefactoringASTParser parser= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL); fUnit= parser.parse(type.getCompilationUnit(), true); AbstractTypeDeclaration declaration= ASTNodes.getParent(NodeFinder.perform(fUnit, type.getNameRange()), AbstractTypeDeclaration.class); if (declaration != null) { ITypeBinding binding= declaration.resolveBinding(); if (binding != null) fMethodsList= StubUtility2Core.getVisibleConstructors(binding, true, false); } }
public AddUnimplementedConstructorsContentProvider(IType type) throws JavaModelException { RefactoringASTParser parser= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL); fUnit= parser.parse(type.getCompilationUnit(), true); AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(NodeFinder.perform(fUnit, type.getNameRange()), AbstractTypeDeclaration.class); if (declaration != null) { ITypeBinding binding= declaration.resolveBinding(); if (binding != null) fMethodsList= StubUtility2.getVisibleConstructors(binding, true, false); } }
private void checkNewSource(SubProgressMonitor monitor, RefactoringStatus result) throws CoreException { String newCuSource = fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode = new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(newCuSource, fCu, true, true, monitor); IProblem[] newProblems = RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCompilationUnitNode); for (int i = 0; i < newProblems.length; i++) { IProblem problem = newProblems[i]; if (problem.isError()) { result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } } }
private void checkNewSource(SubProgressMonitor monitor, RefactoringStatus result) throws CoreException { String newCuSource= fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(newCuSource, fCu, true, true, monitor); IProblem[] newProblems= RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCompilationUnitNode); for (int i= 0; i < newProblems.length; i++) { IProblem problem= newProblems[i]; if (problem.isError()) result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } }
private void checkSource(SubProgressMonitor monitor, RefactoringStatus result) throws CoreException { String newCuSource = fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode = new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(newCuSource, fCu, true, true, monitor); IProblem[] newProblems = RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCuRewrite.getRoot()); for (int i = 0; i < newProblems.length; i++) { IProblem problem = newProblems[i]; if (problem.isError()) { result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } } }
private void checkSource(SubProgressMonitor monitor, RefactoringStatus result) throws CoreException { String newCuSource= fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(newCuSource, fCu, true, true, monitor); IProblem[] newProblems= RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCuRewrite.getRoot()); for (int i= 0; i < newProblems.length; i++) { IProblem problem= newProblems[i]; if (problem.isError()) result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } }
private void checkSource(SubProgressMonitor monitor, RefactoringStatus result) throws CoreException { String newCuSource= fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(newCuSource, fCu, true, true, monitor); IProblem[] newProblems= RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCuRewrite.getRoot()); for (int i= 0; i < newProblems.length; i++) { IProblem problem= newProblems[i]; if (problem.isError()) result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } }
/** * Apply all changes related to a single ICompilationUnit */ private void addAllChangesFor(ICompilationUnit icu, Set vars, CompilationUnitChange unitChange) throws CoreException { CompilationUnit unit= new RefactoringASTParser(AST.JLS3).parse(icu, false); ASTRewrite unitRewriter= ASTRewrite.create(unit.getAST()); MultiTextEdit root= new MultiTextEdit(); unitChange.setEdit(root); // Adam sez don't need this, but then unitChange.addGroupDescription() fails an assertion! String typeName= updateImports(unit, root); updateCu(unit, vars, unitChange, unitRewriter, typeName); root.addChild(unitRewriter.rewriteAST()); }
private void checkNewSource(RefactoringStatus result) throws CoreException { String newCuSource= fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode= new RefactoringASTParser(AST.JLS3).parse(newCuSource, fCu, true, true, null); IProblem[] newProblems= RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCompilationUnitNode); for (int i= 0; i < newProblems.length; i++) { IProblem problem= newProblems[i]; if (problem.isError()) result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, new SourceRange(problem)))); } }