private static CompilationUnit getAST(ISourceReference sr) { return ASTProvider.getASTProvider().getAST((IJavaElement) sr, ASTProvider.WAIT_YES, null); }
private CompilationUnit getASTRoot(ICompilationUnit compilationUnit) { return JavaPlugin.getDefault().getASTProvider().getAST(compilationUnit, ASTProvider.WAIT_NO, new NullProgressMonitor()); }
public CompilationUnit getASTRoot() { if (fASTRoot == null) { fASTRoot= ASTProvider.getASTProvider().getAST(fCompilationUnit, ASTProvider.WAIT_YES, null); if (fASTRoot == null) { // see bug 63554 fASTRoot= ASTResolving.createQuickFixAST(fCompilationUnit, null); } } return fASTRoot; }
private CompilationUnit getASTRoot(ICompilationUnit compilationUnit) { return JavaPlugin.getDefault().getASTProvider().getAST(compilationUnit, ASTProvider.WAIT_NO, new NullProgressMonitor()); }
private static CompilationUnit getASTRoot(ICompilationUnit compilationUnit, IProgressMonitor monitor) { CompilationUnit result= ASTProvider.getASTProvider().getAST(compilationUnit, ASTProvider.WAIT_YES, monitor); if (result == null) { // see bug 63554 result= ASTResolving.createQuickFixAST(compilationUnit, monitor); } return result; } }
private CompilationUnit getASTRoot(ICompilationUnit compilationUnit) { return JavaPlugin.getDefault().getASTProvider().getAST(compilationUnit, ASTProvider.WAIT_NO, new NullProgressMonitor()); }
protected void doPropertyChanged(String property) { if (property.equals(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB)) { if (isSetInPreferences()) { ICompilationUnit cu= getCompilationUnit(); if (cu != null) { installSelectionListener(); Point point= fViewer.getSelectedRange(); CompilationUnit astRoot= ASTProvider.getASTProvider().getAST(cu, ASTProvider.WAIT_ACTIVE_ONLY, null); if (astRoot != null) { doSelectionChanged(point.x, point.y, astRoot); } } } else { uninstallSelectionListener(); } } }
protected CompilationUnit createAST() { return JavaPlugin.getDefault().getASTProvider().getAST(fClassFile, ASTProvider.WAIT_YES, null); } protected IJavaElement getInput() {
public static boolean isApplicable(IInvocationContext context) throws JavaModelException { ICompilationUnit unit= context.getCompilationUnit(); CompilationUnit ast= ASTProvider.getASTProvider().getAST(unit, ASTProvider.WAIT_NO, null); if (ast == null) return true; Selection selection= Selection.createFromStartLength(context.getSelectionOffset(), context.getSelectionLength()); SurroundWithAnalyzer analyzer= new SurroundWithAnalyzer(unit, selection); context.getASTRoot().accept(analyzer); return analyzer.getStatus().isOK() && analyzer.hasSelectedNodes(); }
protected CompilationUnit createAST() { return JavaPlugin.getDefault().getASTProvider().getAST(fCUnit, ASTProvider.WAIT_YES, null); } protected IJavaElement getInput() {
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); }
public CompilationUnit resolvePartialAstAtOffset() { if (fPartialASTRequested) return fPartialAST; fPartialASTRequested= true; if (! (fElement instanceof ICompilationUnit)) return null; // long start= System.currentTimeMillis(); fPartialAST= JavaPlugin.getDefault().getASTProvider().getAST(fElement, ASTProvider.WAIT_YES, null); // System.out.println("Time requesting partial AST: " + (System.currentTimeMillis() - start)); return fPartialAST; }
public static String getResourceBundleName(ICompilationUnit unit) throws JavaModelException { return getResourceBundleName(JavaPlugin.getDefault().getASTProvider().getAST(unit, ASTProvider.WAIT_YES, null)); }
public static String getResourceBundleName(IClassFile classFile) throws JavaModelException { return getResourceBundleName(JavaPlugin.getDefault().getASTProvider().getAST(classFile, ASTProvider.WAIT_YES, null)); }
private static void ensureUpdatedAnnotations(ITextEditor editor) { Object inputElement= editor.getEditorInput().getAdapter(IJavaElement.class); if (inputElement instanceof ICompilationUnit) { JavaPlugin.getDefault().getASTProvider().getAST((ICompilationUnit) inputElement, ASTProvider.WAIT_ACTIVE_ONLY, null); } }
private static void ensureUpdatedAnnotations(ITextEditor editor) { Object inputElement= editor.getEditorInput().getAdapter(IJavaElement.class); if (inputElement instanceof ICompilationUnit) { JavaPlugin.getDefault().getASTProvider().getAST((ICompilationUnit) inputElement, ASTProvider.WAIT_ACTIVE_ONLY, null); } }
public static String getResourceBundleName(ITypeBinding accessorClassBinding) throws JavaModelException { IJavaElement je= accessorClassBinding.getJavaElement(); if (je == null) return null; IOpenable openable= je.getOpenable(); IJavaElement container= null; if (openable instanceof ICompilationUnit) container= (ICompilationUnit)openable; else if (openable instanceof IClassFile) container= (IClassFile)openable; else Assert.isLegal(false); CompilationUnit astRoot= JavaPlugin.getDefault().getASTProvider().getAST(container, ASTProvider.WAIT_YES, null); return getResourceBundleName(astRoot); }
public void windowActivated(IWorkbenchWindow window) { if (window == getEditorSite().getWorkbenchWindow() && fMarkOccurrenceAnnotations && isActivePart()) { fForcedMarkOccurrencesSelection= getSelectionProvider().getSelection(); updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, JavaPlugin.getDefault().getASTProvider().getAST(getInputJavaElement(), ASTProvider.WAIT_NO, getProgressMonitor())); } }
protected void installOverrideIndicator(boolean provideAST) { uninstallOverrideIndicator(); IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput()); final IJavaElement inputElement= getInputJavaElement(); if (model == null || inputElement == null) return; fOverrideIndicatorManager= new OverrideIndicatorManager(model, inputElement, null); if (provideAST) { CompilationUnit ast= JavaPlugin.getDefault().getASTProvider().getAST(inputElement, ASTProvider.WAIT_ACTIVE_ONLY, getProgressMonitor()); fOverrideIndicatorManager.reconciled(ast, true, getProgressMonitor()); } }
protected void installOccurrencesFinder(boolean forceUpdate) { fMarkOccurrenceAnnotations= true; fPostSelectionListenerWithAST= new ISelectionListenerWithAST() { public void selectionChanged(IEditorPart part, ITextSelection selection, CompilationUnit astRoot) { updateOccurrenceAnnotations(selection, astRoot); } }; SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST); if (forceUpdate && getSelectionProvider() != null) { fForcedMarkOccurrencesSelection= getSelectionProvider().getSelection(); updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, JavaPlugin.getDefault().getASTProvider().getAST(getInputJavaElement(), ASTProvider.WAIT_NO, getProgressMonitor())); } if (fOccurrencesFinderJobCanceler == null) { fOccurrencesFinderJobCanceler= new OccurrencesFinderJobCanceler(); fOccurrencesFinderJobCanceler.install(); } }