mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-177669
Focus returns to the editor instead of a tool window after canceling some dialogs
This commit is contained in:
@@ -35,7 +35,7 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,11 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
|
||||
}
|
||||
|
||||
Component findChildToFocus (Component component) {
|
||||
|
||||
final Window ancestor = SwingUtilities.getWindowAncestor(ThreeComponentsSplitter.this);
|
||||
final Component mostRecentFocusOwner = ancestor.getMostRecentFocusOwner();
|
||||
if (mostRecentFocusOwner != null && mostRecentFocusOwner.isShowing()) {
|
||||
return mostRecentFocusOwner;
|
||||
}
|
||||
if (component instanceof JPanel) {
|
||||
JPanel container = (JPanel)component;
|
||||
final FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
|
||||
|
||||
+5
@@ -29,6 +29,7 @@ import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.registry.RegistryValue;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -79,6 +80,10 @@ public class ToggleDistractionFreeModeAction extends DumbAwareAction {
|
||||
EditorUtil.reinitSettings();
|
||||
DaemonCodeAnalyzer.getInstance(project).settingsChanged();
|
||||
EditorFactory.getInstance().refreshAllEditors();
|
||||
final JFrame projectJFrame = WindowManager.getInstance().getFrame(project);
|
||||
if (projectJFrame != null) {
|
||||
projectJFrame.transferFocus();
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyAndSave(@NotNull PropertiesComponent p,
|
||||
|
||||
Reference in New Issue
Block a user