delay access to IdeFocusManager from IdeEventQueue until application component loading is completed (IDEA-84961)

This commit is contained in:
Dmitry Jemerov
2012-04-25 13:11:20 +02:00
parent d532459263
commit fe9bba5c3f
4 changed files with 17 additions and 3 deletions
@@ -24,6 +24,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.impl.ApplicationImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher;
@@ -608,7 +609,7 @@ public class IdeEventQueue extends EventQueue {
if (focusOwner == null || !focusOwner.isShowing() || focusOwner instanceof JFrame || focusOwner instanceof JDialog) {
final Application app = ApplicationManager.getApplication();
if (app instanceof ApplicationImpl && !((ApplicationImpl) app).isComponentsCreated()) {
if (app instanceof ApplicationEx && !((ApplicationEx) app).isLoaded()) {
return;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ public interface ApplicationEx extends Application {
* @throws InvalidDataException
*/
void load(String optionsPath) throws IOException, InvalidDataException;
boolean isLoaded();
@NotNull
String getName();
@@ -164,6 +164,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
}
);
private boolean myIsFiringLoadingEvent = false;
private boolean myLoaded = false;
@NonNls private static final String WAS_EVER_SHOWN = "was.ever.shown";
private Boolean myActive;
@@ -550,6 +551,12 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
finally {
HeavyProcessLatch.INSTANCE.processFinished();
}
myLoaded = true;
}
@Override
public boolean isLoaded() {
return myLoaded;
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +48,11 @@ public class MockApplicationEx extends MockApplication implements ApplicationEx
public void load(String path) throws IOException, InvalidDataException {
}
@Override
public boolean isLoaded() {
return true;
}
@Override
public void exit(boolean force) {
}