Bug 96129 - [MPE] (regression) MultiEditor.getInnerEditors() returns null.
Summary: [MPE] (regression) MultiEditor.getInnerEditors() returns null.
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 3.1.1   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-20 12:51 EDT by Erin Harris CLA
Modified: 2005-09-20 12:08 EDT (History)
10 users (show)

See Also:


Attachments
Exception that's thrown (4.94 KB, text/plain)
2005-06-08 17:24 EDT, Paul Webster CLA
no flags Details
Recursive exception thrown (5.64 KB, text/plain)
2005-06-13 11:15 EDT, Paul Webster CLA
no flags Details
patch to ui.workbench to fix NullPointerException (12.58 KB, patch)
2005-06-17 11:03 EDT, Paul Webster CLA
no flags Details | Diff
Fix ui.workbench NPE (12.58 KB, patch)
2005-06-27 10:19 EDT, Paul Webster CLA
no flags Details | Diff
multieditor tests v01 (19.22 KB, patch)
2005-06-28 14:09 EDT, Paul Webster CLA
no flags Details | Diff
multieditor tests v02 (40.19 KB, patch)
2005-06-30 14:09 EDT, Paul Webster CLA
no flags Details | Diff
multieditor tests v03 (28.85 KB, patch)
2005-07-05 14:40 EDT, Paul Webster CLA
no flags Details | Diff
Updated tests after code review (33.43 KB, patch)
2005-07-07 15:12 EDT, Paul Webster CLA
no flags Details | Diff
NPE ui.workbench patch updated to post-3.1 HEAD (12.52 KB, patch)
2005-07-21 09:47 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v01 (23.88 KB, patch)
2005-07-25 15:26 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v02 (18.69 KB, patch)
2005-07-28 15:05 EDT, Paul Webster CLA
no flags Details | Diff
UI tests for 3.1.1 v01 (35.17 KB, patch)
2005-07-28 15:06 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v03 (19.62 KB, patch)
2005-08-03 12:01 EDT, Paul Webster CLA
no flags Details | Diff
patch for word completion (1.15 KB, patch)
2005-08-05 02:40 EDT, ulrich köster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v04 (20.20 KB, patch)
2005-08-08 09:43 EDT, Paul Webster CLA
no flags Details | Diff
UI tests for 3.1.1 v02 (37.79 KB, patch)
2005-08-08 09:44 EDT, Paul Webster CLA
no flags Details | Diff
UI tests for 3.1.1 v03 (37.66 KB, patch)
2005-08-08 10:45 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v05 (24.40 KB, patch)
2005-08-09 09:00 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v06 (24.15 KB, patch)
2005-08-09 15:01 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v07 (15.08 KB, patch)
2005-08-09 18:13 EDT, Paul Webster CLA
no flags Details | Diff
UI tests for 3.1.1 v04 (38.83 KB, patch)
2005-08-09 18:14 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor functionality patch for 3.1.1 v08 (11.94 KB, patch)
2005-08-10 15:14 EDT, Paul Webster CLA
no flags Details | Diff
MultiEditor 3.2 fix (11.85 KB, patch)
2005-08-15 11:31 EDT, Paul Webster CLA
no flags Details | Diff
Minor update to the 3.2 MultiEditor tests (11.45 KB, patch)
2005-08-15 11:32 EDT, Paul Webster CLA
no flags Details | Diff
Minor update to the 3.2 MultiEditor tests v2 (13.49 KB, patch)
2005-08-15 15:24 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erin Harris CLA 2005-05-20 12:51:51 EDT
The createPartControl() method of my class that extends
org.eclipse.ui.part.MultiEditor calls getInnerEditors() so that it can call
createInnerPartControl() for each of the inner editors.  But getInnerEditors()
returns null.  It looks like this is because setChildren() is never called.  The
only place this method seems to get called from is from
EditorManager.openMultiEditor().  I put a breakpoint in this method and it never
got hit.

I am using Eclipse 3.1 M7. The same code worked fine with Eclipse 3.0.
Comment 1 Nick Edgar CLA 2005-05-20 15:53:26 EDT
Stefan, could you please help with this one?
Comment 2 Douglas Pollock CLA 2005-05-27 14:23:58 EDT
In the absence of Stefan, moving these to 3.1 RC2.  They will not be addressed
for 3.1 RC1.
Comment 3 Paul Webster CLA 2005-06-08 17:24:56 EDT
Created attachment 22644 [details]
Exception that's thrown

Reproduced the exception using the updated tilededitor from bug 42641.

This problem seems somehow related to changes in the editor lifecycle?	The
code that used to be in EditorManager called to part.setChildren() ... but now
EditorManager.createEditorTab() doesn't make the call, since the part hasn't
been instantiated yet.

PW
Comment 4 Stefan Xenos CLA 2005-06-08 19:32:10 EDT
No more time for RC2.
Comment 5 Paul Webster CLA 2005-06-10 09:26:55 EDT
The updated tilededitor example works in 3.0.2

It looks like the org.eclipse.ui.internal.EditorManager was refactored in 3.1.

EditorManager.openEditorFromDescriptor() in 3.0.x calls
EditorManager.openInternalEditor(), which created the main editor part and
called EditorManager.createEditorTab() -> EditorManager.openMultiEditor() which
set the inner children.

In 3.1, EditorManager.openEditorFromDescriptor() gets the EditorReference and
then calls EditorManager.createEditorTab(), which just adds the editor reference
to the editorPresentation.  The old code from createEditorTab() wouldn't work,
because the main editor part wasn't created.

It looks like the EditorAreaHelper? is now responsible for creating parts, and
when it calls into TiledEditor.createPartControl(), with no children set it
throws the NPE.

PW
Comment 6 Paul Webster CLA 2005-06-13 11:15:35 EDT
Created attachment 22931 [details]
Recursive exception thrown

EditorManager used to call createPart() and then call createPart() for all of
the inner children.  The createPart() functionality has been moved to the
EditorAreaHelper.

Moving the call to EditorManager.openMultiEditor() to the equivalent place as
the call to createPart() in the EditorAreaHelper fixed the NPE, but caused a
recursive activation error.

!MESSAGE WARNING: Prevented recursive attempt to activate part
org.eclipse.ui.examples.tilededitor.TiledEditor while still in the middle of
activating part org.eclipse.ui.examples.tilededitor.TiledEditor
Comment 7 Michael Van Meekeren CLA 2005-06-14 15:23:20 EDT
Kevin can you approve fixing this for RC3?

Once we have a fix Erin, can you verify that it works for you?
Comment 8 Michael Van Meekeren CLA 2005-06-14 15:26:47 EDT
In addition, the WARNING should only happen in debug mode
Comment 9 Erin Harris CLA 2005-06-15 15:02:18 EDT
Let me know when you have a fix and I will try to test it.  My plugins depend on
a group of plugins that are only building with RC1 right now so I will try to
test the fix with that level.
Comment 10 Paul Webster CLA 2005-06-17 11:03:34 EDT
Created attachment 23457 [details]
patch to ui.workbench to fix NullPointerException

MultiEditors now have their children parts created by the same component that
creates MultiEditor parts.  Disposing the EditorReference for a MultiEditor
also disposes the child EditorReferences first.

There is still some investigation into activating the inner part correctly.

PW
Comment 11 Douglas Pollock CLA 2005-06-17 14:45:43 EDT
For 3.2 or possibly 3.1.1.
Comment 12 Paul Webster CLA 2005-06-27 10:19:19 EDT
Created attachment 24032 [details]
Fix ui.workbench NPE 

This is the RC4 compatible patch that fixes the NPE, unfortunately without
actually fixing MultiEditor.

PW
Comment 13 Paul Webster CLA 2005-06-28 14:09:09 EDT
Created attachment 24096 [details]
multieditor tests v01

First 2 MultiEditor unit tests.  They include a ui.tests version of the
TiledEditor.

The tests are being managed in patch form, since they fail outright against
3.1.

PW
Comment 14 Michael Van Meekeren CLA 2005-06-29 16:44:50 EDT
Actually I don't see why we don't just put these tests into the test plug-in
now, so we don't lost track.  The only thing we have to make sure is that until
we are ready, they are not being run as part of the test cycle.
Comment 15 Paul Webster CLA 2005-06-30 14:09:35 EDT
Created attachment 24227 [details]
multieditor tests v02

More information gathered (including my disabled coolbar icons), but they still
need some more work.

PW
Comment 16 Paul Webster CLA 2005-07-05 14:40:37 EDT
Created attachment 24358 [details]
multieditor tests v03

There are 3 mutlieditor tests.

1. basic open with the same file type
2. call history order of operations that works in 3.0
3. swapping between different inner editors to check that the outline view gets
updated by the inner ant editor.

These tests are not attached to the main test suite run.   All 3 tests will
fail without the NPE patch, and tests 2 and 3 will fail even with the NPE
patch.

These can be committed to HEAD.

PW
Comment 17 Paul Webster CLA 2005-07-07 15:12:32 EDT
Created attachment 24437 [details]
Updated tests after code review

I've updated the tests after a code review with Stefan.

1. Comment adjustments
2. Any unexpected exception on editor open is flagged
3. call history test includes open, a setFocus, and a close
4. coolbar tracking split into different test than outline view tracking.

Later,
PW
Comment 18 Stefan Xenos CLA 2005-07-07 16:51:48 EDT
Committed the tests patch from comment 17.
Comment 19 Steven Wasleski CLA 2005-07-14 16:00:49 EDT
What is the status on this bug?  In particular:

Did either of the patches to fix the NPE (comment 10 or comment 12) make it 
into 3.1?

Is there a way to work around the problem?

Finally, could this be targeted for 3.1.1?
Comment 20 Michael Van Meekeren CLA 2005-07-20 11:13:25 EDT
Unfortunately this was not fixed in 3.1.  We are still investigating an
acceptable solution for 3.1.1.  
Comment 21 Paul Webster CLA 2005-07-21 09:47:05 EDT
Created attachment 25128 [details]
NPE ui.workbench patch updated to post-3.1 HEAD

It's the NPE patch updated against the 3.2 changes.

PW
Comment 22 Paul Webster CLA 2005-07-21 15:41:58 EDT
Investigation shows that at least some of the 3.0 functionality can be returned
by focusing on the PartList/ActionationList/PartListenerList.

Some of the interfaces were updated to deal with the reference instead of the
part, and then optimizations were added to avoid re-activating if the reference
was already active.

MultiEditor is in the situation where it is the same active reference (the
parent MultiEditor) but a new active part (the inner editor).

More investigation is needed.

PW
Comment 23 Michael Van Meekeren CLA 2005-07-21 16:10:02 EDT
marking for 3.1.1 as discussed Paul will keep investigating to find a solution
that brings us to the 3.0 support level or better for 3.1.1
Comment 24 Paul Webster CLA 2005-07-25 15:26:01 EDT
Created attachment 25262 [details]
MultiEditor functionality patch for 3.1.1 v01

This patch seems to provide most of the MultiEditor functionality like 3.0. 
It's still in the hack stage, and encapsulating the information I need probably
means updating IWorkbenchPart and IWorkbenchPartReference. I'm hesitant to
expose MultiEditor checks in the interfaces.

It does need a better encapsulation of MultiEditor checks in both
IWorkbenchPart and IWorkbenchPartReference, as now there are MultiEditor and
MultiEditorInnerPane checks throughout WorkbenchPage and PartList.

PW
Comment 25 Paul Webster CLA 2005-07-28 15:05:01 EDT
Created attachment 25425 [details]
MultiEditor functionality patch for 3.1.1 v02

This patch brings back most of the functionality to MultiEditor that was
available in 3.0.

All of the UI tests pass with this patch, as well as the 4 MultiEditor tests.

PW
Comment 26 Paul Webster CLA 2005-07-28 15:06:12 EDT
Created attachment 25426 [details]
UI tests for 3.1.1 v01

The tests for MultiEditor for 3.1.1 ... hooked into UITestSuite.

PW
Comment 27 Paul Webster CLA 2005-08-03 12:01:11 EDT
Created attachment 25620 [details]
MultiEditor functionality patch for 3.1.1 v03

Updated some comments for methods that support null.

PW
Comment 28 ulrich köster CLA 2005-08-05 02:40:38 EDT
Created attachment 25735 [details]
patch for word completion

This patch brings back the word completion from patch 3.1.1 v01.

One thing is broken in the patch for 3.1.1 v03 that worked in patch v01. The
word completion.

The patch requires the patch for 3.1.1 v03.
Comment 29 ulrich köster CLA 2005-08-05 04:11:28 EDT
Things broken in patch v3 working in v1:
Selection: Actions are going into the wrong editor after set setting the focus from one editor to the other.
Menu: Actions without keyboard shortcuts. Many of them don't work at all. (Word Completion for 
instance.)
Outline: Editor displays only the Outline from the first Editor. v1 of the patch was able to switch the outline 
together with editor.

Comment 30 Paul Webster CLA 2005-08-08 09:43:29 EDT
Created attachment 25831 [details]
MultiEditor functionality patch for 3.1.1 v04

This contains Ulrich's update and a minor matching fix in WorkbenchPage.

Thanx, Ulrich

PW
Comment 31 Paul Webster CLA 2005-08-08 09:44:28 EDT
Created attachment 25832 [details]
UI tests for 3.1.1 v02

This contains the updated tests that match MultiEditor 3.1.1 v04

PW
Comment 32 Paul Webster CLA 2005-08-08 10:45:52 EDT
Created attachment 25834 [details]
UI tests for 3.1.1 v03

Fixed a test and added some comments

PW
Comment 33 ulrich köster CLA 2005-08-08 14:05:50 EDT
Working in v4:
Selection: Actions are going into the right editor after set setting the focus from one editor to the other.
Menu: Actions with keyboard shortcuts. (Word Completion for 
instance.)
Outline: Each Editor has the correct outline.

One problem:
 The "mark occurencies" in the embedded Java Editor won't work. I don't know if it ever worked in an 
embedded editor.

So far so good.

Is there an estimate when the stuff goes into the cvs.
Comment 34 Stefan Xenos CLA 2005-08-08 16:19:40 EDT
Problems with this patch:

- IWorkbenchPage.getActivePart() points to a different part than
IWorkbenchPage.getActivePartReference() when a multi-editor is active (the
reference points to the outer editor and the part points to the inner editor).
This will cause various code that uses the active part to get out of synch.

- There are extra focus changes on part activation.
Comment 35 Stefan Xenos CLA 2005-08-08 17:54:08 EDT
Paul: when we first discussed this, I said that there was another problem in
that the active part (an inner editor) would not be in the editor list or
activation list.

I now agree with you: this is probably okay to leave for a future fix. All we
need to ensure initially is that both the active part and active reference both
point to the same spot (the inner editor).
Comment 36 Stefan Xenos CLA 2005-08-08 17:56:34 EDT
The use of a child editor list within editor reference is clever and useful. I'd
suggest expanding on that in 3.2: it could permit MultiEditors to be persisted
between sessions if the list were recreated in the constructor rather than with
the part.
Comment 37 Paul Webster CLA 2005-08-09 09:00:02 EDT
Created attachment 25890 [details]
MultiEditor functionality patch for 3.1.1 v05

I've updated the patch so that IWorkbenchPage#getActiveEditorReference()
returns the inner editor reference, not the MultiEditor editor reference.

I've checked 3.0.2, and for MultiEditors we've always returned the active inner
part and the active MultiEditor reference, and that is how we've fired change
events.

If we need to fire change events for Inner Editor references, then we'll need
to open a bug report for this and look at addressing this for 3.2.

PW
Comment 38 Paul Webster CLA 2005-08-09 15:01:59 EDT
Created attachment 25923 [details]
MultiEditor functionality patch for 3.1.1 v06

I've updated the patch so that IWorkbenchPage#getActiveEditorReference()
returns the MultiEditor editor reference.

That makes it consistent with what was available in 3.0.2

PW
Comment 39 Paul Webster CLA 2005-08-09 18:13:26 EDT
Created attachment 25936 [details]
MultiEditor functionality patch for 3.1.1 v07

Slightly re-worked patch ... the outline tracks the inner editors, but it
maintains the invariant (activePartReference().getPart(false)==activePart())

Markers show up, but some of the Java pre-compile squiggles don't.

PW
Comment 40 Paul Webster CLA 2005-08-09 18:14:43 EDT
Created attachment 25937 [details]
UI tests for 3.1.1 v04

Tests that match the MultiEditor 3.1.1 v07
Comment 41 Douglas Pollock CLA 2005-08-10 14:55:56 EDT
Review of patch: 
+ This patch rolls back (well, modifies) the fix for Bug 43010.  Does the 
problem described in Bug 43010 exist with this patch? 
+ The patch leaves a TODO in MultiPageEditorSite and CompatibilityPartSite.  
Is this intentional? 
+ This patch adds API.  I'm not sure that this is kosher.... 
 
Comment 42 Douglas Pollock CLA 2005-08-10 15:12:20 EDT
Also, some of the tests are marked as "@since 3.1" and some aren't marked at 
all. 
Comment 43 Paul Webster CLA 2005-08-10 15:14:16 EDT
Created attachment 25990 [details]
MultiEditor functionality patch for 3.1.1 v08

Removed new API for 3.1.1 patch.

PW
Comment 44 Douglas Pollock CLA 2005-08-10 16:32:30 EDT
Patches committed to CVS, and should appear in M20050811-0400.  This patch has    
not caused Bug 43010 to reappear.  The API has been removed.  All new test  
classes are marked as 3.1.1.  The TODOs are gone.  
 
Does this patch also need to be applied to the 3.2 stream?  Or do you want to 
modify it for 3.2 (e.g., to include the new API)? 
 
Comment 45 Paul Webster CLA 2005-08-15 11:31:46 EDT
Created attachment 26109 [details]
MultiEditor 3.2 fix

The 3.2 version of the patch.

PW
Comment 46 Paul Webster CLA 2005-08-15 11:32:43 EDT
Created attachment 26111 [details]
Minor update to the 3.2 MultiEditor tests

Some minor updates to the MultiEditor tests that were already added.

PW
Comment 47 Paul Webster CLA 2005-08-15 15:24:39 EDT
Created attachment 26121 [details]
Minor update to the 3.2 MultiEditor tests v2

Update with a fix to avoid interactions with the drag tests.

PW
Comment 48 Tod Creasey CLA 2005-08-15 15:56:43 EDT
3.2 patches added for build >20050815
Comment 49 Steven Wasleski CLA 2005-08-18 10:27:16 EDT
Should this bug move to RESOLVED FIXED now that the fix is in both the 3.1.1 
and 3.2 streams?
Comment 50 Paul Webster CLA 2005-08-18 10:40:50 EDT
Released into 3.1.1 and 3.2

PW
Comment 51 ulrich köster CLA 2005-09-02 09:06:52 EDT
Two issues left:

1. The outline is still visible after closing the editor. I've found a bugreport for that issue.
2. The find diaglog is able to find find/replace but does not display the selection (the highlighting) of the 
search result. I had no luck to find a bug report for that issue. Should I open a new report or reopen this 
one?
Comment 52 Paul Webster CLA 2005-09-02 11:33:30 EDT
(In reply to comment #51)
> 2. The find diaglog is able to find find/replace but does not display the
selection (the highlighting) of the 
> search result. I had no luck to find a bug report for that issue. Should I
open a new report or reopen this 
> one?

I was hoping that this might have to do with bug 108324 (text selection and post
selection listeners) but that PR is a problem with MultiPageEditorParts.  Please
open a new PR for issue #2.  Thanx.

PW
Comment 53 Paul Webster CLA 2005-09-20 12:08:34 EDT
verified in 3.2