Fixed ClassNotFoundException

if EditorActionManager.getInstance() is executed under canceled progress (which is now a normal case for some reasons) then ConsoleViewImpl is not loaded and thus class considered not found.
This commit is contained in:
Oleg Sukhodolsky
2015-03-25 13:24:24 +03:00
parent 99680a8633
commit b68191eda4
@@ -100,10 +100,14 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
public static final Key<ConsoleViewImpl> CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW"); public static final Key<ConsoleViewImpl> CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW");
static { private static boolean ourTypedHandlerInitialized;
private static synchronized void initTypedHandler() {
if (ourTypedHandlerInitialized) return;
final EditorActionManager actionManager = EditorActionManager.getInstance(); final EditorActionManager actionManager = EditorActionManager.getInstance();
final TypedAction typedAction = actionManager.getTypedAction(); final TypedAction typedAction = actionManager.getTypedAction();
typedAction.setupHandler(new MyTypedHandler(typedAction.getHandler())); typedAction.setupHandler(new MyTypedHandler(typedAction.getHandler()));
ourTypedHandlerInitialized = true;
} }
@@ -281,6 +285,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
boolean usePredefinedMessageFilter) boolean usePredefinedMessageFilter)
{ {
super(new BorderLayout()); super(new BorderLayout());
initTypedHandler();
myIsViewer = viewer; myIsViewer = viewer;
myState = initialState; myState = initialState;
myPsiDisposedCheck = new DisposedPsiManagerCheck(project); myPsiDisposedCheck = new DisposedPsiManagerCheck(project);
@@ -498,19 +503,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
return this; return this;
} }
/**
* Adds transparent (actually, non-opaque) component over console.
* It will be as big as console. Use it to draw on console because it does not prevent user from console usage.
*
* @param component component to add
*/
public final void addLayerToPane(@NotNull final JComponent component) {
getComponent(); // Make sure component exists
component.setOpaque(false);
component.setVisible(true);
myJLayeredPane.add(component, 0);
}
protected void initConsoleEditor() { protected void initConsoleEditor() {
myEditor = createConsoleEditor(); myEditor = createConsoleEditor();
registerConsoleEditorActions(); registerConsoleEditorActions();