Skip to content

Commit

Permalink
TEIIDDES-2159 maded copy of editor list and added check for disposed …
Browse files Browse the repository at this point in the history
…editor page control
  • Loading branch information
blafond committed May 15, 2014
1 parent 6b90273 commit 1b81bff
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
import static org.teiid.designer.ui.PluginConstants.Prefs.General.AUTO_OPEN_EDITOR_IF_NEEDED;
import static org.teiid.designer.ui.UiConstants.Util;
import static org.teiid.designer.ui.UiConstants.Extensions.MODEL_EDITOR;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
Expand Down Expand Up @@ -173,10 +176,12 @@ public static void autoSelectEditor( final ModelEditor editor,
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
for (Iterator iter = editor.getAllEditors().iterator(); iter.hasNext();) {
Object nextPage = iter.next();
if (nextPage == thePage) {
editor.selectPage(thePage);
List copyOfAllEditors = new ArrayList(editor.getAllEditors());
for (Object nextPage : copyOfAllEditors) {
if( nextPage instanceof ModelEditorPage ) {
if (nextPage == thePage && !((ModelEditorPage)nextPage).getControl().isDisposed()) {
editor.selectPage(thePage);
}
}
}
}
Expand Down

0 comments on commit 1b81bff

Please sign in to comment.