editorsToReopen.put(editor.getEditorInput(), id);
private static IResource getAdapter(IEditorReference ref) { IEditorInput input; try { input = ref.getEditorInput(); } catch (PartInitException e) { // ignore if factory can't restore input, see bug 461786 return null; } // here we can only guess how the input might be related to a resource IFile adapter = Adapters.adapt(input, IFile.class); if (adapter != null) { return adapter; } return Adapters.adapt(input, IResource.class); }
IFile getIFile(IEditorReference editorRef) { try { IEditorInput editorInput = editorRef.getEditorInput(); Object adapt = editorInput.getAdapter(IFile.class); if (adapt instanceof IFile) { return (IFile) adapt; } } catch (PartInitException excp) { JSFCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Error acquiring editor input",excp)); //$NON-NLS-1$ } return null; } }
@Override public boolean matches(IEditorReference editorRef, IEditorInput input) { if (!(input instanceof IFileEditorInput)) return false; IFile inputFile = ResourceUtil.getFile(input); if (inputFile == null) return false; try { IFile currInputFile = ResourceUtil.getFile(editorRef.getEditorInput()); if (currInputFile == null) return false; if (!inputFile.getProject().equals(currInputFile.getProject())) return false; // build.properties matches with editors that have a feature.xml file // as their input and that feature.xml is at the root if (inputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) { if (currInputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) return inputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR); return inputFile.equals(currInputFile); } else if (inputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) { if (currInputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) return currInputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR); return inputFile.equals(currInputFile); } return false; } catch (PartInitException e) { return false; } }
private static AbstractDecoratedTextEditor findOpenTextEditorFor(IWorkbenchPage page, Object object) { if (object == null) return null; if (object instanceof IFile) { IFile file = (IFile) object; return findOpenTextEditorForFile(page, file); } final IWorkbench workbench= PlatformUI.getWorkbench(); final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IEditorReference[] references= window.getActivePage().getEditorReferences(); for (int i= 0; i < references.length; i++) { IEditorReference reference= references[i]; try { if (object.equals(reference.getEditorInput())) { IEditorPart editor= reference.getEditor(false); if (editor instanceof AbstractDecoratedTextEditor) return (AbstractDecoratedTextEditor) editor; } } catch (PartInitException e) { // ignore } } return null; }
private static AbstractDecoratedTextEditor findOpenTextEditorFor(IWorkbenchPage page, Object object) { if (object == null) return null; if (object instanceof IFile) { IFile file = (IFile) object; return findOpenTextEditorForFile(page, file); } final IWorkbench workbench= PlatformUI.getWorkbench(); final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IEditorReference[] references= window.getActivePage().getEditorReferences(); for (int i= 0; i < references.length; i++) { IEditorReference reference= references[i]; try { if (object.equals(reference.getEditorInput())) { IEditorPart editor= reference.getEditor(false); if (editor instanceof AbstractDecoratedTextEditor) return (AbstractDecoratedTextEditor) editor; } } catch (PartInitException e) { // ignore } } return null; }
try { if (input.equals(editorRef.getEditorInput())) return true; IFile editorFile = ResourceUtil.getFile(editorRef.getEditorInput()); if (editorFile == null || !inputFile.getProject().equals(editorFile.getProject())) return false; IEditorInput existing = editorRef.getEditorInput(); return input.equals(existing); } catch (PartInitException e1) {
IEditorInput input = null; try { input = ref.getEditorInput(); } catch (PartInitException e) { SQLEditorPlugin.getDefault().log(e);
IEditorInput input = null; try { input = ref.getEditorInput(); } catch (PartInitException e) { SQLEditorPlugin.getDefault().log(e);
IEditorInput input = null; try { input = ref.getEditorInput(); } catch (PartInitException e) { SQLEditorPlugin.getDefault().log(e);
for (int i = 0; i < length; i++) IEditorInput input = refs[i].getEditorInput(); if (input instanceof XSDFileEditorInput)
IEditorInput input = null; try { input = ref.getEditorInput(); } catch (PartInitException e) { SQLEditorPlugin.getDefault().log(e);
IEditorInput input = null; try { input = ref.getEditorInput(); } catch (PartInitException e) { SQLEditorPlugin.getDefault().log(e);
for (int i = 0; i < length; i++) IEditorInput input = refs[i].getEditorInput(); if (input instanceof XSDFileEditorInput)