Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 135960

Summary: [ViewMgmt] Basic Part List exception
Product: [Eclipse Project] Platform Reporter: Dylan McReynolds <dmcreynolds>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WORKSFORME QA Contact: Remy Suen <remy.suen>
Severity: trivial    
Priority: P5 Keywords: helpwanted
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dylan McReynolds CLA 2006-04-10 14:56:49 EDT
When you have a number of views displayed in the same folder, and there is not enough space to display them all, Eclipse will display the number of hidden views and an arrow to click to view them.

The form which displays the list of unshown views allows the user to type in a name, and the list will update to include only the views containing the name the user typed.  If the user selects a view and hits return, the view is displayed.

If, however, the user types letters which don't match any of the view names, the list shows no views.  But in that state, if the user clicks "return", the Workbench throws an assert failed error.

This is generally hidden to the user, but I've working on an RCP application which throws eventLoop errors to the user.  

The assertion is failing in org.eclipse.ui.internal.PartStack because newSelection is null:

    private void presentationSelectionChanged(IPresentablePart newSelection) {
        // Ignore selection changes that occur as a result of removing a part
        if (ignoreSelectionChanges) {
            return;
        }
        LayoutPart newPart = getPaneFor(newSelection);

        // This method should only be called on objects that are already in the layout
        Assert.isNotNull(newPart);

        if (newPart == requestedCurrent) {
            return;
        }

        setSelection(newPart);

        if (newPart != null) {
            newPart.setFocus();
        }

    }

But in org.eclipse.ui.internal.presentations.BasicPartList, should site.selectPart even be called when selectedElement is null?     

    protected void gotoSelectedElement() {
        Object selectedElement = getSelectedElement();

        //close the shell
        dispose();

        site.selectPart((IPresentablePart)selectedElement);
    }
Comment 1 Eric Moffatt CLA 2006-04-11 16:07:09 EDT
Boris, I'm guessing that (loosely speaking...;-) this is a view management issue because if the repro scenarios. If it turns out to be a problem in a more general area please re-direct.
Comment 2 Boris Bokowski CLA 2006-04-11 16:27:55 EDT
Is it possible to reproduce this in the IDE? Nothing appeared in the log when I tried. (Using 3.2M6)
Comment 3 Dylan McReynolds CLA 2006-04-11 16:33:41 EDT
When I threw the IDE in the debugger, I got an entry in the Error Log view.

The message is: 

null argument;

The stack trace is:
org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
	at org.eclipse.jface.util.Assert.isNotNull(Assert.java:149)
	at org.eclipse.jface.util.Assert.isNotNull(Assert.java:125)
	at org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:779)
	at org.eclipse.ui.internal.PartStack.access$0(PartStack.java:771)
	at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:119)
	at org.eclipse.ui.internal.presentations.BasicPartList.gotoSelectedElement(BasicPartList.java:242)
	at org.eclipse.ui.internal.presentations.AbstractTableInformationControl$6.keyPressed(AbstractTableInformationControl.java:370)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:122)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:867)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:852)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:880)
	at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1154)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:876)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1190)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3135)
	at org.eclipse.swt.widgets.Text.WM_CHAR(Text.java:1782)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3038)
	at org.eclipse.swt.widgets.Text.windowProc(Text.java:1777)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1656)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2711)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)


Again, I'm stuck on version 3.1...
Comment 4 Boris Bokowski CLA 2009-11-11 17:32:14 EST
Remy is now responsible for watching the [ViewMgmt] category.
Comment 5 Remy Suen CLA 2010-04-14 08:37:51 EDT
(In reply to comment #0)
> But in org.eclipse.ui.internal.presentations.BasicPartList, should
> site.selectPart even be called when selectedElement is null?     
> 
>     protected void gotoSelectedElement() {
>         Object selectedElement = getSelectedElement();
> 
>         //close the shell
>         dispose();
> 
>         site.selectPart((IPresentablePart)selectedElement);
>     }

A null check was added by Doug between for v1.7 of BasicPartList. Dylan, if you're still seeing this in more recent versions of Eclipse, please let us know.