/** * Returns the editors to save before performing global Java-related * operations. * * @param saveUnknownEditors <code>true</code> iff editors with unknown buffer management should also be saved * @return the editors to save * @since 3.3 */ public static IEditorPart[] getDirtyEditorsToSave(boolean saveUnknownEditors) { Set<IEditorInput> inputs= new HashSet<>(); List<IEditorPart> result= new ArrayList<>(0); IWorkbench workbench= PlatformUI.getWorkbench(); IWorkbenchWindow[] windows= workbench.getWorkbenchWindows(); for (int i= 0; i < windows.length; i++) { IWorkbenchPage[] pages= windows[i].getPages(); for (int x= 0; x < pages.length; x++) { IEditorPart[] editors= pages[x].getDirtyEditors(); for (int z= 0; z < editors.length; z++) { IEditorPart ep= editors[z]; IEditorInput input= ep.getEditorInput(); if (!mustSaveDirtyEditor(ep, input, saveUnknownEditors)) continue; if (inputs.add(input)) result.add(ep); } } } return result.toArray(new IEditorPart[result.size()]); }
/** * Returns the editors to save before performing global Java-related * operations. * * @param saveUnknownEditors <code>true</code> iff editors with unknown buffer management should also be saved * @return the editors to save * @since 3.3 */ public static IEditorPart[] getDirtyEditorsToSave(boolean saveUnknownEditors) { Set inputs= new HashSet(); List result= new ArrayList(0); IWorkbench workbench= PlatformUI.getWorkbench(); IWorkbenchWindow[] windows= workbench.getWorkbenchWindows(); for (int i= 0; i < windows.length; i++) { IWorkbenchPage[] pages= windows[i].getPages(); for (int x= 0; x < pages.length; x++) { IEditorPart[] editors= pages[x].getDirtyEditors(); for (int z= 0; z < editors.length; z++) { IEditorPart ep= editors[z]; IEditorInput input= ep.getEditorInput(); if (!mustSaveDirtyEditor(ep, input, saveUnknownEditors)) continue; if (inputs.add(input)) result.add(ep); } } } return (IEditorPart[])result.toArray(new IEditorPart[result.size()]); }
/** * Returns the editors to save before performing global Java-related * operations. * * @param saveUnknownEditors <code>true</code> iff editors with unknown buffer management should also be saved * @return the editors to save * @since 3.3 */ public static IEditorPart[] getDirtyEditorsToSave(boolean saveUnknownEditors) { Set<IEditorInput> inputs= new HashSet<>(); List<IEditorPart> result= new ArrayList<>(0); IWorkbench workbench= PlatformUI.getWorkbench(); IWorkbenchWindow[] windows= workbench.getWorkbenchWindows(); for (int i= 0; i < windows.length; i++) { IWorkbenchPage[] pages= windows[i].getPages(); for (int x= 0; x < pages.length; x++) { IEditorPart[] editors= pages[x].getDirtyEditors(); for (int z= 0; z < editors.length; z++) { IEditorPart ep= editors[z]; IEditorInput input= ep.getEditorInput(); if (!mustSaveDirtyEditor(ep, input, saveUnknownEditors)) continue; if (inputs.add(input)) result.add(ep); } } } return result.toArray(new IEditorPart[result.size()]); }