Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Making view visible throws IndexOutOfBoundsException
Making view visible throws IndexOutOfBoundsException [message #696365] Wed, 13 July 2011 19:39 Go to next message
Alex Molochnikov is currently offline Alex MolochnikovFriend
Messages: 25
Registered: July 2009
Junior Member
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(
at org.eclipse.ui.internal.PartStack.replace(
at org.eclipse.ui.internal.Perspective.showView(
at org.eclipse.ui.internal.WorkbenchPage$
at org.eclipse.swt.custom.BusyIndicator.showWhile(

Any idea as to what to look for?


Alex Molochnikov
Fugro Seismic Imaging
Re: Making view visible throws IndexOutOfBoundsException [message #698000 is a reply to message #696365] Mon, 18 July 2011 15:19 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You might have to put your view creation in a job or display.asyncExec(*) to allow your editor part creation to finish before the showView(*) is called.

If that doesn't help, please open a bug at


Previous Topic:[solved] popupMenus on IMarker
Next Topic:How to change the caption of a button in the eclipse main toolbar
Goto Forum:

Current Time: Thu Apr 26 04:09:10 GMT 2018

Powered by FUDForum. Page generated in 0.02067 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software