Making view visible throws IndexOutOfBoundsException [message #696365] |
Wed, 13 July 2011 15:39  |
Eclipse User |
|
|
|
I have a view that is displayed automatically when the editor becomes
active. If the editor is opened following selection of an IResource,
everything works. However, if it is restored from the previous session,
and the editor is not active when restored (i.e. some other editor has
focus), then making this editor active again throws
IndexOutOfBoundsException in this code fragment:
IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
try {
if (page != null) {
MyView view = (MyView) page.findView(MyView.ID);
if (view == null) {
page.showView(MyView.ID, null, IWorkbenchPage.VIEW_CREATE); //
line 1068: throws IndexOutOfBoundsException
}
}
....
The exception is:
java.lang.IndexOutOfBoundsException: Index: -1, Size: 3
at java.util.ArrayList.add(ArrayList.java:367)
at org.eclipse.ui.internal.PartStack.replace(PartStack.java:912)
at
org.eclipse.ui.internal.PerspectiveHelper.addPart(PerspectiveHelper.java:400)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2331)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1071)
at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3822)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3819)
at
MyEditor.updateMyView(MyEditor.java:1068)
....
Any idea as to what to look for?
Thanks,
Alex Molochnikov
Fugro Seismic Imaging
|
|
|
|
Powered by
FUDForum. Page generated in 0.03346 seconds