public CompilationUnit getRoot() { if (fRoot == null) fRoot= new RefactoringASTParser(AST.JLS3).parse(fCu, fOwner, fResolveBindings, fStatementsRecovery, fBindingsRecovery, null); return fRoot; }
private CompilationUnit getASTRoot() { if (fASTRoot == null) { fASTRoot= RefactoringASTParser.parseWithASTProvider(fCu, true, null); } return fASTRoot; }
@Override protected ASTParser createParser(IJavaProject project) { ASTParser result= createCleanUpASTParser(); result.setProject(project); Map<String, String> options= RefactoringASTParser.getCompilerOptions(project); options.putAll(fCleanUpOptions); result.setCompilerOptions(options); return result; } };
for (int index= 0; index < nodes.length; index++) { node= nodes[index]; project= RefactoringASTParser.getCompilationUnit(node).getJavaProject(); if (project != null) { method= getReferencingMethod(node);
public CastVariable2 makeCastVariable(CastExpression castExpression, ConstraintVariable2 expressionCv) { ITypeBinding typeBinding= castExpression.resolveTypeBinding(); ICompilationUnit cu= RefactoringASTParser.getCompilationUnit(castExpression); CompilationUnitRange range= new CompilationUnitRange(cu, castExpression); CastVariable2 castCv= new CastVariable2(createTType(typeBinding), range, expressionCv); fCastVariables.add(castCv); return castCv; }
public CompilationUnit getRoot() { if (fRoot == null) fRoot= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(fCu, fOwner, fResolveBindings, fStatementsRecovery, fBindingsRecovery, null); return fRoot; }
private CompilationUnit getASTRoot() { if (fASTRoot == null) { fASTRoot= RefactoringASTParser.parseWithASTProvider(fCu, true, null); } return fASTRoot; }
@Override protected ASTParser createParser(IJavaProject project) { ASTParser result= createCleanUpASTParser(); result.setProject(project); Map<String, String> options= RefactoringASTParser.getCompilerOptions(project); options.putAll(fCleanUpOptions); result.setCompilerOptions(options); return result; } };
public CastVariable2 makeCastVariable(CastExpression castExpression, ConstraintVariable2 expressionCv) { ITypeBinding typeBinding= castExpression.resolveTypeBinding(); ICompilationUnit cu= RefactoringASTParser.getCompilationUnit(castExpression); CompilationUnitRange range= new CompilationUnitRange(cu, castExpression); CastVariable2 castCv= new CastVariable2(createTType(typeBinding), range, expressionCv); fCastVariables.add(castCv); return castCv; }
public CompilationUnit getRoot() { if (fRoot == null) fRoot= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(fCu, fOwner, fResolveBindings, fStatementsRecovery, fBindingsRecovery, null); return fRoot; }
private CompilationUnit getASTRoot() { if (fASTRoot == null) { fASTRoot= RefactoringASTParser.parseWithASTProvider(fCu, true, null); } return fASTRoot; }
/** * @param newCfSource the source * @param originalCf the class file to get the name and project from * @param resolveBindings whether bindings are to be resolved * @param statementsRecovery whether statements recovery should be enabled * @param pm an {@link IProgressMonitor}, or <code>null</code> * @return the parsed CompilationUnit */ public CompilationUnit parse(String newCfSource, IClassFile originalCf, boolean resolveBindings, boolean statementsRecovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(statementsRecovery); fParser.setSource(newCfSource.toCharArray()); String cfName= originalCf.getElementName(); fParser.setUnitName(cfName.substring(0, cfName.length() - 6) + JavaModelUtil.DEFAULT_CU_SUFFIX); fParser.setProject(originalCf.getJavaProject()); fParser.setCompilerOptions(getCompilerOptions(originalCf)); CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm); return newCUNode; }
public CastVariable2 makeCastVariable(CastExpression castExpression, ConstraintVariable2 expressionCv) { ITypeBinding typeBinding= castExpression.resolveTypeBinding(); ICompilationUnit cu= RefactoringASTParser.getCompilationUnit(castExpression); CompilationUnitRange range= new CompilationUnitRange(cu, castExpression); CastVariable2 castCv= new CastVariable2(createTType(typeBinding), range, expressionCv); fCastVariables.add(castCv); return castCv; }
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { CompilationUnit rootNode = new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(fCUnit, true, pm); return checkActivationBasics(rootNode); }
private void initAST(IProgressMonitor pm){ if (fCompilationUnitNode == null) { fCompilationUnitNode= RefactoringASTParser.parseWithASTProvider(fCu, true, pm); fTempDeclarationNode= TempDeclarationFinder.findTempDeclaration(fCompilationUnitNode, fSelectionStart, fSelectionLength); } }
/** * @param newCfSource the source * @param originalCf the class file to get the name and project from * @param resolveBindings whether bindings are to be resolved * @param recovery whether statements and binding recovery should be enabled * @param pm an {@link IProgressMonitor}, or <code>null</code> * @return the parsed CompilationUnit */ public CompilationUnit parse(String newCfSource, IClassFile originalCf, boolean resolveBindings, boolean recovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(recovery); fParser.setBindingsRecovery(recovery); fParser.setSource(newCfSource.toCharArray()); String cfName= originalCf.getElementName(); fParser.setUnitName(cfName.substring(0, cfName.length() - 6) + JavaModelUtil.DEFAULT_CU_SUFFIX); fParser.setProject(originalCf.getJavaProject()); fParser.setCompilerOptions(getCompilerOptions(originalCf)); CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm); return newCUNode; }
/** * Returns the method which references the specified ast node. * * @param node * the ast node * @return the referencing method * @throws JavaModelException * if an error occurs */ protected final IMethod getReferencingMethod(final ASTNode node) throws JavaModelException { if (node instanceof Type) { final BodyDeclaration parent= (BodyDeclaration) ASTNodes.getParent(node, BodyDeclaration.class); if (parent instanceof MethodDeclaration) { final IMethodBinding binding= ((MethodDeclaration) parent).resolveBinding(); if (binding != null) { final ICompilationUnit unit= RefactoringASTParser.getCompilationUnit(node); final IJavaElement element= unit.getElementAt(node.getStartPosition()); if (element instanceof IMethod) return (IMethod) element; } } } return null; }
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { CompilationUnit rootNode= new RefactoringASTParser(IASTSharedValues.SHARED_AST_LEVEL).parse(fCUnit, true, pm); return checkActivationBasics(rootNode); }
private void initAST(IProgressMonitor pm){ if (fCompilationUnitNode == null) { fCompilationUnitNode= RefactoringASTParser.parseWithASTProvider(fCu, true, pm); fTempDeclarationNode= TempDeclarationFinder.findTempDeclaration(fCompilationUnitNode, fSelectionStart, fSelectionLength); } }
/** * @param newCfSource the source * @param originalCf the class file to get the name and project from * @param resolveBindings whether bindings are to be resolved * @param recovery whether statements and binding recovery should be enabled * @param pm an {@link IProgressMonitor}, or <code>null</code> * @return the parsed CompilationUnit */ public CompilationUnit parse(String newCfSource, IClassFile originalCf, boolean resolveBindings, boolean recovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(recovery); fParser.setBindingsRecovery(recovery); fParser.setSource(newCfSource.toCharArray()); String cfName= originalCf.getElementName(); fParser.setUnitName(cfName.substring(0, cfName.length() - 6) + JavaModelUtil.DEFAULT_CU_SUFFIX); fParser.setProject(originalCf.getJavaProject()); fParser.setCompilerOptions(getCompilerOptions(originalCf)); CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm); return newCUNode; }