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 25831 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 v04
bug96129-ui.workbench-0808.txt (text/plain), 20.20 KB, created by
Paul Webster
on 2005-08-08 09:43:29 EDT
(
hide
)
Description:
MultiEditor functionality patch for 3.1.1 v04
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2005-08-08 09:43:29 EDT
Size:
20.20 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.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 8 Aug 2005 13:39:03 -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 8 Aug 2005 13:39:03 -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 8 Aug 2005 13:39:03 -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; >@@ -57,11 +58,12 @@ > } > > public IEditorPart getActiveEditor() { >- return activeEditorReference == null ? null :activeEditorReference.getEditor(false); >+ return (IEditorPart)getPart(activeEditorReference); > } > > public IWorkbenchPart getActivePart() { >- return activePartReference == null ? null : activePartReference.getPart(false); >+ //return activePartReference == null ? null : activePartReference.getPart(false); >+ return getPart(activePartReference); > } > > public void addPart(WorkbenchPartReference ref) { >@@ -89,9 +91,9 @@ > * @param ref > */ > public void setActivePart(IWorkbenchPartReference ref) { >- if (ref == activePartReference) { >- return; >- } >+ if (ref == activePartReference && !isMultiReference(ref)) { >+ return; >+ } > > IWorkbenchPartReference oldPart = activePartReference; > >@@ -109,9 +111,9 @@ > } > > public void setActiveEditor(IEditorReference ref) { >- if (ref == activeEditorReference) { >- return; >- } >+ if (ref == activePartReference && !isMultiReference(ref)) { >+ return; >+ } > > // A part can't be activated until it is added > //Assert.isTrue(ref == null || parts.contains(ref)); >@@ -226,6 +228,40 @@ > } > > /** >+ * Return the part for this reference. A convenience method >+ * that handles <code>null</code> cases. >+ * >+ * Try and deal with the MultiEditor ... which has implications for >+ * which "part" the partListeners should be notified about. >+ * >+ * @param ref The reference that might contain a MultiEditor. This >+ * can be <code>null</code>. >+ * @return the workbench part, the inner part if it's a MultiEditor, >+ * or <code>null</code> if the reference was <code>null</code> or >+ * the part hadn't been activated yet. >+ */ >+ protected IWorkbenchPart getPart(IWorkbenchPartReference ref) { >+ if (ref==null) { >+ return null; >+ } >+ IWorkbenchPart part = ref.getPart(false); >+ if (part != null && part instanceof MultiEditor) { >+ part = ((MultiEditor) part).getActiveEditor(); >+ } >+ return part; >+ } >+ >+ /** >+ * Check a reference to see if it's a ref to a MultiEditor. >+ * @param ref the reference to check. It can be <code>null</code>. >+ * @return true if the reference is to a MultiEditor. >+ */ >+ protected boolean isMultiReference(IWorkbenchPartReference ref) { >+ return ref instanceof EditorReference >+ && ((EditorReference) ref).isMultiReference(); >+ } >+ >+ /** > * Fire the event indicating that a part reference was just realized. That is, the concrete > * IWorkbenchPart has been attached to the part reference. > * >Index: Eclipse UI/org/eclipse/ui/internal/PartService.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartService.java,v >retrieving revision 1.2 >diff -u -r1.2 PartService.java >--- Eclipse UI/org/eclipse/ui/internal/PartService.java 16 May 2005 16:30:34 -0000 1.2 >+++ Eclipse UI/org/eclipse/ui/internal/PartService.java 8 Aug 2005 13:39:03 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchPartReference; > import org.eclipse.ui.internal.misc.UIListenerLogging; >+import org.eclipse.ui.part.MultiEditor; > > public class PartService implements IPartService { > private PartListenerList listeners = new PartListenerList(); >@@ -67,7 +68,7 @@ > * @param ref > */ > private void firePartActivated(IWorkbenchPartReference ref) { >- IWorkbenchPart part = ref.getPart(false); >+ IWorkbenchPart part = getPart(ref); > if(part != null) { > UIListenerLogging.logPartListenerEvent(debugListenersKey, this, part, UIListenerLogging.PE_ACTIVATED); > listeners.firePartActivated(part); >@@ -81,7 +82,7 @@ > * @param ref > */ > public void firePartBroughtToTop(IWorkbenchPartReference ref) { >- IWorkbenchPart part = ref.getPart(false); >+ IWorkbenchPart part = getPart(ref); > if(part != null) { > UIListenerLogging.logPartListenerEvent(debugListenersKey, this, part, UIListenerLogging.PE_PART_BROUGHT_TO_TOP); > listeners.firePartBroughtToTop(part); >@@ -94,7 +95,7 @@ > * @param ref > */ > public void firePartClosed(IWorkbenchPartReference ref) { >- IWorkbenchPart part = ref.getPart(false); >+ IWorkbenchPart part = getPart(ref); > if(part != null) { > UIListenerLogging.logPartListenerEvent(debugListenersKey, this, part, UIListenerLogging.PE_PART_CLOSED); > listeners.firePartClosed(part); >@@ -107,7 +108,7 @@ > * @param ref > */ > private void firePartDeactivated(IWorkbenchPartReference ref) { >- IWorkbenchPart part = ref.getPart(false); >+ IWorkbenchPart part = getPart(ref); > if(part != null) { > UIListenerLogging.logPartListenerEvent(debugListenersKey, this, part, UIListenerLogging.PE_PART_DEACTIVATED); > listeners.firePartDeactivated(part); >@@ -135,7 +136,7 @@ > * @param ref > */ > public void firePartOpened(IWorkbenchPartReference ref) { >- IWorkbenchPart part = ref.getPart(false); >+ IWorkbenchPart part = getPart(ref); > if(part != null) { > UIListenerLogging.logPartListenerEvent(debugListenersKey, this, part, UIListenerLogging.PE_PART_OPENED); > listeners.firePartOpened(part); >@@ -157,7 +158,7 @@ > IWorkbenchPartReference oldRef = activePart; > > // Filter out redundant activation events >- if (oldRef == ref) { >+ if (oldRef == ref && !isMultiReference(ref)) { > return; > } > >@@ -172,4 +173,37 @@ > } > } > >+ /** >+ * Return the part for this reference. A convenience method >+ * that handles <code>null</code> cases. >+ * >+ * Try and deal with the MultiEditor ... which has implications for >+ * which "part" the partListeners should be notified about. >+ * >+ * @param ref The reference that might contain a MultiEditor. This >+ * can be <code>null</code>. >+ * @return the workbench part, the inner part if it's a MultiEditor, >+ * or <code>null</code> if the reference was <code>null</code> or >+ * the part hadn't been activated yet. >+ */ >+ private IWorkbenchPart getPart(IWorkbenchPartReference ref) { >+ if (ref==null) { >+ return null; >+ } >+ IWorkbenchPart part = ref.getPart(false); >+ if (part != null && part instanceof MultiEditor) { >+ part = ((MultiEditor) part).getActiveEditor(); >+ } >+ return part; >+ } >+ >+ /** >+ * Check a reference to see if it's a ref to a MultiEditor. >+ * @param ref the reference to check. It can be <code>null</code>. >+ * @return true if the reference is to a MultiEditor. >+ */ >+ private boolean isMultiReference(IWorkbenchPartReference ref) { >+ return ref instanceof EditorReference >+ && ((EditorReference) ref).isMultiReference(); >+ } > } >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 8 Aug 2005 13:39:03 -0000 >@@ -559,7 +559,7 @@ > Platform.run(new SafeRunnable(WorkbenchMessages.WorkbenchPage_ErrorActivatingView) { > public void run() { > if (part != null) { >- //part.setFocus(); >+ part.setFocus(); > PartPane pane = getPane(part); > pane.setFocus(); > PartSite site = (PartSite) part.getSite(); >@@ -1101,14 +1101,14 @@ > * @param ref the editor to make active, or <code>null</code> for no active editor > */ > private void makeActiveEditor(IEditorReference ref) { >- if (ref == getActiveEditor()) { >- return; >- } >+ if (ref == getActiveEditorReference() && !isMultiReference(ref)) { >+ return; >+ } > >- IEditorPart part = (ref == null) ? null : ref.getEditor(true); >+ IEditorPart part = (IEditorPart)getPart(ref, true); > > if (part != null) { >- editorMgr.setVisibleEditor(ref, false); >+ editorMgr.setVisibleEditor(ref, true); > navigationHistory.markEditor(part); > } > >@@ -1473,6 +1473,7 @@ > if (isZoomed()) > zoomOut(); > >+ makeActiveEditor(null); > makeActive(null); > > // Close and dispose the editors. >@@ -2171,6 +2172,7 @@ > * This method is called when the page is deactivated. > */ > protected void onDeactivate() { >+ makeActiveEditor(null); > makeActive(null); > if (getActivePerspective() != null) > getActivePerspective().onDeactivate(); >@@ -2467,6 +2469,10 @@ > if (!certifyPart(part)) > return; > >+ if (part!=null && part instanceof MultiEditor) { >+ part = ((MultiEditor)part).getActiveEditor(); >+ } >+ > // Real work. > setActivePart(part); > } >@@ -2810,11 +2816,14 @@ > private void setActivePart(IWorkbenchPart newPart) { > // Optimize it. > if (getActivePart() == newPart) { >- return; >+ IWorkbenchPartReference partref = getReference(newPart); >+ if (!isMultiReference(partref)) { >+ return; >+ } > } > > if (partBeingActivated != null) { >- if (partBeingActivated.getPart(false) != newPart) { >+ if (getPart(partBeingActivated, false) != newPart) { > WorkbenchPlugin.log(new RuntimeException(NLS.bind( > "WARNING: Prevented recursive attempt to activate part {0} while still in the middle of activating part {1}", //$NON-NLS-1$ > getId(newPart), getId(partBeingActivated)))); >@@ -2848,8 +2857,7 @@ > if (newPart != null) { > activationList.setActive(newPart); > if (newPart instanceof IEditorPart) { >- IEditorReference ref = (IEditorReference) getReference(newPart); >- makeActiveEditor(ref); >+ makeActiveEditor((IEditorReference)partref); > } > } > activatePart(newPart); >@@ -3471,27 +3479,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); > >@@ -4286,4 +4287,40 @@ > > return isPartVisible(part); > } >+ >+ /** >+ * Return the part for this reference. A convenience method >+ * that handles <code>null</code> cases. >+ * >+ * Try and deal with the MultiEditor ... which has implications for >+ * which "part" the partListeners should be notified about. >+ * >+ * @param ref The reference that might contain a MultiEditor. This >+ * can be <code>null</code>. >+ * @param restore <code>true</code> to restore the part >+ * @return the workbench part, the inner part if it's a MultiEditor, >+ * or <code>null</code> if the reference was <code>null</code> or >+ * restore was <code>false</code> and the part hadn't been activated yet. >+ */ >+ protected IWorkbenchPart getPart(IWorkbenchPartReference ref, >+ boolean restore) { >+ if (ref==null) { >+ return null; >+ } >+ IWorkbenchPart part = ref.getPart(restore); >+ if (part != null && part instanceof MultiEditor) { >+ part = ((MultiEditor) part).getActiveEditor(); >+ } >+ return part; >+ } >+ >+ /** >+ * Check a reference to see if it's a ref to a MultiEditor. >+ * @param ref the reference to check. It can be <code>null</code>. >+ * @return true if the reference is to a MultiEditor. >+ */ >+ protected boolean isMultiReference(IWorkbenchPartReference ref) { >+ return ref instanceof EditorReference >+ && ((EditorReference) ref).isMultiReference(); >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPagePartList.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPagePartList.java,v >retrieving revision 1.3 >diff -u -r1.3 WorkbenchPagePartList.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPagePartList.java 16 May 2005 16:26:55 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPagePartList.java 8 Aug 2005 13:39:03 -0000 >@@ -55,7 +55,7 @@ > protected void fireActivePartChanged(IWorkbenchPartReference oldRef, IWorkbenchPartReference newRef) { > partService.setActivePart(newRef); > >- IWorkbenchPart realPart = newRef == null? null : newRef.getPart(false); >+ IWorkbenchPart realPart = getPart(newRef); > selectionService.setActivePart(realPart); > } > >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 8 Aug 2005 13:39:04 -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() > */
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