diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
index 8ee2f1ee587a..28d4c5ed1425 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
@@ -810,6 +810,7 @@ public class XDebugSessionImpl implements XDebugSession {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
+ if (myProject.isDisposed()) return;
Editor editor = XDebuggerUtilImpl.createEditor(new OpenFileDescriptor(myProject, position.getFile()));
if (editor != null) {
JComponent component = editor.getComponent();
diff --git a/python/edu/learn-python/resources/META-INF/plugin.xml b/python/edu/learn-python/resources/META-INF/plugin.xml
index ed59420570ba..8e8bddcce5e5 100644
--- a/python/edu/learn-python/resources/META-INF/plugin.xml
+++ b/python/edu/learn-python/resources/META-INF/plugin.xml
@@ -50,7 +50,7 @@
-
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java b/python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java
index ab26309af4ca..3013fbcb05d3 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java
+++ b/python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java
@@ -109,19 +109,23 @@ public class StudyTaskManager implements ProjectComponent, PersistentStateCompon
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
- ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.PROJECT_VIEW).show(null);
- FileEditor[] editors = FileEditorManager.getInstance(myProject).getSelectedEditors();
- if (editors.length > 0) {
- final JComponent focusedComponent = editors[0].getPreferredFocusedComponent();
- if (focusedComponent != null) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- @Override
- public void run() {
- IdeFocusManager.getInstance(myProject).requestFocus(focusedComponent, true);
+ ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.PROJECT_VIEW).show(new Runnable() {
+ @Override
+ public void run() {
+ FileEditor[] editors = FileEditorManager.getInstance(myProject).getSelectedEditors();
+ if (editors.length > 0) {
+ final JComponent focusedComponent = editors[0].getPreferredFocusedComponent();
+ if (focusedComponent != null) {
+ ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ IdeFocusManager.getInstance(myProject).requestFocus(focusedComponent, true);
+ }
+ });
}
- });
+ }
}
- }
+ });
}
});
UISettings.getInstance().HIDE_TOOL_STRIPES = false;
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java
index 79e7325f5320..5d02f7149aab 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java
+++ b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java
@@ -15,7 +15,9 @@ import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.ui.popup.*;
+import com.intellij.openapi.ui.popup.Balloon;
+import com.intellij.openapi.ui.popup.BalloonBuilder;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -93,7 +95,7 @@ public class StudyCheckAction extends DumbAwareAction {
@Override
public void run() {
final StudyEditor selectedEditor = StudyEditor.getSelectedStudyEditor(project);
- StudyState studyState = new StudyState(selectedEditor);
+ final StudyState studyState = new StudyState(selectedEditor);
if (!studyState.isValid()) {
LOG.error("StudyCheckAction was invokes outside study editor");
return;
@@ -107,6 +109,12 @@ public class StudyCheckAction extends DumbAwareAction {
if (runAction != null && taskFiles.size() == 1) {
runAction.run(project);
}
+ ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ IdeFocusManager.getInstance(project).requestFocus(studyState.getEditor().getComponent(), true);
+ }
+ });
final StudyTestRunner testRunner = new StudyTestRunner(task, taskDir);
Process testProcess = null;
try {
@@ -255,12 +263,7 @@ public class StudyCheckAction extends DumbAwareAction {
assert studyEditor != null;
JButton checkButton = studyEditor.getCheckButton();
balloon.showInCenterOf(checkButton);
- balloon.addListener(new JBPopupAdapter() {
- @Override
- public void onClosed(LightweightWindowEvent event) {
- Disposer.dispose(balloon);
- }
- });
+ Disposer.register(project, balloon);
}
@Override
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskAction.java b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskFileAction.java
similarity index 93%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskAction.java
rename to python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskFileAction.java
index 11beed226757..a9448ddea0e3 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskAction.java
+++ b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskFileAction.java
@@ -11,7 +11,9 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.ui.popup.*;
+import com.intellij.openapi.ui.popup.Balloon;
+import com.intellij.openapi.ui.popup.BalloonBuilder;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -23,8 +25,8 @@ import com.jetbrains.python.edu.editor.StudyEditor;
import java.io.*;
-public class StudyRefreshTaskAction extends DumbAwareAction {
- private static final Logger LOG = Logger.getInstance(StudyRefreshTaskAction.class.getName());
+public class StudyRefreshTaskFileAction extends DumbAwareAction {
+ private static final Logger LOG = Logger.getInstance(StudyRefreshTaskFileAction.class.getName());
public void refresh(final Project project) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@@ -104,12 +106,7 @@ public class StudyRefreshTaskAction extends DumbAwareAction {
StudyEditor selectedStudyEditor = StudyEditor.getSelectedStudyEditor(project);
assert selectedStudyEditor != null;
balloon.showInCenterOf(selectedStudyEditor.getRefreshButton());
- balloon.addListener(new JBPopupAdapter() {
- @Override
- public void onClosed(LightweightWindowEvent event) {
- Disposer.dispose(balloon);
- }
- });
+ Disposer.register(project, balloon);
}
catch (FileNotFoundException e1) {
LOG.error(e1);
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java b/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java
index 083cc4a91f25..6b27c4a406db 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java
+++ b/python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java
@@ -241,8 +241,8 @@ public class StudyEditor implements TextEditor {
myRefreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- StudyRefreshTaskAction studyRefreshTaskAction =
- (StudyRefreshTaskAction)ActionManager.getInstance().getAction("RefreshTaskAction");
+ StudyRefreshTaskFileAction studyRefreshTaskAction =
+ (StudyRefreshTaskFileAction)ActionManager.getInstance().getAction("RefreshTaskAction");
studyRefreshTaskAction.refresh(myProject);
}
});