Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 74899 - [DND] NPE in PartSashContainer moving empty editor stacks
Summary: [DND] NPE in PartSashContainer moving empty editor stacks
Status: RESOLVED DUPLICATE of bug 110684
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-23 21:40 EDT by Jean-Michel Lemieux CLA
Modified: 2007-09-11 15:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Michel Lemieux CLA 2004-09-23 21:40:07 EDT
This happens a lot in my RCP application because none of my editors are
persistable. Here are the steps to reproduce with the SDK:
1. open CVS repositories view
2. close all open editors
3. open two remote files
4. move the editors so that they are side-by-side
5. ensure that only the two editors are open, no other.
6. restart Eclipse. Notice that there are two editor stacks that are empty. Try
and drag them together. NPE all the time. Eclipse can't open any editors after that.


java.lang.NullPointerException
at org.eclipse.ui.internal.PartSashContainer.dropObject(PartSashContainer.java:1092)
at
org.eclipse.ui.internal.PartSashContainer$SashContainerDropTarget.drop(PartSashContainer.java:130)
at org.eclipse.ui.internal.dnd.DragUtil.performDrag(DragUtil.java:130)
at org.eclipse.ui.internal.PartStack.dragStart(PartStack.java:1272)
at org.eclipse.ui.internal.PartStack$1.dragStart(PartStack.java:85)
at
org.eclipse.ui.internal.presentations.newapi.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:95)
at
org.eclipse.ui.internal.presentations.newapi.AbstractTabFolder.fireEvent(AbstractTabFolder.java:263)
at
org.eclipse.ui.internal.presentations.newapi.AbstractTabFolder.fireEvent(AbstractTabFolder.java:276)
at
org.eclipse.ui.internal.presentations.newapi.AbstractTabFolder.handleDragStarted(AbstractTabFolder.java:345)
at
org.eclipse.ui.internal.presentations.newapi.AbstractTabFolder$2.handleEvent(AbstractTabFolder.java:68)
at
org.eclipse.ui.presentations.PresentationUtil.handleMouseMove(PresentationUtil.java:96)
at org.eclipse.ui.presentations.PresentationUtil.access$4(PresentationUtil.java:89)
at
org.eclipse.ui.presentations.PresentationUtil$2.handleEvent(PresentationUtil.java:61)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2783)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2442)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1443)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1414)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:271)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
Comment 1 CLA 2004-12-17 04:35:54 EST
I can confirm this.

I am writing an RCP application where I have two or more EditorParts open in 
my RCP app that have been docked either side by side or on top of each other 
in the editor area, and then I quit the app.

Upon relaunching the app, the editor area still contains the divider (sash?) 
lines, but no editor parts.  Launching a new editor part puts the editor part 
in one of the sash areas, but when dragging to a new location leads to an 
error:

!MESSAGE Index out of bounds
!STACK 0
java.lang.IllegalArgumentException: Index out of bounds
at org.eclipse.swt.SWT.error(SWT.java:2677)
at org.eclipse.swt.SWT.error(SWT.java:2616)
at org.eclipse.swt.SWT.error(SWT.java:2587)
at org.eclipse.swt.custom.CTabFolder.getItem(CTabFolder.java:1213)
at org.eclipse.ui.internal.presentations.PaneFolder.getIte(PaneFolder.java:597)
at org.eclipse.ui.internal.presentations.DefaultPartPresentation.dragOver
(DefaultPartPresentation.java:1253)
at org.eclipse.ui.internal.PartStack$2.drag(PartStack.java:419)
at org.eclipse.ui.internal.dnd.DragUtil.getDropTarget(DragUtil.java:303)
at org.eclipse.ui.internal.dnd.DragUtil.getDropTarget(DragUtil.java:323)
at org.eclipse.ui.internal.dnd.DragUtil$2.run(DragUtil.java:211)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:135)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:25)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:3096)
at org.eclipse.ui.internal.dnd.DragUtil$1.handleEvent(DragUtil.java:205)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805)
at org.eclipse.swt.widgets.Tracker.open(Tracker.java:584)
at org.eclipse.ui.internal.dnd.DragUtil.dragToTarget(DragUtil.java:260)
at org.eclipse.ui.internal.dnd.DragUtil.performDrag(DragUtil.java:121)
at org.eclipse.ui.internal.PartStack.dragStart(PartStack.java:1147)
at org.eclipse.ui.internal.PartStack$1.dragStart(PartStack.java:78)
at org.eclipse.ui.internal.presentations.DefaultPartPresentation$11.handleEvent
(DefaultPartPresentation.java:333)
at org.eclipse.ui.presentations.PresentationUtil.handleMouseMove
(PresentationUtil.java:89)
at 
org.eclipse.ui.presentations.PresentationUtil.access$4PresentationUtil.java:83)
at org.eclipse.ui.presentations.PresentationUtil$2.handleEvent
(PresentationUtil.java:55)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at uk.ac.reload.straker.StrakerApp.run(StrakerApp.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke 
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)


To get round this problem, I tried closing all open editors on exit in my 
WorkbenchAdvisor like this:

public boolean preWindowShellClose(IWorkbenchWindowConfigurer configurer) {
     IWorkbenchPage page = configurer.getWindow().getActivePage();
     page.closeAllEditors(true);
     return true;
}
 
However, this is not a satisfactory solution since the editor closing 
procedures are now called twice, such that quitting the app with a dirty 
editor invokes the "Save Resources" dialog twice.

Phil Beauvoir
Comment 2 Eric Moffatt CLA 2007-06-21 11:52:54 EDT
It's a bit better now but still opens the two empty ares. However, opening a real file allows you to drag it into the 'empty' stacks, cleaning them up.

Still looks bad though...
Comment 3 Eric Moffatt CLA 2007-09-11 10:39:24 EDT
Boris, do you know anything about the base issue here (i.e. that closing and restarting eclipse with remote files open leaves the WB in an invalid state)?

If that were fixed then this bug would likely not be reproducible...
Comment 4 Boris Bokowski CLA 2007-09-11 11:40:46 EDT
We have a bug for that: Bug 110684. I'd recommend using the steps from this bug to reproduce because it can be done with just the SDK.
Comment 5 Eric Moffatt CLA 2007-09-11 15:05:18 EDT
Paul, I'm going to mark this one as a dup of bug 110684 on the assumption that if we don't re-open 'empty' editors then we won't have any problems dragging them around...;-). Essentially the DnD error is a result of the layout being in a corrupt state at the end of the restart...

Let me know if you think they're different issues.


*** This bug has been marked as a duplicate of bug 110684 ***