@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; } };
@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; } };
/** * @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; }
private static CompilationUnit getCuNode(WorkingCopyOwner workingCopyOwner, ICompilationUnit cu) { ASTParser p = ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL); p.setSource(cu); p.setResolveBindings(true); p.setWorkingCopyOwner(workingCopyOwner); p.setCompilerOptions(RefactoringASTParser.getCompilerOptions(cu)); return (CompilationUnit) p.createAST(null); }
private static CompilationUnit getCuNode(WorkingCopyOwner workingCopyOwner, ICompilationUnit cu) { ASTParser p = ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL); p.setSource(cu); p.setResolveBindings(true); p.setWorkingCopyOwner(workingCopyOwner); p.setCompilerOptions(RefactoringASTParser.getCompilerOptions(cu)); return (CompilationUnit) p.createAST(null); }
private static CompilationUnit getCuNode(WorkingCopyOwner workingCopyOwner, ICompilationUnit cu) { ASTParser p = ASTParser.newParser(AST.JLS3); p.setSource(cu); p.setResolveBindings(true); p.setWorkingCopyOwner(workingCopyOwner); p.setCompilerOptions(RefactoringASTParser.getCompilerOptions(cu)); return (CompilationUnit) p.createAST(null); }
/** * @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; }
/** * @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; }
private CompilationUnit createAst(ICompilationUnit unit, Map<String, String> cleanUpOptions, IProgressMonitor monitor) { IJavaProject project= unit.getJavaProject(); if (compatibleOptions(project, cleanUpOptions)) { CompilationUnit ast= SharedASTProviderCore.getAST(unit, SharedASTProviderCore.WAIT_NO, monitor); if (ast != null) return ast; } ASTParser parser= CleanUpRefactoring.createCleanUpASTParser(); parser.setSource(unit); Map<String, String> compilerOptions= RefactoringASTParser.getCompilerOptions(unit.getJavaProject()); compilerOptions.putAll(cleanUpOptions); parser.setCompilerOptions(compilerOptions); return (CompilationUnit)parser.createAST(monitor); }
private CompilationUnit createAst(ICompilationUnit unit, Map<String, String> cleanUpOptions, IProgressMonitor monitor) { IJavaProject project= unit.getJavaProject(); if (compatibleOptions(project, cleanUpOptions)) { CompilationUnit ast= SharedASTProvider.getAST(unit, SharedASTProvider.WAIT_NO, monitor); if (ast != null) return ast; } ASTParser parser= CleanUpRefactoring.createCleanUpASTParser(); parser.setSource(unit); Map<String, String> compilerOptions= RefactoringASTParser.getCompilerOptions(unit.getJavaProject()); compilerOptions.putAll(cleanUpOptions); parser.setCompilerOptions(compilerOptions); return (CompilationUnit)parser.createAST(monitor); }
public CompilationUnit parse(ITypeRoot typeRoot, WorkingCopyOwner owner, boolean resolveBindings, boolean statementsRecovery, boolean bindingsRecovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(statementsRecovery); fParser.setBindingsRecovery(bindingsRecovery); fParser.setSource(typeRoot); if (owner != null) fParser.setWorkingCopyOwner(owner); fParser.setCompilerOptions(getCompilerOptions(typeRoot)); CompilationUnit result= (CompilationUnit) fParser.createAST(pm); return result; }
public CompilationUnit parse(ITypeRoot typeRoot, WorkingCopyOwner owner, boolean resolveBindings, boolean statementsRecovery, boolean bindingsRecovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(statementsRecovery); fParser.setBindingsRecovery(bindingsRecovery); fParser.setSource(typeRoot); if (owner != null) fParser.setWorkingCopyOwner(owner); fParser.setCompilerOptions(getCompilerOptions(typeRoot)); CompilationUnit result= (CompilationUnit) fParser.createAST(pm); return result; }
public CompilationUnit parse(ITypeRoot typeRoot, WorkingCopyOwner owner, boolean resolveBindings, boolean statementsRecovery, boolean bindingsRecovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(statementsRecovery); fParser.setBindingsRecovery(bindingsRecovery); fParser.setSource(typeRoot); if (owner != null) fParser.setWorkingCopyOwner(owner); fParser.setCompilerOptions(getCompilerOptions(typeRoot)); CompilationUnit result= (CompilationUnit) fParser.createAST(pm); return result; }
parser.setResolveBindings(true); parser.setProject(project); parser.setCompilerOptions(RefactoringASTParser.getCompilerOptions(project)); parser.createASTs(new ICompilationUnit[] { copy}, new String[0], new ASTRequestor() {
parser.setResolveBindings(true); parser.setProject(project); parser.setCompilerOptions(RefactoringASTParser.getCompilerOptions(project)); parser.createASTs(new ICompilationUnit[] { copy}, new String[0], new ASTRequestor() {
parser.setResolveBindings(true); parser.setProject(project); parser.setCompilerOptions(RefactoringASTParser.getCompilerOptions(project)); parser.createASTs(new ICompilationUnit[] { copy}, new String[0], new ASTRequestor() {
/** * @param newCuSource the source * @param originalCu the compilation unit 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 newCuSource, ICompilationUnit originalCu, boolean resolveBindings, boolean statementsRecovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(statementsRecovery); fParser.setSource(newCuSource.toCharArray()); fParser.setUnitName(originalCu.getElementName()); fParser.setProject(originalCu.getJavaProject()); fParser.setCompilerOptions(getCompilerOptions(originalCu)); CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm); return newCUNode; }
private CompilationUnit createAst(ICompilationUnit unit, Map cleanUpOptions, IProgressMonitor monitor) { IJavaProject project= unit.getJavaProject(); if (compatibleOptions(project, cleanUpOptions)) { CompilationUnit ast= ASTProvider.getASTProvider().getAST(unit, ASTProvider.WAIT_NO, monitor); if (ast != null) return ast; } ASTParser parser= ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL); parser.setResolveBindings(true); parser.setProject(project); parser.setSource(unit); Map compilerOptions= RefactoringASTParser.getCompilerOptions(unit.getJavaProject()); compilerOptions.putAll(cleanUpOptions); parser.setCompilerOptions(compilerOptions); return (CompilationUnit)parser.createAST(monitor); }
/** * @param newCuSource the source * @param originalCu the compilation unit 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 newCuSource, ICompilationUnit originalCu, boolean resolveBindings, boolean recovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(recovery); fParser.setBindingsRecovery(recovery); fParser.setSource(newCuSource.toCharArray()); fParser.setUnitName(originalCu.getElementName()); fParser.setProject(originalCu.getJavaProject()); fParser.setCompilerOptions(getCompilerOptions(originalCu)); CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm); return newCUNode; }
/** * @param newCuSource the source * @param originalCu the compilation unit 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 newCuSource, ICompilationUnit originalCu, boolean resolveBindings, boolean recovery, IProgressMonitor pm) { fParser.setResolveBindings(resolveBindings); fParser.setStatementsRecovery(recovery); fParser.setBindingsRecovery(recovery); fParser.setSource(newCuSource.toCharArray()); fParser.setUnitName(originalCu.getElementName()); fParser.setProject(originalCu.getJavaProject()); fParser.setCompilerOptions(getCompilerOptions(originalCu)); CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm); return newCUNode; }