Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 20760 Details for
Bug 84406
[RCP] [ViewMgmt] [EditorMgmt] ISaveablePart not fully implemented
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Smaller faster patch
84406_patch.txt (text/plain), 7.54 KB, created by
Stefan Xenos
on 2005-05-05 18:50:00 EDT
(
hide
)
Description:
Smaller faster patch
Filename:
MIME Type:
Creator:
Stefan Xenos
Created:
2005-05-05 18:50:00 EDT
Size:
7.54 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/internal/EditorManager.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java,v >retrieving revision 1.82 >diff -u -r1.82 EditorManager.java >--- Eclipse UI/org/eclipse/ui/internal/EditorManager.java 5 May 2005 18:32:43 -0000 1.82 >+++ Eclipse UI/org/eclipse/ui/internal/EditorManager.java 5 May 2005 22:23:52 -0000 >@@ -273,29 +273,9 @@ > } > return result; > } >+ > > /** >- * Answer a list of dirty views. >- */ >- private List collectDirtyViews() { >- List result = new ArrayList(3); >- // add all the saveable views to the list >- Perspective[] perspectives = page.getSortedInternalPerspectives(); >- for (int l=0; l<perspectives.length; l++) { >- IViewPart[] viewParts = page.getViews(perspectives[l], false); >- for (int m=0; m<viewParts.length; m++) { >- IViewPart view = viewParts[m]; >- if (view instanceof ISaveablePart) { >- ISaveablePart saveable = (ISaveablePart)view; >- if (saveable.isDirty() && !result.contains(saveable)) { >- result.add(saveable); >- } >- } >- } >- } >- return result; >- } >- /** > * Returns whether the manager contains an editor. > */ > public boolean containsEditor(IEditorReference ref) { >@@ -471,15 +451,6 @@ > return (IEditorPart[]) dirtyEditors > .toArray(new IEditorPart[dirtyEditors.size()]); > } >- >- /** >- * Returns the dirty views in the page (across all perspectives in the page). >- */ >- public IViewPart[] getDirtyViews() { >- List dirtyViews = collectDirtyViews(); >- return (IViewPart[]) dirtyViews >- .toArray(new IViewPart[dirtyViews.size()]); >- } > > /* > * See IWorkbenchPage. >@@ -945,8 +916,12 @@ > public boolean saveAll(boolean confirm, boolean closing) { > // Get the list of dirty editors and views. If it is > // empty just return. >- List dirtyParts = collectDirtyEditors(); >- dirtyParts.addAll(collectDirtyViews()); >+ ISaveablePart[] parts = page.getDirtyParts(); >+ List dirtyParts = new ArrayList(); >+ for (int i = 0; i < parts.length; i++) { >+ ISaveablePart part = parts[i]; >+ dirtyParts.add(part); >+ } > if (dirtyParts.size() == 0) > return true; > >Index: Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java,v >retrieving revision 1.16 >diff -u -r1.16 SaveAllAction.java >--- Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java 5 May 2005 18:32:43 -0000 1.16 >+++ Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java 5 May 2005 22:23:52 -0000 >@@ -146,8 +146,7 @@ > else { > WorkbenchPage page = (WorkbenchPage) getActivePage(); > setEnabled(page != null && >- (page.getDirtyEditors().length > 0 || >- page.getDirtyViews().length > 0)); >+ (page.getDirtyParts().length > 0)); > } > } > >Index: Eclipse UI/org/eclipse/ui/internal/Workbench.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java,v >retrieving revision 1.328 >diff -u -r1.328 Workbench.java >--- Eclipse UI/org/eclipse/ui/internal/Workbench.java 5 May 2005 18:32:43 -0000 1.328 >+++ Eclipse UI/org/eclipse/ui/internal/Workbench.java 5 May 2005 22:23:52 -0000 >@@ -79,7 +79,6 @@ > import org.eclipse.ui.IPerspectiveRegistry; > import org.eclipse.ui.ISaveablePart; > import org.eclipse.ui.ISharedImages; >-import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IWindowListener; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPage; >@@ -567,34 +566,26 @@ > for (int j = 0; j < pages.length; j++) { > WorkbenchPage page = (WorkbenchPage) pages[j]; > >- // add all editors to the list >- IEditorPart editors[] = page.getDirtyEditors(); >- for (int k = 0; k < editors.length; k++) { >- IEditorPart editor = editors[k]; >- if (editor.isSaveOnCloseNeeded()) { >- if (!dirtyEditorsInput.contains(editor >- .getEditorInput())) { >- dirtyParts.add(editor); >- dirtyEditorsInput.add(editor >- .getEditorInput()); >- } >- } >- } >- >- // add all the saveable views to the list >- IViewPart[] viewParts = page.getDirtyViews(); >- for (int m=0; m<viewParts.length; m++) { >- IViewPart view = viewParts[m]; >- if (view instanceof ISaveablePart) { >- ISaveablePart saveable = (ISaveablePart)view; >- if (saveable.isSaveOnCloseNeeded()) { >- if (!dirtyParts.contains(saveable)) { >- dirtyParts.add(saveable); >- } >- } >- } >- } >- } >+ ISaveablePart[] parts = page.getDirtyParts(); >+ >+ for (int k = 0; k < parts.length; k++) { >+ ISaveablePart part = parts[k]; >+ >+ if (part.isSaveOnCloseNeeded()) { >+ if (part instanceof IEditorPart) { >+ IEditorPart editor = (IEditorPart)part; >+ if (!dirtyEditorsInput.contains(editor >+ .getEditorInput())) { >+ dirtyParts.add(editor); >+ dirtyEditorsInput.add(editor >+ .getEditorInput()); >+ } >+ } else { >+ dirtyParts.add(part); >+ } >+ } >+ } >+ } > } > if (dirtyParts.size() > 0) { > IWorkbenchWindow w = getActiveWorkbenchWindow(); >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java,v >retrieving revision 1.209 >diff -u -r1.209 WorkbenchPage.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 5 May 2005 18:32:43 -0000 1.209 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 5 May 2005 22:23:52 -0000 >@@ -1657,9 +1657,24 @@ > return getEditorManager().getDirtyEditors(); > } > >- public IViewPart[] getDirtyViews() { >- return getEditorManager().getDirtyViews(); >+ public ISaveablePart[] getDirtyParts() { >+ List result = new ArrayList(3); >+ IWorkbenchPartReference[] allParts = getAllParts(); >+ for (int i = 0; i < allParts.length; i++) { >+ IWorkbenchPartReference reference = allParts[i]; >+ >+ IWorkbenchPart part = reference.getPart(false); >+ if (part != null && part instanceof ISaveablePart) { >+ ISaveablePart saveable = (ISaveablePart)part; >+ if (saveable.isDirty()) { >+ result.add(saveable); >+ } >+ } >+ } >+ >+ return (ISaveablePart[]) result.toArray(new ISaveablePart[result.size()]); > } >+ > > public IEditorPart findEditor(IEditorInput input) { > return getEditorManager().findEditor(input);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 84406
:
20677
|
20731
|
20757
| 20760 |
20801