private static IEditorPart[] getDirtyEditors() { 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]; result.add(ep); } } } return (IEditorPart[]) result.toArray(new IEditorPart[result.size()]); }
/** * Returns an array of all editors that have an unsaved content. If the identical content is * presented in more than one editor, only one of those editor parts is part of the result. * * @return an array of all dirty editor parts. */ public static IEditorPart[] getDirtyEditors() { Set inputs= new HashSet(); List result= new ArrayList(0); IWorkbench workbench= getDefault().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 (!inputs.contains(input)) { inputs.add(input); result.add(ep); } } } } return (IEditorPart[])result.toArray(new IEditorPart[result.size()]); }
/** * Returns an array of all editors that have an unsaved content, where the content is include in * one of the projects in the List parameter. If the identical content is presented in more than * one editor, only one of those editor parts is part of the result. * * @return an array of all dirty editor parts. */ public static IEditorPart[] getDirtyEditors(List projects) { Set inputs = new HashSet(); List result = new ArrayList(0); IWorkbench workbench = J2EEUIPlugin.getPluginWorkbench(); 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 (!inputs.contains(input) && (projects == null || inputInProjects(input, projects))) { inputs.add(input); result.add(ep); } } } } return (IEditorPart[]) result.toArray(new IEditorPart[result.size()]); }
/** * Returns an array of all editors that have an unsaved content. If the identical content is * presented in more than one editor, only one of those editor parts is part of the result. * * @return an array of all dirty editor parts. */ public static IEditorPart[] getDirtyEditors() { Set<IEditorInput> inputs= new HashSet<IEditorInput>(); List<IEditorPart> result= new ArrayList<IEditorPart>(0); IWorkbench workbench= getDefault().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 (!inputs.contains(input)) { inputs.add(input); result.add(ep); } } } } return result.toArray(new IEditorPart[result.size()]); }
/** * * Builds the list of editors that apply to this build that need to be saved * * @param profile the profile involved in this build, used to scope the searching process * @return the list of dirty editors for this launch to save, never null */ protected IEditorPart[] getScopedDirtyEditors(IConnectionProfile targetProfile) { List dirtyparts = new ArrayList(); IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); for(int l = 0; l < windows.length; l++) { IWorkbenchPage[] pages = windows[l].getPages(); for(int i = 0; i < pages.length; i++) { IEditorPart[] eparts = pages[i].getDirtyEditors(); for(int j = 0; j < eparts.length; j++) { IConnectionProfile profile = (IConnectionProfile)eparts[j].getEditorInput().getAdapter(IConnectionProfile.class); if(profile != null) { if(targetProfile.equals(profile) & !dirtyparts.contains(eparts[j])) { dirtyparts.add(eparts[j]); } } } } } return (IEditorPart[])dirtyparts.toArray(new IEditorPart[dirtyparts.size()]); }
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];
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];
/** * 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()]); }
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];
/** * * Builds the list of editors that apply to this build that need to be saved * * @param projects the projects involved in this build, used to scope the searching process * @return the list of dirty editors for this launch to save, never null */ protected IResource[] getScopedDirtyResources(IProject[] projects) { HashSet<IResource> dirtyres = new HashSet<>(); IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); for(int l = 0; l < windows.length; l++) { IWorkbenchPage[] pages = windows[l].getPages(); for(int i = 0; i < pages.length; i++) { IEditorPart[] eparts = pages[i].getDirtyEditors(); for(int j = 0; j < eparts.length; j++) { IResource resource = eparts[j].getEditorInput().getAdapter(IResource.class); if(resource != null) { for(int k = 0; k < projects.length; k++) { if(projects[k].equals(resource.getProject())) { dirtyres.add(resource); } } } } } } return dirtyres.toArray(new IResource[dirtyres.size()]); }
final JavaEditor getEditor(IFile file) { FileEditorInput fei= new FileEditorInput(file); IWorkbench workbench= JavaPlugin.getDefault().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]; if (ep instanceof JavaEditor) { JavaEditor je= (JavaEditor) ep; if (fei.equals(je.getEditorInput())) return (JavaEditor) ep; } } } } return null; }
final JavaEditor getEditor(IFile file) { FileEditorInput fei= new FileEditorInput(file); IWorkbench workbench= JavaPlugin.getDefault().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]; if (ep instanceof JavaEditor) { JavaEditor je= (JavaEditor) ep; if (fei.equals(je.getEditorInput())) return (JavaEditor) ep; } } } } return null; }
final JavaEditor getEditor(IFile file) { FileEditorInput fei= new FileEditorInput(file); IWorkbench workbench= JavaPlugin.getDefault().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]; if (ep instanceof JavaEditor) { JavaEditor je= (JavaEditor) ep; if (fei.equals(je.getEditorInput())) return (JavaEditor) ep; } } } } return null; }
page.saveAllEditors(false); } else { IEditorPart[] editors = page.getDirtyEditors(); for (int k = 0; k < editors.length; k++) { IEditorPart editor = editors[k];