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 25936 Details for
Bug 96129
[MPE] (regression) MultiEditor.getInnerEditors() returns null.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
MultiEditor functionality patch for 3.1.1 v07
bug96129-ui.workbench-0809-10.txt (text/plain), 15.08 KB, created by
Paul Webster
on 2005-08-09 18:13:26 EDT
(
hide
)
Description:
MultiEditor functionality patch for 3.1.1 v07
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2005-08-09 18:13:26 EDT
Size:
15.08 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java,v >retrieving revision 1.20 >diff -u -r1.20 IWorkbenchPartSite.java >--- Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java 25 Feb 2005 20:52:16 -0000 1.20 >+++ Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java 9 Aug 2005 22:10:06 -0000 >@@ -124,5 +124,15 @@ > * > * @return the part associated with this site > */ >- public IWorkbenchPart getPart(); >+ public IWorkbenchPart getPart(); >+ >+ /** >+ * Returns the part reference associated with this site. It can >+ * return null. >+ * >+ * @since 3.1.1 >+ * >+ * @return the part reference, or null if there's none available. >+ */ >+ public IWorkbenchPartReference getPartReference(); > } >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.87 >diff -u -r1.87 EditorManager.java >--- Eclipse UI/org/eclipse/ui/internal/EditorManager.java 16 May 2005 21:16:50 -0000 1.87 >+++ Eclipse UI/org/eclipse/ui/internal/EditorManager.java 9 Aug 2005 22:10:08 -0000 >@@ -713,12 +713,17 @@ > return null; > } > >- /* >- * Create the site and action bars for each inner editor. >- */ >- private IEditorReference[] openMultiEditor(final IEditorReference ref, >- final MultiEditor part, final EditorDescriptor desc, >- final MultiEditorInput input, final boolean setVisible) >+ /** >+ * Create the part and reference for each inner editor. >+ * >+ * @param ref the MultiEditor ref >+ * @param part the part >+ * @param input the MultiEditor input >+ * @return the array of inner references to store in the MultiEditor ref >+ */ >+ IEditorReference[] openMultiEditor(final IEditorReference ref, >+ final MultiEditor part, >+ final MultiEditorInput input) > throws PartInitException { > > String[] editorArray = input.getEditors(); >Index: Eclipse UI/org/eclipse/ui/internal/EditorReference.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java,v >retrieving revision 1.5 >diff -u -r1.5 EditorReference.java >--- Eclipse UI/org/eclipse/ui/internal/EditorReference.java 16 May 2005 21:16:50 -0000 1.5 >+++ Eclipse UI/org/eclipse/ui/internal/EditorReference.java 9 Aug 2005 22:10:08 -0000 >@@ -44,6 +44,8 @@ > import org.eclipse.ui.internal.registry.EditorDescriptor; > import org.eclipse.ui.internal.util.Util; > import org.eclipse.ui.part.IWorkbenchPartOrientation; >+import org.eclipse.ui.part.MultiEditor; >+import org.eclipse.ui.part.MultiEditorInput; > import org.eclipse.ui.presentations.IPresentablePart; > > public class EditorReference extends WorkbenchPartReference implements >@@ -80,6 +82,13 @@ > > IEditorInput restoredInput; > >+ /** >+ * If the reference is instantiated as a MultiEditor, we need to dispose the >+ * inner references correctly. >+ */ >+ private IEditorReference[] multiEditorChildren = null; >+ >+ > public EditorReference(EditorManager manager, IEditorInput input, EditorDescriptor desc) { > this.manager = manager; > initListenersAndHandlers(); >@@ -241,7 +250,17 @@ > } > > protected void doDisposePart() { >- if (part != null) { >+ if (multiEditorChildren!=null) { >+ for (int i=0; i<multiEditorChildren.length; ++i) { >+ EditorReference ref = (EditorReference)multiEditorChildren[i]; >+ if (ref!=null) { >+ ref.dispose(); >+ } >+ } >+ multiEditorChildren = null; >+ } >+ >+ if (part != null) { > EditorSite site = (EditorSite) ((IEditorPart)part).getEditorSite(); > manager.disposeEditorActionBars((EditorActionBars) site.getActionBars()); > site.dispose(); >@@ -534,7 +553,7 @@ > throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_missing_editor_descriptor, editorID)); //$NON-NLS-1$ > } > >- IEditorPart part; >+ IEditorPart part = null; > > if (desc.isInternal()) { > // Create an editor instance. >@@ -545,6 +564,11 @@ > UIStats.end(UIStats.CREATE_PART, this, editorID); > } > >+ if (part != null && part instanceof MultiEditor) { >+ multiEditorChildren = manager.openMultiEditor(this, >+ (MultiEditor) part, (MultiEditorInput) editorInput); >+ } >+ > } else if (desc.getId().equals( > IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID)) { > >@@ -635,4 +659,15 @@ > > } > >-} >\ No newline at end of file >+ /** >+ * A quick way of finding out if this reference points to a MultiEditor. >+ * It depends on the fact that a MultiEditor does not lazily >+ * instantiate it's child editors. >+ * >+ * @return true if it has inner editor reference or the input is >+ * MultiEditorInput. >+ */ >+ public boolean isMultiReference() { >+ return multiEditorChildren!=null || restoredInput instanceof MultiEditorInput; >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/PartList.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartList.java,v >retrieving revision 1.2 >diff -u -r1.2 PartList.java >--- Eclipse UI/org/eclipse/ui/internal/PartList.java 16 May 2005 16:26:55 -0000 1.2 >+++ Eclipse UI/org/eclipse/ui/internal/PartList.java 9 Aug 2005 22:10:09 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchPartConstants; > import org.eclipse.ui.IWorkbenchPartReference; >+import org.eclipse.ui.part.MultiEditor; > > public abstract class PartList { > private IWorkbenchPartReference activePartReference; >@@ -101,6 +102,10 @@ > if (ref != null) { > IWorkbenchPart part = ref.getPart(true); > Assert.isNotNull(part); >+ if (part instanceof MultiEditor) { >+ ref = ((MultiEditor) part).getActiveEditor().getSite() >+ .getPartReference(); >+ } > } > > activePartReference = ref; >@@ -119,6 +124,10 @@ > if (ref != null) { > IWorkbenchPart part = ref.getPart(true); > Assert.isNotNull(part); >+ if (part instanceof MultiEditor) { >+ ref = (IEditorReference) ((MultiEditor) part).getActiveEditor() >+ .getSite().getPartReference(); >+ } > } > > activeEditorReference = ref; >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.223 >diff -u -r1.223 WorkbenchPage.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 22 Jun 2005 20:40:06 -0000 1.223 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 9 Aug 2005 22:10:11 -0000 >@@ -760,6 +760,9 @@ > makeActive(ref); > } else if (newPartContainer == activeEditorContainer) { > if (ref instanceof IEditorReference) { >+ if (part!=null) { >+ ref = part.getSite().getPartReference(); >+ } > makeActiveEditor((IEditorReference)ref); > } else { > makeActiveEditor(null); >@@ -1101,7 +1104,7 @@ > * @param ref the editor to make active, or <code>null</code> for no active editor > */ > private void makeActiveEditor(IEditorReference ref) { >- if (ref == getActiveEditor()) { >+ if (ref == getActiveEditorReference()) { > return; > } > >@@ -1115,7 +1118,7 @@ > actionSwitcher.updateTopEditor(part); > > if (ref != null) { >- activationList.bringToTop(ref); >+ activationList.bringToTop(getReference(part)); > } > > partList.setActiveEditor(ref); >@@ -1473,6 +1476,7 @@ > if (isZoomed()) > zoomOut(); > >+ makeActiveEditor(null); > makeActive(null); > > // Close and dispose the editors. >@@ -2171,6 +2175,7 @@ > * This method is called when the page is deactivated. > */ > protected void onDeactivate() { >+ makeActiveEditor(null); > makeActive(null); > if (getActivePerspective() != null) > getActivePerspective().onDeactivate(); >@@ -2467,6 +2472,10 @@ > if (!certifyPart(part)) > return; > >+ if (part instanceof MultiEditor) { >+ part = ((MultiEditor) part).getActiveEditor(); >+ } >+ > // Real work. > setActivePart(part); > } >@@ -2829,8 +2838,9 @@ > label = newPart != null ? newPart.getTitle() : "none"; //$NON-NLS-1$ > } > try { >- IWorkbenchPartReference partref = getReference(newPart); >- partBeingActivated = partref; >+ IWorkbenchPartReference partref = getReference(newPart); >+ IWorkbenchPartReference realPartRef = (newPart==null?null:newPart.getSite().getPartReference()); >+ partBeingActivated = realPartRef; > > UIStats.start(UIStats.ACTIVATE_PART, label); > // Notify perspective. It may deactivate fast view. >@@ -2848,9 +2858,10 @@ > if (newPart != null) { > activationList.setActive(newPart); > if (newPart instanceof IEditorPart) { >- IEditorReference ref = (IEditorReference) getReference(newPart); >- makeActiveEditor(ref); >- } >+ // IEditorReference ref = (IEditorReference) >+ // getReference(newPart); >+ makeActiveEditor((IEditorReference)realPartRef); >+ } > } > activatePart(newPart); > >@@ -3471,27 +3482,20 @@ > */ > void setActive(IWorkbenchPart part) { > if (parts.size() <= 0) >- return; >- PartPane pane = ((PartSite) part.getSite()).getPane(); >- if (pane instanceof MultiEditorInnerPane) { >- MultiEditorInnerPane innerPane = (MultiEditorInnerPane) pane; >- setActive(innerPane.getParentPane().getPartReference().getPart( >- true)); >- } else { >- IWorkbenchPartReference ref = getReference(part); >- if (ref != null) { >- if (ref == parts.get(parts.size() - 1)) >- return; >- parts.remove(ref); >- parts.add(ref); >- } >- } >+ return; >+ IWorkbenchPartReference ref = getReference(part); >+ if (ref != null) { >+ if (ref == parts.get(parts.size() - 1)) >+ return; >+ parts.remove(ref); >+ parts.add(ref); >+ } > } > > /* >- * Ensures that the given part appears AFTER any other part in the same >- * container. >- */ >+ * Ensures that the given part appears AFTER any other part in the same >+ * container. >+ */ > void bringToTop(IWorkbenchPartReference ref) { > ILayoutContainer targetContainer = getContainer(ref); > >Index: Eclipse UI/org/eclipse/ui/internal/part/CompatibilityPartSite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/CompatibilityPartSite.java,v >retrieving revision 1.5 >diff -u -r1.5 CompatibilityPartSite.java >--- Eclipse UI/org/eclipse/ui/internal/part/CompatibilityPartSite.java 2 May 2005 18:24:22 -0000 1.5 >+++ Eclipse UI/org/eclipse/ui/internal/part/CompatibilityPartSite.java 9 Aug 2005 22:10:12 -0000 >@@ -24,6 +24,7 @@ > import org.eclipse.ui.IViewSite; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchPartReference; > import org.eclipse.ui.IWorkbenchPartSite; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.internal.PartSite; >@@ -213,4 +214,13 @@ > registerContextMenu(getId(), menuManager, selectionProvider, > includeEditorInput); > } >+ >+ /* >+ * This method doesn't quite make sense in the context of >+ * compatibility part sites, so it returns null. >+ */ >+ public IWorkbenchPartReference getPartReference() { >+ // TODO Validated that compatibility editors don't have references. >+ return null; >+ } > } >Index: Eclipse UI/org/eclipse/ui/part/MultiEditor.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java,v >retrieving revision 1.15 >diff -u -r1.15 MultiEditor.java >--- Eclipse UI/org/eclipse/ui/part/MultiEditor.java 25 Feb 2005 20:52:16 -0000 1.15 >+++ Eclipse UI/org/eclipse/ui/part/MultiEditor.java 9 Aug 2005 22:10:13 -0000 >@@ -77,21 +77,6 @@ > return content; > } > >- /** >- * The <code>MultiEditor</code> implementation of this >- * method extends the <code>EditorPart</code> implementation, >- * and disposes any inner editors. Subclasses may extend. >- * >- * @since 3.0 >- */ >- public void dispose() { >- super.dispose(); >- IEditorPart[] editors = getInnerEditors(); >- for (int i = 0; i < editors.length; i++) { >- editors[i].dispose(); >- } >- } >- > /* > * @see IEditorPart#doSaveAs() > */ >Index: Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java,v >retrieving revision 1.16.2.1 >diff -u -r1.16.2.1 MultiPageEditorSite.java >--- Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java 2 Aug 2005 20:26:09 -0000 1.16.2.1 >+++ Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java 9 Aug 2005 22:10:13 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.ui.INestableKeyBindingService; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchPartReference; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.internal.PartSite; > import org.eclipse.ui.internal.PopupMenuExtender; >@@ -409,4 +410,13 @@ > registerContextMenu(getId(), menuManager, selectionProvider, > includeEditorInput); > } >+ >+ /* >+ * This method doesn't quite make sense in the context of >+ * MultiPageEditorPart, so it returns null >+ */ >+ public IWorkbenchPartReference getPartReference() { >+ // TODO Validated that inner editors don't have references. >+ return null; >+ } > }
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 96129
:
22644
|
22931
|
23457
|
24032
|
24096
|
24227
|
24358
|
24437
|
25128
|
25262
|
25425
|
25426
|
25620
|
25735
|
25831
|
25832
|
25834
|
25890
|
25923
|
25936
|
25937
|
25990
|
26109
|
26111
|
26121