@Override public ICompilationUnit getWorkingCopy(IEditorInput input) { return getWorkingCopy(input, true); }
public synchronized WorkingCopyManager getWorkingCopyManager() { if (fWorkingCopyManager == null) { ICompilationUnitDocumentProvider provider= getCompilationUnitDocumentProvider(); fWorkingCopyManager= new WorkingCopyManager(provider); } return fWorkingCopyManager; }
fWorkingCopyManager.shutdown(); fWorkingCopyManager= null;
fWorkingCopyManager.shutdown(); fWorkingCopyManager= null;
@Override public ICompilationUnit getWorkingCopy(IEditorInput input) { return getWorkingCopy(input, true); }
public synchronized WorkingCopyManager getWorkingCopyManager() { if (fWorkingCopyManager == null) { ICompilationUnitDocumentProvider provider= getCompilationUnitDocumentProvider(); fWorkingCopyManager= new WorkingCopyManager(provider); } return fWorkingCopyManager; }
fWorkingCopyManager.shutdown(); fWorkingCopyManager= null;
public ICompilationUnit getWorkingCopy(IEditorInput input) { return getWorkingCopy(input, true); }
public synchronized WorkingCopyManager getWorkingCopyManager() { if (fWorkingCopyManager == null) { ICompilationUnitDocumentProvider provider= getCompilationUnitDocumentProvider(); fWorkingCopyManager= new WorkingCopyManager(provider); } return fWorkingCopyManager; }
/** * Returns the working copy remembered for the compilation unit encoded in the * given editor input. * * @param input the editor input * @param primaryOnly if <code>true</code> only primary working copies will be returned * @return the working copy of the compilation unit, or <code>null</code> if the * input does not encode an editor input, or if there is no remembered working * copy for this compilation unit */ public static ICompilationUnit getWorkingCopy(IEditorInput input, boolean primaryOnly) { //TODO Using JDT UI internal code here, see bug 151260 for more information return ((WorkingCopyManager)JavaUI.getWorkingCopyManager()).getWorkingCopy(input, primaryOnly); }
private static ITypeRoot getEditorInputJavaElement(IEditorInput editorInput, boolean primaryOnly) { if (editorInput == null) return null; ICompilationUnit cu= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput, primaryOnly); if (cu != null) return cu; IJavaElement je= editorInput.getAdapter(IJavaElement.class); if (je instanceof ITypeRoot) return (ITypeRoot)je; return null; }
private static ITypeRoot getEditorInputJavaElement(IEditorInput editorInput, boolean primaryOnly) { if (editorInput == null) return null; ICompilationUnit cu= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput, primaryOnly); if (cu != null) return cu; IJavaElement je= editorInput.getAdapter(IJavaElement.class); if (je instanceof ITypeRoot) return (ITypeRoot)je; return null; }
/** * Returns the Java element wrapped by the given editor input. * * @param editorInput the editor input * @return the Java element wrapped by <code>editorInput</code> or <code>null</code> if none * @since 3.2 */ public static IJavaElement getEditorInputJavaElement(IEditorInput editorInput) { // Performance: check working copy manager first: this is faster IJavaElement je= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput); if (je != null) return je; return (IJavaElement)editorInput.getAdapter(IJavaElement.class); }
/** * Returns the Java element wrapped by the given editor input. * * @param editorInput the editor input * @return the Java element wrapped by <code>editorInput</code> or <code>null</code> if none * @since 3.2 */ public static IJavaElement getEditorInputJavaElement(IEditorInput editorInput) { // Performance: check working copy manager first: this is faster IJavaElement je= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput); if (je != null) return je; return editorInput.getAdapter(IJavaElement.class); }
/** * Returns the Java element wrapped by the given editor input. * * @param editorInput the editor input * @return the Java element wrapped by <code>editorInput</code> or <code>null</code> if none * @since 3.2 */ public static IJavaElement getEditorInputJavaElement(IEditorInput editorInput) { // Performance: check working copy manager first: this is faster IJavaElement je= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput); if (je != null) return je; return editorInput.getAdapter(IJavaElement.class); }
public Object getAdapter(Object element, Class key) { if (IJavaElement.class.equals(key)) { // Performance optimization, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=133141 if (element instanceof IFile) { IJavaElement je= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(new FileEditorInput((IFile)element)); if (je != null) return je; } return JavaCore.create((IResource)element); } return null; } }
@Override @SuppressWarnings("unchecked") public <T> T getAdapter(Object element, Class<T> key) { if (IJavaElement.class.equals(key)) { // Performance optimization, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=133141 if (element instanceof IFile) { IJavaElement je= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(new FileEditorInput((IFile)element)); if (je != null) return (T) je; } return (T) JavaCore.create((IResource)element); } return null; } }
private void reconcile(final boolean initialReconcile) { Assert.isTrue(fAST == null); // we'll see how this behaves ;-) final ICompilationUnit unit= fManager.getWorkingCopy(fEditor.getEditorInput(), false); if (unit != null) { SafeRunner.run(new ISafeRunnable() { @Override public void run() throws JavaModelException { fAST= reconcile(unit, initialReconcile); } @Override public void handleException(Throwable ex) { IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.OK, "Error in JDT Core during reconcile", ex); //$NON-NLS-1$ JavaPlugin.getDefault().getLog().log(status); } }); } }
@Override @SuppressWarnings("unchecked") public <T> T getAdapter(Object element, Class<T> key) { if (IJavaElement.class.equals(key)) { // Performance optimization, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=133141 if (element instanceof IFile) { IJavaElement je= JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(new FileEditorInput((IFile)element)); if (je != null) return (T) je; } return (T) JavaCore.create((IResource)element); } return null; } }
private void reconcile(final boolean initialReconcile) { Assert.isTrue(fAST == null); // we'll see how this behaves ;-) final ICompilationUnit unit= fManager.getWorkingCopy(fEditor.getEditorInput(), false); if (unit != null) { SafeRunner.run(new ISafeRunnable() { @Override public void run() throws JavaModelException { fAST= reconcile(unit, initialReconcile); } @Override public void handleException(Throwable ex) { IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.OK, "Error in JDT Core during reconcile", ex); //$NON-NLS-1$ JavaPlugin.getDefault().getLog().log(status); } }); } }