@Override protected IOperationApprover getUndoRedoOperationApprover(IUndoContext undoContext) { // since IResource is a more general way to compare java elements, we // use this as the preferred class for comparing objects. return new NonLocalUndoUserApprover(undoContext, this, new Object [] { getInputJavaElement() }, IResource.class); }
protected IOperationApprover getUndoRedoOperationApprover(IUndoContext undoContext) { // since IResource is a more general way to compare java elements, we // use this as the preferred class for comparing objects. return new NonLocalUndoUserApprover(undoContext, this, new Object [] { getInputJavaElement() }, IResource.class); }
@Override protected IOperationApprover getUndoRedoOperationApprover(IUndoContext undoContext) { // since IResource is a more general way to compare java elements, we // use this as the preferred class for comparing objects. return new NonLocalUndoUserApprover(undoContext, this, new Object [] { getInputJavaElement() }, IResource.class); }
void activeJavaEditorChanged(IWorkbenchPart editor) { ITypeRoot javaElement= null; if (editor instanceof JavaEditor) javaElement= ((JavaEditor)editor).getInputJavaElement(); synchronized (this) { fActiveEditor= editor; fActiveJavaElement= javaElement; cache(null, javaElement); } if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "active editor is: " + toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ synchronized (fReconcileLock) { if (fIsReconciling && (fReconcilingJavaElement == null || !fReconcilingJavaElement.equals(javaElement))) { fIsReconciling= false; fReconcilingJavaElement= null; } else if (javaElement == null) { fIsReconciling= false; fReconcilingJavaElement= null; } } }
private void activeJavaEditorChanged(IWorkbenchPart editor) { IJavaElement javaElement= null; if (editor instanceof JavaEditor) javaElement= ((JavaEditor)editor).getInputJavaElement(); synchronized (this) { fActiveEditor= editor; fActiveJavaElement= javaElement; cache(null, javaElement); } if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "active editor is: " + toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ synchronized (fReconcileLock) { if (fIsReconciling && (fReconcilingJavaElement == null || !fReconcilingJavaElement.equals(javaElement))) { fIsReconciling= false; fReconcilingJavaElement= null; } else if (javaElement == null) { fIsReconciling= false; fReconcilingJavaElement= null; } } }
/** * Sets the input of the editor's outline page. * * @param page the Java outline page * @param input the editor input */ protected void setOutlinePageInput(JavaOutlinePage page, IEditorInput input) { if (page == null) return; IJavaElement je= getInputJavaElement(); if (je != null && je.exists()) page.setInput(je); else page.setInput(null); }
/** * Sets the input of the editor's outline page. * * @param page the Java outline page * @param input the editor input */ protected void setOutlinePageInput(JavaOutlinePage page, IEditorInput input) { if (page == null) return; IJavaElement je= getInputJavaElement(); if (je != null && je.exists()) page.setInput(je); else page.setInput(null); }
/** * Sets the input of the editor's outline page. * * @param page the Java outline page * @param input the editor input */ protected void setOutlinePageInput(JavaOutlinePage page, IEditorInput input) { if (page == null) return; IJavaElement je= getInputJavaElement(); if (je != null && je.exists()) page.setInput(je); else page.setInput(null); }
@Override public void windowActivated(IWorkbenchWindow window) { if (window == getEditorSite().getWorkbenchWindow() && fMarkOccurrenceAnnotations && isActivePart()) { fForcedMarkOccurrencesSelection= getSelectionProvider().getSelection(); ITypeRoot inputJavaElement= getInputJavaElement(); if (inputJavaElement != null) { IProgressMonitor monitor = getProgressMonitor(); try { updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProvider.getAST(inputJavaElement, SharedASTProvider.WAIT_NO, monitor)); } finally { monitor.done(); } } } }
@Override public void windowActivated(IWorkbenchWindow window) { if (window == getEditorSite().getWorkbenchWindow() && fMarkOccurrenceAnnotations && isActivePart()) { fForcedMarkOccurrencesSelection= getSelectionProvider().getSelection(); ITypeRoot inputJavaElement= getInputJavaElement(); if (inputJavaElement != null) { IProgressMonitor monitor = getProgressMonitor(); try { updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProviderCore.getAST(inputJavaElement, SharedASTProviderCore.WAIT_NO, monitor)); } finally { monitor.done(); } } } }
void activeJavaEditorChanged(IWorkbenchPart editor) { ITypeRoot javaElement= null; if (editor instanceof JavaEditor) javaElement= ((JavaEditor)editor).getInputJavaElement(); synchronized (this) { fActiveEditor= editor; INSTANCE.setActiveJavaElement(javaElement); INSTANCE.cache(null, javaElement); } if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(CoreASTProvider.getThreadName() + " - " + CoreASTProvider.DEBUG_PREFIX + "active editor is: " + INSTANCE.toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ if (INSTANCE.isReconciling() && (INSTANCE.getReconcilingJavaElement() == null || !INSTANCE.getReconcilingJavaElement().equals(javaElement))) { INSTANCE.clearReconciliation(); } else if (javaElement == null) { INSTANCE.clearReconciliation(); } }
/** * Makes the breadcrumb visible. Creates its content * if this is the first time it is made visible. * * @since 3.4 */ private void showBreadcrumb() { if (fBreadcrumb == null) return; if (fBreadcrumbComposite.isDisposed()) { // not expected SWT.error(SWT.ERROR_WIDGET_DISPOSED, null, ". Editor not properly disposed; please report scenario to <https://bugs.eclipse.org/446203>. Editor input: " //$NON-NLS-1$ + getInputJavaElement()); } if (fBreadcrumbComposite.getChildren().length == 0) { fBreadcrumb.createContent(fBreadcrumbComposite); } ((GridData) fBreadcrumbComposite.getLayoutData()).exclude= false; fBreadcrumbComposite.setVisible(true); ISourceReference selection= computeHighlightRangeSourceReference(); if (selection == null) selection= getInputJavaElement(); setBreadcrumbInput(selection); fBreadcrumbComposite.getParent().layout(true, true); }
/** * Makes the breadcrumb visible. Creates its content * if this is the first time it is made visible. * * @since 3.4 */ private void showBreadcrumb() { if (fBreadcrumb == null) return; if (fBreadcrumbComposite.isDisposed()) { // not expected SWT.error(SWT.ERROR_WIDGET_DISPOSED, null, ". Editor not properly disposed; please report scenario to <https://bugs.eclipse.org/446203>. Editor input: " //$NON-NLS-1$ + getInputJavaElement()); } if (fBreadcrumbComposite.getChildren().length == 0) { fBreadcrumb.createContent(fBreadcrumbComposite); } ((GridData) fBreadcrumbComposite.getLayoutData()).exclude= false; fBreadcrumbComposite.setVisible(true); ISourceReference selection= computeHighlightRangeSourceReference(); if (selection == null) selection= getInputJavaElement(); setBreadcrumbInput(selection); fBreadcrumbComposite.getParent().layout(true, true); }
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 ITypeRoot inputElement= getInputJavaElement(); if (model == null || inputElement == null) return; fOverrideIndicatorManager= new OverrideIndicatorManager(model, inputElement, null); if (provideAST) { IProgressMonitor monitor = getProgressMonitor(); try { SubMonitor subMonitor= SubMonitor.convert(monitor, 2); CompilationUnit ast= SharedASTProvider.getAST(inputElement, SharedASTProvider.WAIT_ACTIVE_ONLY, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); fOverrideIndicatorManager.reconciled(ast, true, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); } finally { monitor.done(); } } }
protected void installOccurrencesFinder(boolean forceUpdate) { fMarkOccurrenceAnnotations= true; fPostSelectionListenerWithAST= new ISelectionListenerWithAST() { @Override public void selectionChanged(IEditorPart part, ITextSelection selection, CompilationUnit astRoot) { updateOccurrenceAnnotations(selection, astRoot); } }; SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST); if (forceUpdate && getSelectionProvider() != null) { fForcedMarkOccurrencesSelection= getSelectionProvider().getSelection(); ITypeRoot inputJavaElement= getInputJavaElement(); if (inputJavaElement != null) { IProgressMonitor monitor = getProgressMonitor(); try { updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProviderCore.getAST(inputJavaElement, SharedASTProviderCore.WAIT_NO, monitor)); } finally { monitor.done(); } } } if (fOccurrencesFinderJobCanceler == null) { fOccurrencesFinderJobCanceler= new OccurrencesFinderJobCanceler(); fOccurrencesFinderJobCanceler.install(); } }
protected void installOverrideIndicator(boolean provideAST) { uninstallOverrideIndicator(); IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput()); final ITypeRoot inputElement= getInputJavaElement(); if (model == null || inputElement == null) return; fOverrideIndicatorManager= new OverrideIndicatorManager(model, inputElement, null); if (provideAST) { IProgressMonitor monitor = getProgressMonitor(); try { SubMonitor subMonitor= SubMonitor.convert(monitor, 2); CompilationUnit ast= SharedASTProviderCore.getAST(inputElement, SharedASTProviderCore.WAIT_ACTIVE_ONLY, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); fOverrideIndicatorManager.reconciled(ast, true, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); } finally { monitor.done(); } } }
protected void installOccurrencesFinder(boolean forceUpdate) { fMarkOccurrenceAnnotations= true; fPostSelectionListenerWithAST= new ISelectionListenerWithAST() { @Override public void selectionChanged(IEditorPart part, ITextSelection selection, CompilationUnit astRoot) { updateOccurrenceAnnotations(selection, astRoot); } }; SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST); if (forceUpdate && getSelectionProvider() != null) { fForcedMarkOccurrencesSelection= getSelectionProvider().getSelection(); ITypeRoot inputJavaElement= getInputJavaElement(); if (inputJavaElement != null) { IProgressMonitor monitor = getProgressMonitor(); try { updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProvider.getAST(inputJavaElement, SharedASTProvider.WAIT_NO, monitor)); } finally { monitor.done(); } } } if (fOccurrencesFinderJobCanceler == null) { fOccurrencesFinderJobCanceler= new OccurrencesFinderJobCanceler(); fOccurrencesFinderJobCanceler.install(); } }
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(); } }