/** * Creates a new extract method refactoring * @param astRoot the AST root of an AST created from a compilation unit * @param selectionStart start * @param selectionLength length */ public ExtractMethodRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { this((ICompilationUnit) astRoot.getTypeRoot(), selectionStart, selectionLength); fRoot= astRoot; }
/** * Creates a new extract method refactoring * @param astRoot the AST root of an AST created from a compilation unit * @param selectionStart start * @param selectionLength length */ public ExtractMethodRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { this((ICompilationUnit) astRoot.getTypeRoot(), selectionStart, selectionLength); fRoot= astRoot; }
/** * Creates a new extract method refactoring * * @param astRoot * the AST root of an AST created from a compilation unit * @param selectionStart * start * @param selectionLength * length */ public ExtractMethodRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { this((ICompilationUnit) astRoot.getTypeRoot(), selectionStart, selectionLength); fRoot = astRoot; }
private static boolean processJavadocComments(CompilationUnit astRoot) { // don't visit Javadoc for 'package-info' (bug 216432) if (astRoot != null && astRoot.getTypeRoot() != null) { return !JavaModelUtil.PACKAGE_INFO_JAVA.equals(astRoot.getTypeRoot().getElementName()); } return true; }
private static boolean processJavadocComments(CompilationUnit astRoot) { // don't visit Javadoc for 'package-info' (bug 216432) if (astRoot != null && astRoot.getTypeRoot() != null) { return !JavaModelUtil.PACKAGE_INFO_JAVA.equals(astRoot.getTypeRoot().getElementName()); } return true; }
public ExtractTempRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart= selectionStart; fSelectionLength= selectionLength; fCu= (ICompilationUnit) astRoot.getTypeRoot(); fCompilationUnitNode= astRoot; fReplaceAllOccurrences= true; // default fDeclareFinal= false; // default fTempName= ""; //$NON-NLS-1$ fLinkedProposalModel= null; }
public ExtractTempRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart = selectionStart; fSelectionLength = selectionLength; fCu = (ICompilationUnit) astRoot.getTypeRoot(); fCompilationUnitNode = astRoot; fReplaceAllOccurrences = true; // default fDeclareFinal = false; // default fTempName = ""; //$NON-NLS-1$ fLinkedProposalModel = null; fCheckResultForCompileProblems = true; }
public ExtractTempRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart= selectionStart; fSelectionLength= selectionLength; fCu= (ICompilationUnit) astRoot.getTypeRoot(); fCompilationUnitNode= astRoot; fReplaceAllOccurrences= true; // default fDeclareFinal= false; // default fTempName= ""; //$NON-NLS-1$ fLinkedProposalModel= null; fCheckResultForCompileProblems= true; }
public ExtractTempRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart= selectionStart; fSelectionLength= selectionLength; fCu= (ICompilationUnit) astRoot.getTypeRoot(); fCompilationUnitNode= astRoot; fReplaceAllOccurrences= true; // default fDeclareFinal= false; // default fDeclareVarType= false; // default fTempName= ""; //$NON-NLS-1$ fLinkedProposalModel= null; fCheckResultForCompileProblems= true; }
private String run(CompilationUnit astRoot, int offset, int length) { String message= fFinder.initialize(astRoot, offset, length); if (message != null) return message; performNewSearch(fFinder, astRoot.getTypeRoot()); return null; }
public ExtractConstantRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart = selectionStart; fSelectionLength = selectionLength; fCu = (ICompilationUnit) astRoot.getTypeRoot(); fCuRewrite = new CompilationUnitRewrite(fCu, astRoot); fLinkedProposalModel = null; fConstantName = ""; //$NON-NLS-1$ fCheckResultForCompileProblems = true; }
public ExtractConstantRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart= selectionStart; fSelectionLength= selectionLength; fCu= (ICompilationUnit) astRoot.getTypeRoot(); fCuRewrite= new CompilationUnitRewrite(fCu, astRoot); fLinkedProposalModel= null; fConstantName= ""; //$NON-NLS-1$ fCheckResultForCompileProblems= true; }
private String findRecommendedLineSeparator(CompilationUnit astRoot) { try { return astRoot.getTypeRoot().findRecommendedLineSeparator(); } catch (JavaModelException e) { throw new UnhandledException(astRoot, e); } }
public ExtractConstantRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart= selectionStart; fSelectionLength= selectionLength; fCu= (ICompilationUnit) astRoot.getTypeRoot(); fCuRewrite= new CompilationUnitRewrite(fCu, astRoot); fLinkedProposalModel= null; fConstantName= ""; //$NON-NLS-1$ fCheckResultForCompileProblems= true; }
public ExtractConstantRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) { Assert.isTrue(selectionStart >= 0); Assert.isTrue(selectionLength >= 0); Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit); fSelectionStart= selectionStart; fSelectionLength= selectionLength; fCu= (ICompilationUnit) astRoot.getTypeRoot(); fCuRewrite= new CompilationUnitRewrite(fCu, astRoot); fLinkedProposalModel= null; fConstantName= ""; //$NON-NLS-1$ }
private String run(CompilationUnit astRoot, int offset, int length) { String message= fFinder.initialize(astRoot, offset, length); if (message != null) return message; performNewSearch(fFinder, astRoot.getTypeRoot()); return null; }
public IType type() { return this.compilationUnit().getTypeRoot().findPrimaryType(); }
private static String getExpressionBaseName(Expression expr) { IBinding argBinding= Bindings.resolveExpressionBinding(expr, true); if (argBinding instanceof IVariableBinding) { IJavaProject project= null; ASTNode root= expr.getRoot(); if (root instanceof CompilationUnit) { ITypeRoot typeRoot= ((CompilationUnit) root).getTypeRoot(); if (typeRoot != null) project= typeRoot.getJavaProject(); } return StubUtility.getBaseName((IVariableBinding)argBinding, project); } if (expr instanceof SimpleName) return ((SimpleName) expr).getIdentifier(); return null; }
private OccurrenceLocation getLocationForFirstToken(ASTNode node) { try { int nextEndOffset= new TokenScanner(fASTRoot.getTypeRoot()).getNextEndOffset(node.getStartPosition(), true); return new OccurrenceLocation(node.getStartPosition(), nextEndOffset - node.getStartPosition(), 0, fDescription); } catch (CoreException e) { // ignore } return new OccurrenceLocation(node.getStartPosition(), node.getLength(), 0, fDescription); }
private OccurrenceLocation getLocationForFirstToken(ASTNode node) { try { int nextEndOffset= new TokenScanner(fASTRoot.getTypeRoot()).getNextEndOffset(node.getStartPosition(), true); return new OccurrenceLocation(node.getStartPosition(), nextEndOffset - node.getStartPosition(), 0, fDescription); } catch (CoreException e) { // ignore } return new OccurrenceLocation(node.getStartPosition(), node.getLength(), 0, fDescription); }