mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Proper focus requests through the IDE focus subsystem. Part II.
This commit is contained in:
@@ -25,6 +25,7 @@ import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
@@ -460,7 +461,9 @@ final class ImageEditorUI extends JPanel implements DataProvider, CopyProvider,
|
||||
|
||||
private class FocusRequester extends MouseAdapter {
|
||||
public void mousePressed(@NotNull MouseEvent e) {
|
||||
requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(ImageEditorUI.this, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -613,7 +614,9 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
|
||||
|
||||
private class FocusRequester extends MouseAdapter {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(ThumbnailViewUI.this, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.SpeedSearchBase;
|
||||
import com.intellij.ui.SpeedSearchComparator;
|
||||
import com.intellij.ui.TableUtil;
|
||||
@@ -140,7 +141,9 @@ public class ProcessedModulesTable extends JPanel {
|
||||
public void addModule(Module element, String dirName) {
|
||||
myTableModel.addElement(element, dirName);
|
||||
selectRow(myTableModel.getRowCount() - 1);
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
public void removeModule(Module element) {
|
||||
@@ -161,7 +164,9 @@ public class ProcessedModulesTable extends JPanel {
|
||||
myTable.getSelectionModel().clearSelection();
|
||||
}
|
||||
}
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
public void removeAllElements() {
|
||||
@@ -204,7 +209,9 @@ public class ProcessedModulesTable extends JPanel {
|
||||
final int[] rows = getElementsRows(elements);
|
||||
TableUtil.selectRows(myTable, rows);
|
||||
TableUtil.scrollSelectionToVisible(myTable);
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
private int[] getElementsRows(final Collection<? extends Module> elements) {
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vcs.FileStatusManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
|
||||
@@ -227,7 +228,9 @@ public class ExcludedEntriesConfigurable implements UnnamedConfigurable, NoScrol
|
||||
if(indexToSelect >= 0) {
|
||||
myExcludedTable.setRowSelectionInterval(indexToSelect, indexToSelect);
|
||||
}
|
||||
myExcludedTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myExcludedTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
protected JComponent createMainComponent(){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.InputValidatorEx;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.ui.classFilter.ClassFilterEditor;
|
||||
import com.intellij.util.IconUtil;
|
||||
@@ -72,7 +73,9 @@ public class InstanceFilterEditor extends ClassFilterEditor {
|
||||
myTable.getSelectionModel().setSelectionInterval(row, row);
|
||||
myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
|
||||
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.util.SingleAlarm;
|
||||
@@ -131,6 +132,8 @@ public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements
|
||||
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
getTree().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getTree(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.options.UnnamedConfigurableGroup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.TabbedPaneWrapper;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -119,7 +120,9 @@ public class FacetEditorImpl extends UnnamedConfigurableGroup implements Unnamed
|
||||
if (preferredFocusedComponent != null) {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
if (preferredFocusedComponent.isShowing()) {
|
||||
preferredFocusedComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(preferredFocusedComponent, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.projectWizard;
|
||||
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
@@ -45,7 +46,9 @@ public class ChooseTemplateStep extends ModuleWizardStep {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
myTemplateList.setEnabled(myCreateFromTemplateCheckBox.isSelected());
|
||||
if (myCreateFromTemplateCheckBox.isSelected()) {
|
||||
myTemplateList.getList().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTemplateList.getList(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -397,7 +397,6 @@ abstract class ProjectLayoutPanel<T> extends JPanel {
|
||||
myEntriesChooser.sort(COMPARATOR);
|
||||
myEntriesChooser.selectElements(Collections.singleton(extracted));
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -38,6 +38,7 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.FieldPanel;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
@@ -153,7 +154,9 @@ public class SourcePathsStep extends AbstractStepWithProgress<List<JavaModuleSou
|
||||
fullPathLabel.setVisible(enabled);
|
||||
myTfFullPath.setVisible(enabled);
|
||||
if (enabled) {
|
||||
myTfSourceDirectoryName.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTfSourceDirectoryName, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -88,6 +88,8 @@ import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.ui.configuration.classpath.ClasspathPanelImpl");
|
||||
private final JBTable myEntryTable;
|
||||
@@ -541,7 +543,9 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
}
|
||||
finally {
|
||||
enableModelUpdate();
|
||||
myEntryTable.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(myEntryTable, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -45,6 +45,7 @@ import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.AnActionButton;
|
||||
import com.intellij.ui.AnActionButtonRunnable;
|
||||
import com.intellij.ui.ToolbarDecorator;
|
||||
@@ -421,7 +422,9 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent
|
||||
myLastChosen = first.getFile();
|
||||
}
|
||||
fireLibraryChanged();
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract List<OrderRoot> selectRoots(@Nullable VirtualFile initialSelection);
|
||||
@@ -476,7 +479,9 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent
|
||||
updatePropertiesLabel();
|
||||
myTreeBuilder.queueUpdate();
|
||||
if (putFocusIntoTree) {
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
fireLibraryChanged();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.codeStyle.PackageEntry;
|
||||
import com.intellij.psi.codeStyle.PackageEntryTable;
|
||||
import com.intellij.ui.*;
|
||||
@@ -392,7 +393,9 @@ public abstract class ImportLayoutPanel extends JPanel {
|
||||
TableUtil.editCellAt(table, selectedRow, 0);
|
||||
Component editorComp = table.getEditorComponent();
|
||||
if (editorComp != null) {
|
||||
editorComp.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(editorComp, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -103,7 +103,6 @@ public class ChangeClassSignatureDialog extends RefactoringDialog {
|
||||
myTypeParameterInfos.add(p.getInfo());
|
||||
myBoundValueTypeCodeFragments.add(p.getBoundValueFragment());
|
||||
myDefaultValueTypeCodeFragments.add(p.getDefaultValueFragment());
|
||||
;
|
||||
}
|
||||
|
||||
myTableModel = new MyTableModel();
|
||||
|
||||
+8
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -36,6 +36,7 @@ import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.SuggestedNameInfo;
|
||||
@@ -523,11 +524,15 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
|
||||
((PsiTypeCodeFragment)myReturnTypeCodeFragment).getType();
|
||||
}
|
||||
catch (PsiTypeCodeFragment.TypeSyntaxException e) {
|
||||
myReturnTypeField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myReturnTypeField, true);
|
||||
});
|
||||
return RefactoringBundle.message("changeSignature.wrong.return.type", myReturnTypeCodeFragment.getText());
|
||||
}
|
||||
catch (PsiTypeCodeFragment.NoTypeException e) {
|
||||
myReturnTypeField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myReturnTypeField, true);
|
||||
});
|
||||
return RefactoringBundle.message("changeSignature.no.return.type");
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
@@ -116,7 +117,9 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
|
||||
|
||||
myInnerClassChooser.setText(((PsiClass)initialTargetElement).getQualifiedName());
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() -> myInnerClassChooser.requestFocus(), ModalityState.stateForComponent(myMainPanel));
|
||||
ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myInnerClassChooser, true);
|
||||
}), ModalityState.stateForComponent(myMainPanel));
|
||||
}
|
||||
else if (initialTargetElement instanceof PsiPackage) {
|
||||
myClassPackageChooser.setText(((PsiPackage)initialTargetElement).getQualifiedName());
|
||||
@@ -126,13 +129,17 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
|
||||
myToPackageRadioButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateControlsEnabled();
|
||||
myClassPackageChooser.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myClassPackageChooser, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
myMakeInnerClassOfRadioButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateControlsEnabled();
|
||||
myInnerClassChooser.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myInnerClassChooser, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.panels.ValidatingComponent;
|
||||
@@ -400,7 +401,9 @@ public class AutomaticUsageRenamingDialog<T> extends DialogWrapper {
|
||||
myShouldRename[row] = !myShouldRename[row];
|
||||
fireTableDataChanged();
|
||||
repaintTable();
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.ide.util.TreeClassChooser;
|
||||
@@ -7,6 +22,7 @@ import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.FixedSizeButton;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
@@ -83,7 +99,9 @@ public class PsiClassTableCellEditor extends AbstractTableCellEditor {
|
||||
panel.addFocusListener(new FocusListener() {
|
||||
public void focusGained(FocusEvent e) {
|
||||
if (!e.isTemporary() && myEditor != null) {
|
||||
myEditor.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEditor, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -211,7 +211,6 @@ interface ii {}
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
void cf8() {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
C {
|
||||
void foo() {}
|
||||
}
|
||||
;
|
||||
|
||||
abstract void foo();
|
||||
}
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
C {
|
||||
void foo() {}
|
||||
}
|
||||
;
|
||||
|
||||
abstract void foo();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,5 @@ class Test {
|
||||
<selection>System.out.println(variable);</selection>
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ class Test {
|
||||
newMethod(variable);
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
private <T> void newMethod(T variable) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -25,6 +25,7 @@ import com.intellij.ide.util.TreeClassChooser;
|
||||
import com.intellij.ide.util.TreeClassChooserFactory;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -306,7 +307,9 @@ public class ClassFilterEditor extends JPanel implements ComponentWithEmptyText
|
||||
myTable.getSelectionModel().setSelectionInterval(row, row);
|
||||
myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
|
||||
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +326,9 @@ public class ClassFilterEditor extends JPanel implements ComponentWithEmptyText
|
||||
myTable.getSelectionModel().setSelectionInterval(row, row);
|
||||
myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
|
||||
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.credentialStore;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.ValidationInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -68,7 +69,9 @@ public class MasterPasswordDialog extends DialogWrapper {
|
||||
else {
|
||||
setErrorText(info.message + " " + StringUtil.repeat(".", myRetriesCount), myRootPanel);
|
||||
if (info.component != null) {
|
||||
info.component.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(info.component, true);
|
||||
});
|
||||
}
|
||||
if (++myRetriesCount > NUMBER_OF_RETRIES) {
|
||||
super.doCancelAction();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.ui;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.AnActionButton;
|
||||
import com.intellij.ui.AnActionButtonRunnable;
|
||||
import com.intellij.ui.TableUtil;
|
||||
@@ -51,7 +52,9 @@ public class ListEditForm {
|
||||
final Component component =
|
||||
editor.getTableCellEditorComponent(table,
|
||||
null, true, lastRowIndex, 0);
|
||||
component.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(component, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.ex.http.HttpFileSystem;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
@@ -226,7 +227,9 @@ public class PathEditor {
|
||||
|
||||
protected void requestDefaultFocus() {
|
||||
if (myList != null) {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-5
@@ -61,14 +61,18 @@ public abstract class AbstractDescriptionAwareSchemesPanel<T extends Scheme> ext
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showDescription();
|
||||
getConfigurableFocusComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getConfigurableFocusComponent(), true);
|
||||
});
|
||||
}
|
||||
}, ESC_KEY_STROKE, JComponent.WHEN_FOCUSED);
|
||||
myDescriptionTextField.registerKeyboardAction(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
applyDescription();
|
||||
getConfigurableFocusComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getConfigurableFocusComponent(), true);
|
||||
});
|
||||
}
|
||||
}, ENTER_KEY_STROKE, JComponent.WHEN_FOCUSED);
|
||||
|
||||
@@ -123,9 +127,9 @@ public abstract class AbstractDescriptionAwareSchemesPanel<T extends Scheme> ext
|
||||
public void editDescription(@Nullable String startValue) {
|
||||
myLayout.show(myInfoComponent, EDIT_DESCRIPTION_CARD);
|
||||
myDescriptionTextField.setText(StringUtil.notNullize(startValue));
|
||||
|
||||
final IdeFocusManager fm = IdeFocusManager.getGlobalInstance();
|
||||
fm.doWhenFocusSettlesDown(() -> fm.requestFocus(myDescriptionTextField, true));
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myDescriptionTextField, true);
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+10
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -44,6 +44,7 @@ import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -187,10 +188,14 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
public void requestFocus() {
|
||||
// With a screen reader active, set the focus directly to the editor because
|
||||
// it makes it easier for users to read/navigate the documentation contents.
|
||||
if (ScreenReader.isActive())
|
||||
myEditorPane.requestFocus();
|
||||
else
|
||||
myScrollPane.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
if (ScreenReader.isActive()) {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEditorPane, true);
|
||||
}
|
||||
else {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myScrollPane, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public DocumentationComponent(final DocumentationManager manager, final AnAction[] additionalActions) {
|
||||
|
||||
+5
-1
@@ -81,6 +81,8 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
public class DocumentationManager extends DockablePopupManager<DocumentationComponent> {
|
||||
@NonNls public static final String JAVADOC_LOCATION_AND_SIZE = "javadoc.popup";
|
||||
public static final DataKey<String> SELECTED_QUICK_DOC_TEXT = DataKey.create("QUICK_DOC.SELECTED_TEXT");
|
||||
@@ -993,7 +995,9 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
|
||||
public void requestFocus() {
|
||||
if (fromQuickSearch()) {
|
||||
myPreviouslyFocused.getParent().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(myPreviouslyFocused.getParent(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.packageDependencies.ui.TreeExpansionMonitor;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -371,7 +372,9 @@ public abstract class IntentionSettingsTree {
|
||||
}
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
myTree.setSelectionRow(0);
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
});
|
||||
TreeUtil.expandAll(myTree);
|
||||
if (filter == null || filter.length() == 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.table.TableView;
|
||||
@@ -125,7 +126,9 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
if (selection >= 0) {
|
||||
myFilesTable.setRowSelectionInterval(selection, selection);
|
||||
}
|
||||
myFilesTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFilesTable, true);
|
||||
});
|
||||
}
|
||||
}).setEditAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -424,7 +427,9 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
showEditorDialog(myLogFileOptions);
|
||||
JTextField textField = getChildComponent();
|
||||
textField.setText(myLogFileOptions.getName());
|
||||
textField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(textField, true);
|
||||
});
|
||||
myModel.fireTableDataChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
@@ -44,13 +45,14 @@ import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ShowRunningListAction extends AnAction {
|
||||
public ShowRunningListAction() {
|
||||
@@ -109,7 +111,9 @@ public class ShowRunningListAction extends AnAction {
|
||||
Project aProject = (Project)((Trinity)value).first;
|
||||
JFrame aFrame = WindowManager.getInstance().getFrame(aProject);
|
||||
if (aFrame != null && !aFrame.isActive()) {
|
||||
aFrame.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(aFrame, true);
|
||||
});
|
||||
}
|
||||
ExecutionManagerImpl.getInstance(aProject).getContentManager().
|
||||
toFrontRunContent((Executor)((Trinity)value).second, (RunContentDescriptor)((Trinity)value).third);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -34,6 +34,7 @@ import com.intellij.openapi.editor.actions.ToggleUseSoftWrapsToolbarAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -116,7 +117,9 @@ public class DuplexConsoleView<S extends ConsoleView, T extends ConsoleView> ext
|
||||
CardLayout cl = (CardLayout)(getLayout());
|
||||
cl.show(this, primary ? PRIMARY_CONSOLE_PANEL : SECONDARY_CONSOLE_PANEL);
|
||||
|
||||
getSubConsoleView(primary).getComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getSubConsoleView(primary).getComponent(), true);
|
||||
});
|
||||
|
||||
myPrimary = primary;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -51,6 +51,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -218,7 +219,9 @@ public class LanguageConsoleImpl extends ConsoleViewImpl implements LanguageCons
|
||||
@Override
|
||||
public void keyTyped(KeyEvent event) {
|
||||
if (isConsoleEditorEnabled() && UIUtil.isReallyTypedEvent(event)) {
|
||||
myConsoleEditor.getContentComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myConsoleEditor.getContentComponent(), true);
|
||||
});
|
||||
myConsoleEditor.processKeyTyped(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -63,6 +63,7 @@ import java.util.List;
|
||||
|
||||
import static com.intellij.execution.impl.RunConfigurable.NodeKind.*;
|
||||
import static com.intellij.openapi.ui.LabeledComponent.create;
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
import static com.intellij.ui.RowsDnDSupport.RefinedDropSupport.Position.*;
|
||||
|
||||
class RunConfigurable extends BaseConfigurable {
|
||||
@@ -361,7 +362,9 @@ class RunConfigurable extends BaseConfigurable {
|
||||
textField.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
myTree.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
p.add(new JLabel("Folder name:"), "gapright 5");
|
||||
@@ -373,7 +376,9 @@ class RunConfigurable extends BaseConfigurable {
|
||||
myRightPanel.repaint();
|
||||
if (isFolderCreating) {
|
||||
textField.selectAll();
|
||||
textField.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(textField, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -41,6 +41,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
@@ -488,7 +489,9 @@ public class ReplaceInProjectManager {
|
||||
final UsageView usageView = replaceContext.getUsageView();
|
||||
|
||||
if (closeUsageViewIfEmpty(usageView, success)) return;
|
||||
usageView.getComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(usageView.getComponent(), true);
|
||||
});
|
||||
}, FindBundle.message("find.replace.command"), null);
|
||||
|
||||
replaceContext.invalidateExcludedSetCache();
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -257,7 +257,6 @@ public class FrameworkDetectionManager extends AbstractProjectComponent implemen
|
||||
final int detectorId = FrameworkDetectorRegistry.getInstance().getDetectorId(description.getDetector());
|
||||
myDetectedFrameworksData.putExistentFrameworkFiles(detectorId, description.getRelatedFiles());
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,8 @@ import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@@ -293,7 +295,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
final int i = myList.locationToIndex(e.getPoint());
|
||||
if (i != -1) {
|
||||
mySkipFocusGain = true;
|
||||
getField().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(getField(), true);
|
||||
});
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
myList.setSelectedIndex(i);
|
||||
@@ -402,7 +406,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
if (myNonProjectCheckBox == e.getOppositeComponent()) {
|
||||
mySkipFocusGain = true;
|
||||
editor.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(editor, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
onFocusLost();
|
||||
@@ -497,7 +503,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
option.setOptionState(!option.isOptionEnabled());
|
||||
myList.revalidate();
|
||||
myList.repaint();
|
||||
getField().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(getField(), true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -41,6 +41,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
@@ -300,12 +301,16 @@ public class CommanderPanel extends JPanel {
|
||||
myTitlePanel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -398,7 +403,9 @@ public class CommanderPanel extends JPanel {
|
||||
if (selectedIndices.length == 0 && myList.getModel().getSize() > 0) {
|
||||
myList.setSelectedIndex(0);
|
||||
if (!myList.hasFocus()) {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (myList.getModel().getSize() > 0) {
|
||||
@@ -418,7 +425,9 @@ public class CommanderPanel extends JPanel {
|
||||
final int popupIndex = myList.locationToIndex(new Point(x, y));
|
||||
if (popupIndex >= 0) {
|
||||
myList.setSelectedIndex(popupIndex);
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -47,6 +47,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
@@ -448,11 +449,15 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
|
||||
public void focusToNameField() {
|
||||
myNameField.selectAll();
|
||||
myNameField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myNameField, true);
|
||||
});
|
||||
}
|
||||
|
||||
public void focusToExtensionField() {
|
||||
myExtensionField.selectAll();
|
||||
myExtensionField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myExtensionField, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -36,6 +36,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
@@ -377,7 +378,9 @@ public abstract class HierarchyBrowserBaseEx extends HierarchyBrowserBase implem
|
||||
}
|
||||
}
|
||||
|
||||
getCurrentTree().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getCurrentTree(), true);
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.navigationToolbar;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.ScrollingUtil;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -88,7 +89,9 @@ class NavBarListWrapper extends JBScrollPane implements DataProvider {
|
||||
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -43,6 +43,7 @@ import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
@@ -183,7 +184,9 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl
|
||||
TreePath treePath = new TreePath(node.getPath());
|
||||
myTree.expandPath(treePath);
|
||||
if (requestFocus) {
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
TreeUtil.selectPath(myTree, treePath);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -61,6 +61,7 @@ import com.intellij.openapi.vcs.FileStatusManager;
|
||||
import com.intellij.openapi.vcs.changes.*;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.packageDependencies.DefaultScopesProvider;
|
||||
import com.intellij.packageDependencies.DependencyValidationManager;
|
||||
@@ -228,7 +229,9 @@ public class ScopeTreeViewPanel extends JPanel implements Disposable {
|
||||
if (node != null) {
|
||||
TreeUtil.selectPath(myTree, new TreePath(node.getPath()));
|
||||
if (requestFocus) {
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
@@ -257,7 +258,10 @@ public abstract class AbstractTreeClassChooserDialog<T extends PsiNamedElement>
|
||||
protected void initUI(ChooseByNamePopupComponent.Callback callback, ModalityState modalityState, boolean allowMultipleSelection) {
|
||||
super.initUI(callback, modalityState, allowMultipleSelection);
|
||||
dummyPanel.add(myGotoByNamePanel.getPanel(), BorderLayout.CENTER);
|
||||
IdeFocusTraversalPolicy.getPreferredFocusedComponent(myGotoByNamePanel.getPanel()).requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance()
|
||||
.requestFocus(IdeFocusTraversalPolicy.getPreferredFocusedComponent(myGotoByNamePanel.getPanel()), true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -101,6 +101,8 @@ import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@@ -225,7 +227,9 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider, Disp
|
||||
doOKAction();
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
myEditor.getContentComponent().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
|
||||
});
|
||||
myEditor.getCaretModel().moveToOffset(selectedEditor.getCaretModel().getOffset());
|
||||
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
|
||||
//myEditor.getSelectionModel().setSelection(selectedEditor.getSelectionModel().getSelectionStart(),
|
||||
|
||||
+14
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
@@ -302,7 +303,9 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
|
||||
if (index >= 0) {
|
||||
ScrollingUtil.selectItem(myPatterns.myPatternsList, index);
|
||||
}
|
||||
myPatterns.myPatternsList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myPatterns.myPatternsList, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +337,9 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
|
||||
|
||||
myTempPatternsTable.addAssociation(matcher, type);
|
||||
myPatterns.addPatternAndSelect(pattern);
|
||||
myPatterns.myPatternsList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myPatterns.myPatternsList, true);
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -347,7 +352,9 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
|
||||
FileNameMatcher matcher = FileTypeManager.parseFromString(extension);
|
||||
|
||||
myTempPatternsTable.removeAssociation(matcher, type);
|
||||
myPatterns.myPatternsList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myPatterns.myPatternsList, true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -525,7 +532,9 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
|
||||
|
||||
public void selectFileType(FileType fileType) {
|
||||
myFileTypesList.setSelectedValue(fileType, true);
|
||||
myFileTypesList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFileTypesList, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -43,6 +43,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.TreeSpeedSearch;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
@@ -202,7 +203,9 @@ public class ContentEntryTreeEditor {
|
||||
}
|
||||
|
||||
public void requestFocus() {
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.ShadowAction;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
@@ -210,11 +211,11 @@ public class RegistryUi implements Disposable {
|
||||
|
||||
private void startEditingAtSelection() {
|
||||
myTable.editCellAt(myTable.getSelectedRow(), 2);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (myTable.isEditing()) {
|
||||
myTable.getEditorComponent().requestFocus();
|
||||
}
|
||||
});
|
||||
if (myTable.isEditing()) {
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable.getEditorComponent(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyTableModel extends AbstractTableModel {
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.refactoring.changeSignature;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.MultiLineLabelUI;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.refactoring.util.RadioUpDownListener;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
|
||||
@@ -47,7 +48,9 @@ public class DefaultValueChooser extends DialogWrapper{
|
||||
myValueEditor.setEnabled(myUseValueRadioButton.isSelected());
|
||||
if (myUseValueRadioButton.isSelected()) {
|
||||
myValueEditor.selectAll();
|
||||
myValueEditor.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myValueEditor, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.intellij.refactoring.ui;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -41,7 +42,9 @@ public abstract class EnableDisableAction extends AbstractAction {
|
||||
applyValue(rows, valueToBeSet);
|
||||
// myMyTableModel.fireTableRowsUpdated(rows[0], rows[rows.length - 1]);
|
||||
}
|
||||
getTable().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getTable(), true);
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract JTable getTable();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.intellij.refactoring.util;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
@@ -75,7 +77,9 @@ public class RadioUpDownListener extends KeyAdapter {
|
||||
|
||||
private static boolean click(final JRadioButton button) {
|
||||
if (button.isEnabled() && button.isVisible()) {
|
||||
button.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(button, true);
|
||||
});
|
||||
button.doClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.options.CompoundScheme;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
@@ -140,7 +141,9 @@ public abstract class BaseToolsPanel<T extends Tool> extends JPanel {
|
||||
if (dlg.showAndGet()) {
|
||||
insertNewTool(dlg.getData(), true);
|
||||
}
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}).setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -151,7 +154,9 @@ public abstract class BaseToolsPanel<T extends Tool> extends JPanel {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
editSelected();
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}).setMoveUpAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -178,7 +183,9 @@ public abstract class BaseToolsPanel<T extends Tool> extends JPanel {
|
||||
if (dlg.showAndGet()) {
|
||||
insertNewTool(dlg.getData(), true);
|
||||
}
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}).createPanel(), BorderLayout.CENTER);
|
||||
@@ -285,7 +292,9 @@ public abstract class BaseToolsPanel<T extends Tool> extends JPanel {
|
||||
TreePath path = new TreePath(node.getPath());
|
||||
myTree.getSelectionModel().setSelectionPath(path);
|
||||
myTree.expandPath(path);
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,7 +431,9 @@ public abstract class BaseToolsPanel<T extends Tool> extends JPanel {
|
||||
removeNodeFromParent(node);
|
||||
}
|
||||
update();
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.execution.filters.RegexpFilter;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.JBPopupMenu;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
|
||||
@@ -191,7 +192,9 @@ class FilterDialog extends DialogWrapper {
|
||||
}
|
||||
} catch (BadLocationException ex) {
|
||||
}
|
||||
myRegexpField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myRegexpField, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.tools;
|
||||
|
||||
import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -111,7 +112,9 @@ public class OutputFiltersDialog extends DialogWrapper {
|
||||
myFiltersModel.addElement(filterInfo);
|
||||
setModified(true);
|
||||
}
|
||||
myFiltersList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFiltersList, true);
|
||||
});
|
||||
}
|
||||
}).setEditAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -122,7 +125,9 @@ public class OutputFiltersDialog extends DialogWrapper {
|
||||
if (wasEdited) {
|
||||
setModified(true);
|
||||
}
|
||||
myFiltersList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFiltersList, true);
|
||||
});
|
||||
}
|
||||
}).setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -131,7 +136,9 @@ public class OutputFiltersDialog extends DialogWrapper {
|
||||
myFiltersModel.removeElementAt(myFiltersList.getSelectedIndex());
|
||||
setModified(true);
|
||||
}
|
||||
myFiltersList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFiltersList, true);
|
||||
});
|
||||
}
|
||||
}).setMoveUpAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -140,7 +147,9 @@ public class OutputFiltersDialog extends DialogWrapper {
|
||||
if (movedCount > 0) {
|
||||
setModified(true);
|
||||
}
|
||||
myFiltersList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFiltersList, true);
|
||||
});
|
||||
}
|
||||
}).setMoveDownAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -149,7 +158,9 @@ public class OutputFiltersDialog extends DialogWrapper {
|
||||
if (movedCount > 0) {
|
||||
setModified(true);
|
||||
}
|
||||
myFiltersList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFiltersList, true);
|
||||
});
|
||||
}
|
||||
})
|
||||
.createPanel();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -379,7 +379,6 @@ public class ToolEditorDialog extends DialogWrapper {
|
||||
}
|
||||
catch (BadLocationException ignored) {
|
||||
}
|
||||
;
|
||||
}
|
||||
IdeFocusManager.findInstance().requestFocus(myTextField, true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.ui.playback.PlaybackContext;
|
||||
import com.intellij.openapi.ui.playback.PlaybackRunner;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
@@ -340,9 +341,13 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta
|
||||
final Component c = ((WindowManagerEx)WindowManager.getInstance()).getFocusedComponent(frame);
|
||||
|
||||
if (c != null) {
|
||||
c.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(c, true);
|
||||
});
|
||||
} else {
|
||||
frame.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(frame, true);
|
||||
});
|
||||
}
|
||||
|
||||
//noinspection SSBasedInspection
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.CatchingConsumer;
|
||||
@@ -356,7 +357,9 @@ public class ManagePackagesDialog extends DialogWrapper {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
e.consume();
|
||||
filter();
|
||||
myPackages.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myPackages, true);
|
||||
});
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
onEscape(e);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.ui.UIBundle;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -302,7 +303,9 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
|
||||
@Override
|
||||
public final void requestFocus() {
|
||||
myComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myComponent, true);
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
@@ -107,7 +108,9 @@ public class FixedComboBoxEditor implements ComboBoxEditor {
|
||||
|
||||
public void selectAll() {
|
||||
myField.selectAll();
|
||||
myField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myField, true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.UIBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -40,6 +41,8 @@ public class InputException extends RuntimeException{
|
||||
if (myMessage != null) {
|
||||
Messages.showMessageDialog(myMessage, UIBundle.message("invalid.user.input.dialog.title"), Messages.getErrorIcon());
|
||||
}
|
||||
myComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myComponent, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.navigation.History;
|
||||
import com.intellij.ui.navigation.Place;
|
||||
@@ -583,7 +584,9 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
|
||||
public ActionCallback selectNodeInTree(final DefaultMutableTreeNode nodeToSelect, boolean center, final boolean requestFocus) {
|
||||
if (requestFocus) {
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
if (nodeToSelect != null) {
|
||||
return TreeUtil.selectInTree(nodeToSelect, requestFocus, myTree, center);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -20,7 +20,11 @@ import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.ActiveComponent;
|
||||
import com.intellij.ui.ListUtil;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.ScrollingUtil;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.ui.speedSearch.ListWithFilter;
|
||||
import com.intellij.ui.treeStructure.treetable.TreeTable;
|
||||
@@ -544,7 +548,9 @@ public class PopupChooserBuilder {
|
||||
}
|
||||
|
||||
public void requestFocus() {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
|
||||
public synchronized void addMouseListener(MouseListener l) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -36,7 +36,9 @@ public class PassThroughIdeFocusManager extends IdeFocusManager {
|
||||
|
||||
@NotNull
|
||||
public ActionCallback requestFocus(@NotNull Component c, boolean forced) {
|
||||
c.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(c, true);
|
||||
});
|
||||
return ActionCallback.DONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
@@ -84,7 +86,9 @@ public class EditableRowTable{
|
||||
if (editorComponent != null) {
|
||||
final Rectangle bounds = editorComponent.getBounds();
|
||||
table.scrollRectToVisible(bounds);
|
||||
editorComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(editorComponent, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +113,9 @@ public class EditableRowTable{
|
||||
}
|
||||
|
||||
table.getParent().repaint();
|
||||
table.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(table, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -123,7 +129,9 @@ public class EditableRowTable{
|
||||
tableModel.exchangeRows(index, index - 1);
|
||||
table.setRowSelectionInterval(index - 1, index - 1);
|
||||
}
|
||||
table.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(table, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -137,7 +145,9 @@ public class EditableRowTable{
|
||||
tableModel.exchangeRows(index, index + 1);
|
||||
table.setRowSelectionInterval(index + 1, index + 1);
|
||||
}
|
||||
table.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(table, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.ide.ui.UINumericRange;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -91,7 +92,9 @@ public class JBIntSpinner extends JSpinner {
|
||||
JTextField textField = getTextField();
|
||||
if (textField.isEnabled() ) {
|
||||
MouseEvent event = SwingUtilities.convertMouseEvent(component, e, textField);
|
||||
textField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(textField, true);
|
||||
});
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(() -> textField.dispatchEvent(event));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
|
||||
@@ -108,7 +109,9 @@ public abstract class OrderPanel<T> extends JPanel {
|
||||
}
|
||||
|
||||
public void moveSelectedItemsUp() {
|
||||
myEntryTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEntryTable, true);
|
||||
});
|
||||
try {
|
||||
myInsideMove++;
|
||||
TableUtil.moveSelectedItemsUp(myEntryTable);
|
||||
@@ -122,7 +125,9 @@ public abstract class OrderPanel<T> extends JPanel {
|
||||
}
|
||||
|
||||
public void moveSelectedItemsDown() {
|
||||
myEntryTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEntryTable, true);
|
||||
});
|
||||
try {
|
||||
myInsideMove++;
|
||||
TableUtil.moveSelectedItemsDown(myEntryTable);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
@@ -343,7 +344,9 @@ public class SearchTextField extends JPanel {
|
||||
}
|
||||
|
||||
public void requestFocus() {
|
||||
getTextEditor().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getTextEditor(), true);
|
||||
});
|
||||
}
|
||||
|
||||
public class MyModel extends AbstractListModel {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.EditableModel;
|
||||
import com.intellij.util.ui.ElementProducer;
|
||||
@@ -129,7 +130,9 @@ class TableToolbarDecorator extends ToolbarDecorator {
|
||||
if (editorComponent != null) {
|
||||
final Rectangle bounds = editorComponent.getBounds();
|
||||
table.scrollRectToVisible(bounds);
|
||||
editorComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(editorComponent, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -142,7 +145,9 @@ class TableToolbarDecorator extends ToolbarDecorator {
|
||||
public void run(AnActionButton button) {
|
||||
if (TableUtil.doRemoveSelectedItems(table, tableModel, null)) {
|
||||
updateButtons();
|
||||
table.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(table, true);
|
||||
});
|
||||
TableUtil.updateScroller(table);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +180,9 @@ class TableToolbarDecorator extends ToolbarDecorator {
|
||||
idx[i] += delta;
|
||||
}
|
||||
TableUtil.selectRows(table, idx);
|
||||
table.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(table, true);
|
||||
});
|
||||
if (row > 0 && col != -1) {
|
||||
table.editCellAt(row - 1, col);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionToolbarPosition;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.treeStructure.SimpleNode;
|
||||
import com.intellij.util.ui.EditableModel;
|
||||
import com.intellij.util.ui.EditableTreeModel;
|
||||
@@ -91,7 +92,9 @@ class TreeToolbarDecorator extends ToolbarDecorator {
|
||||
final TreePath createdPath = model.addNode(new TreePath(parent.getPath()));
|
||||
if (path != null) {
|
||||
TreeUtil.selectPath(myTree, createdPath);
|
||||
myTree.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ui.components;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.components.panels.ValidatingComponent;
|
||||
|
||||
@@ -51,7 +52,9 @@ public class ValidatingTextField extends ValidatingComponent<JTextField> {
|
||||
}
|
||||
|
||||
public void requestFocus() {
|
||||
getMainComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getMainComponent(), true);
|
||||
});
|
||||
}
|
||||
|
||||
public boolean requestFocusInWindow() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ui.components.panels;
|
||||
|
||||
import com.intellij.openapi.ui.NullableComponent;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -78,10 +79,14 @@ public class Wrapper extends JPanel implements NullableComponent {
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
if (getTargetComponent() == this) {
|
||||
super.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
super.requestFocus();
|
||||
});
|
||||
return;
|
||||
}
|
||||
getTargetComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getTargetComponent(), true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +98,9 @@ public class Wrapper extends JPanel implements NullableComponent {
|
||||
}
|
||||
|
||||
public void requestFocusInternal() {
|
||||
super.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
super.requestFocus();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -22,6 +22,7 @@ package com.intellij.ui.speedSearch;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.ui.popup.util.PopupUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.LightColors;
|
||||
import com.intellij.ui.SearchTextField;
|
||||
@@ -187,6 +188,8 @@ public class ListWithFilter<T> extends JPanel implements DataProvider {
|
||||
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ import java.beans.PropertyChangeListener;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
public class JBTabsImpl extends JComponent
|
||||
implements JBTabs, PropertyChangeListener, TimerListener, DataProvider, PopupMenuListener, Disposable, JBTabsPresentation, Queryable,
|
||||
UISettingsListener, QuickActionProvider, Accessible {
|
||||
@@ -696,10 +698,14 @@ public class JBTabsImpl extends JComponent
|
||||
public void requestFocus() {
|
||||
final JComponent toFocus = getToFocus();
|
||||
if (toFocus != null) {
|
||||
toFocus.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(toFocus, true);
|
||||
});
|
||||
}
|
||||
else {
|
||||
super.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
super.requestFocus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,7 +975,9 @@ public class JBTabsImpl extends JComponent
|
||||
if (toFocus == null) return ActionCallback.DONE;
|
||||
|
||||
if (myTestMode) {
|
||||
toFocus.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(toFocus, true);
|
||||
});
|
||||
return ActionCallback.DONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -42,6 +42,8 @@ import java.awt.event.KeyEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
public final class TreeUtil {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.util.ui.tree.TreeUtil");
|
||||
@NonNls @NotNull private static final String TREE_UTIL_SCROLL_TIME_STAMP = "TreeUtil.scrollTimeStamp";
|
||||
@@ -845,7 +847,9 @@ public final class TreeUtil {
|
||||
final TreePath treePath = new TreePath(node.getPath());
|
||||
tree.expandPath(treePath);
|
||||
if (requestFocus) {
|
||||
tree.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(tree, true);
|
||||
});
|
||||
}
|
||||
return selectPath(tree, treePath, center);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.impl.IdeFrameImpl;
|
||||
import com.intellij.util.Alarm;
|
||||
@@ -82,7 +83,11 @@ public final class SwingCleanuper {
|
||||
final Application app = ApplicationManager.getApplication();
|
||||
if (app != null && app.isActive()) {
|
||||
StatusBar statusBar = frame.getStatusBar();
|
||||
if (statusBar != null) ((JComponent)statusBar).requestFocus();
|
||||
if (statusBar != null) {
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus((JComponent)statusBar, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.internal.statistic.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.JBCardLayout;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
@@ -190,7 +191,9 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
|
||||
myCardLayout.swipe(myContentPanel, myCurrentStep.getTitle(), JBCardLayout.SwipeDirection.AUTO, () -> {
|
||||
Component component = myCurrentStep.getDefaultFocusedComponent();
|
||||
if (component != null) {
|
||||
component.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(component, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.util;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -286,7 +287,9 @@ public class MultiStateElementsChooser<T, S> extends JPanel implements Component
|
||||
myTable.getSelectionModel().clearSelection();
|
||||
}
|
||||
}
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
public void removeAllElements() {
|
||||
@@ -322,7 +325,9 @@ public class MultiStateElementsChooser<T, S> extends JPanel implements Component
|
||||
myTableModel.addElement(element, markState);
|
||||
myElementToPropertiesMap.put(element, elementProperties);
|
||||
selectRow(myTableModel.getRowCount() - 1);
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
public void setElementProperties(T element, ElementProperties properties) {
|
||||
@@ -365,7 +370,9 @@ public class MultiStateElementsChooser<T, S> extends JPanel implements Component
|
||||
final int[] rows = getElementsRows(elements);
|
||||
TableUtil.selectRows(myTable, rows);
|
||||
TableUtil.scrollSelectionToVisible(myTable);
|
||||
myTable.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
|
||||
});
|
||||
}
|
||||
|
||||
private int[] getElementsRows(final Collection<? extends T> elements) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -20,9 +20,9 @@ import com.intellij.openapi.diff.impl.DiffPanelImpl;
|
||||
import com.intellij.openapi.diff.impl.DiffSideView;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.DialogWrapperDialog;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -42,8 +42,11 @@ public class DiffPanelOptions {
|
||||
}
|
||||
|
||||
public void onNewContent(DiffSideView currentSide) {
|
||||
if (myRequestFocusOnNewContent)
|
||||
currentSide.getFocusableComponent().requestFocus();
|
||||
if (myRequestFocusOnNewContent) {
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(currentSide.getFocusableComponent(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void setRequestFocusOnNewContent(boolean requestFocusOnNewContent) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -85,6 +85,8 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSidesContainer {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.DiffPanelImpl");
|
||||
|
||||
@@ -758,10 +760,14 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
|
||||
|
||||
public void focusOppositeSide() {
|
||||
if (myCurrentSide == myLeftSide) {
|
||||
myRightSide.getEditor().getContentComponent().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(myRightSide.getEditor().getContentComponent(), true);
|
||||
});
|
||||
}
|
||||
else {
|
||||
myLeftSide.getEditor().getContentComponent().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(myLeftSide.getEditor().getContentComponent(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -34,6 +34,7 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.util.IJSwingUtilities;
|
||||
import com.intellij.util.ui.ScrollUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -293,7 +294,11 @@ public class DiffSideView {
|
||||
}
|
||||
|
||||
public void restore() {
|
||||
if (isFocused) getFocusableComponent().requestFocus();
|
||||
if (isFocused) {
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getFocusableComponent(), true);
|
||||
});
|
||||
}
|
||||
if (myIsMaster) beMaster();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -58,6 +58,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.EditorNotificationPanel;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import gnu.trove.TIntHashSet;
|
||||
@@ -459,7 +460,9 @@ public class MergePanel2 implements DiffViewer {
|
||||
Editor centerEditor = getEditor(1);
|
||||
JComponent centerComponent = centerEditor.getContentComponent();
|
||||
if (centerComponent.isShowing()) {
|
||||
centerComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(centerComponent, true);
|
||||
});
|
||||
}
|
||||
int[] toLeft = getPrimaryBeginnings(myDividers[0].getPaint());
|
||||
int[] toRight = getPrimaryBeginnings(myDividers[1].getPaint());
|
||||
|
||||
+4
-1
@@ -51,6 +51,7 @@ import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.Alarm;
|
||||
@@ -853,7 +854,9 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
}
|
||||
|
||||
private void doMouseClicked(@NotNull MouseEvent e) {
|
||||
myEditor.getContentComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
|
||||
});
|
||||
int lineCount = getDocument().getLineCount() + myEditor.getSettings().getAdditionalLinesCount();
|
||||
if (lineCount == 0) {
|
||||
return;
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -42,6 +42,7 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBList;
|
||||
@@ -621,7 +622,9 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
else {
|
||||
setErrorText(null);
|
||||
}
|
||||
myPathTextField.getField().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myPathTextField.getField(), true);
|
||||
});
|
||||
|
||||
myNorthPanel.revalidate();
|
||||
myNorthPanel.repaint();
|
||||
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -28,11 +28,11 @@ import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.codeStyle.MinusculeMatcher;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.ui.ScrollingUtil;
|
||||
@@ -384,7 +384,9 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
|
||||
myPathTextField.setSelectionStart(caret);
|
||||
myPathTextField.setSelectionEnd(caret);
|
||||
myPathTextField.setFocusTraversalKeysEnabled(true);
|
||||
SwingUtilities.invokeLater(() -> getField().requestFocus());
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(getField(), true);
|
||||
});
|
||||
return Boolean.TRUE;
|
||||
}).setItemChoosenCallback(() -> processChosenFromCompletion(false)).setCancelKeyEnabled(false).setAlpha(0.1f).setFocusOwners(new Component[]{myPathTextField}).
|
||||
createPopup();
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -33,6 +33,7 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.FocusWatcher;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.PrevNextActionsDescriptor;
|
||||
import com.intellij.ui.SideBorder;
|
||||
@@ -442,7 +443,9 @@ public abstract class EditorComposite implements Disposable {
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
if (myFocusComponent != null) {
|
||||
myFocusComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFocusComponent, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
/**
|
||||
* Author: msk
|
||||
*/
|
||||
@@ -753,7 +755,9 @@ public class EditorWindow {
|
||||
res.setFilePinned (nextFile, isFilePinned (file));
|
||||
if (!focusNew) {
|
||||
res.setSelectedEditor(selectedEditor, true);
|
||||
selectedEditor.getComponent().requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(selectedEditor.getComponent(), true);
|
||||
});
|
||||
}
|
||||
panel.revalidate();
|
||||
}
|
||||
|
||||
+13
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,14 +16,14 @@
|
||||
package com.intellij.openapi.keymap.impl.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
|
||||
import java.awt.LayoutManager;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
* @author Sergey.Malenkov
|
||||
@@ -40,7 +40,9 @@ final class KeyboardShortcutPanel extends ShortcutPanel<KeyboardShortcut> {
|
||||
mySecondStroke.setEnabled(enabled);
|
||||
ShortcutTextField component = !enabled || null == myFirstStroke.getKeyStroke() ? myFirstStroke : mySecondStroke;
|
||||
setShortcut(newShortcut());
|
||||
component.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(component, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
private final PropertyChangeListener myPropertyListener = new PropertyChangeListener() {
|
||||
@@ -49,10 +51,14 @@ final class KeyboardShortcutPanel extends ShortcutPanel<KeyboardShortcut> {
|
||||
if (KeyboardShortcutPanel.this != event.getSource()) {
|
||||
setShortcut(newShortcut());
|
||||
if (null == myFirstStroke.getKeyStroke()) {
|
||||
myFirstStroke.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myFirstStroke, true);
|
||||
});
|
||||
}
|
||||
else if (null == mySecondStroke.getKeyStroke() && mySecondStrokeEnable.isSelected()) {
|
||||
mySecondStroke.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(mySecondStroke, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (event.getNewValue() instanceof KeyboardShortcut) {
|
||||
|
||||
+4
-1
@@ -35,6 +35,7 @@ import com.intellij.openapi.ui.popup.StackingPopupDispatcher;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
@@ -518,7 +519,9 @@ public class GlassPaneDialogWrapperPeer extends DialogWrapperPeer implements Foc
|
||||
myTransparentPane.repaint();
|
||||
|
||||
if (myPreviouslyFocusedComponent != null) {
|
||||
myPreviouslyFocusedComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myPreviouslyFocusedComponent, true);
|
||||
});
|
||||
myPreviouslyFocusedComponent = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.Weighted;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.IdeGlassPane;
|
||||
import com.intellij.openapi.wm.IdeGlassPaneUtil;
|
||||
import com.intellij.ui.BalloonImpl;
|
||||
@@ -183,7 +184,11 @@ public class IdeGlassPaneImpl extends JPanel implements IdeGlassPaneEx, IdeEvent
|
||||
switch (me.getID()) {
|
||||
case MouseEvent.MOUSE_PRESSED:
|
||||
boolean consumed = false;
|
||||
if (target.isFocusable()) target.requestFocus();
|
||||
if (target.isFocusable()) {
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(target, true);
|
||||
});
|
||||
}
|
||||
for (final MouseListener listener : listeners) {
|
||||
final String className = listener.getClass().getName();
|
||||
if (className.indexOf("BasicTreeUI$") >= 0 || className.indexOf("MacTreeUI$") >= 0) continue;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.util.BitUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -140,7 +141,9 @@ public class ProjectWindowAction extends ToggleAction implements DumbAware {
|
||||
projectFrame.setExtendedState(frameState ^ Frame.ICONIFIED);
|
||||
}
|
||||
projectFrame.toFront();
|
||||
projectFrame.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(projectFrame, true);
|
||||
});
|
||||
//ProjectUtil.focusProjectWindow(project, true);
|
||||
}
|
||||
|
||||
|
||||
+14
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -39,10 +39,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.ListItemDescriptorAdapter;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.IdeRootPaneNorthExtension;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.WelcomeScreen;
|
||||
import com.intellij.openapi.wm.*;
|
||||
import com.intellij.openapi.wm.impl.IdeGlassPaneImpl;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.border.CustomLineBorder;
|
||||
@@ -487,7 +484,9 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
}
|
||||
JComponent toFocus = FlatWelcomeFrame.getPreferredFocusedComponent(panel);
|
||||
if (toFocus != null) {
|
||||
toFocus.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(toFocus, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
final String name = action.getClass().getName();
|
||||
@@ -605,7 +604,9 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
||||
if (focusListOnLeft) {
|
||||
if (list != null) {
|
||||
list.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(list, true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
focusPrev(comp);
|
||||
@@ -636,7 +637,9 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
if (policy != null) {
|
||||
Component prev = policy.getComponentBefore(FlatWelcomeFrame.this, comp);
|
||||
if (prev != null) {
|
||||
prev.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(prev, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -646,7 +649,9 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
if (policy != null) {
|
||||
Component next = policy.getComponentAfter(FlatWelcomeFrame.this, comp);
|
||||
if (next != null) {
|
||||
next.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(next, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.util.io.UniqueNameBuilder;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
@@ -110,7 +111,9 @@ public class NewRecentProjectPanel extends RecentProjectPanel {
|
||||
if (policy != null) {
|
||||
Component next = policy.getComponentAfter(frame, list);
|
||||
if (next != null) {
|
||||
next.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(next, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -37,6 +37,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.UniqueNameBuilder;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.ClickListener;
|
||||
import com.intellij.ui.ListUtil;
|
||||
import com.intellij.ui.components.JBList;
|
||||
@@ -247,7 +248,9 @@ public class RecentProjectPanel extends JPanel {
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
if (focusOwner == null) {
|
||||
myList.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myList, true);
|
||||
});
|
||||
}
|
||||
if (myList.getSelectedIndices().length > 1) {
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -51,7 +52,9 @@ public class EditorComboBoxEditor implements ComboBoxEditor{
|
||||
@Override
|
||||
public void selectAll() {
|
||||
myTextField.selectAll();
|
||||
myTextField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTextField, true);
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerListener;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ex.AbstractDelegatingToRootTraversalPolicy;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -226,7 +227,9 @@ public class EditorTextField extends NonOpaquePanel implements DocumentListener,
|
||||
|
||||
validate();
|
||||
if (isFocused) {
|
||||
myEditor.getContentComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,7 +358,9 @@ public class EditorTextField extends NonOpaquePanel implements DocumentListener,
|
||||
}
|
||||
revalidate();
|
||||
if (isFocused) {
|
||||
requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
requestFocus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,11 +719,15 @@ public class EditorTextField extends NonOpaquePanel implements DocumentListener,
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
if (myEditor != null) {
|
||||
myEditor.getContentComponent().requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
|
||||
});
|
||||
myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
|
||||
}
|
||||
else {
|
||||
super.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
requestFocus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
|
||||
import com.intellij.ui.tabs.JBTabs;
|
||||
import com.intellij.util.IJSwingUtilities;
|
||||
@@ -177,7 +178,9 @@ public class TabbedPaneWrapper {
|
||||
final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder);
|
||||
myTabbedPane.setSelectedIndex(index);
|
||||
if (hadFocus && requestFocus) {
|
||||
myTabbedPaneHolder.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTabbedPaneHolder, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +206,9 @@ public class TabbedPaneWrapper {
|
||||
myTabbedPane.revalidate();
|
||||
}
|
||||
if (hadFocus) {
|
||||
myTabbedPaneHolder.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTabbedPaneHolder, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -383,7 +388,9 @@ public class TabbedPaneWrapper {
|
||||
final JComponent preferredFocusedComponent = IdeFocusTraversalPolicy.getPreferredFocusedComponent(myComponent);
|
||||
if (preferredFocusedComponent != null) {
|
||||
if (!preferredFocusedComponent.requestFocusInWindow()) {
|
||||
preferredFocusedComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(preferredFocusedComponent, true);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -393,7 +400,9 @@ public class TabbedPaneWrapper {
|
||||
|
||||
public void requestFocus() {
|
||||
if (!myCustomFocus) {
|
||||
super.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
super.requestFocus();
|
||||
});
|
||||
} else {
|
||||
requestDefaultFocus();
|
||||
}
|
||||
@@ -429,7 +438,9 @@ public class TabbedPaneWrapper {
|
||||
final JComponent preferredFocusedComponent = IdeFocusTraversalPolicy.getPreferredFocusedComponent(myWrapper.myTabbedPane.getComponent());
|
||||
if (preferredFocusedComponent != null) {
|
||||
if (!preferredFocusedComponent.requestFocusInWindow()) {
|
||||
preferredFocusedComponent.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(preferredFocusedComponent, true);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.ui.FixedSizeButton;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
@@ -141,7 +142,9 @@ public class TableCellEditorWithButton extends AbstractCellEditor implements Tab
|
||||
}
|
||||
|
||||
public boolean requestDefaultFocus() {
|
||||
myTextField.requestFocus();
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTextField, true);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -46,6 +46,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.openapi.wm.IdeFocusManager.getGlobalInstance;
|
||||
|
||||
/**
|
||||
* @author Anton Katilin
|
||||
* @author Vladimir Kondratyev
|
||||
@@ -614,7 +616,9 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
JComponent toFocus = computeWillFocusComponent(toSelect);
|
||||
|
||||
if (toFocus != null) {
|
||||
toFocus.requestFocus();
|
||||
getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
getGlobalInstance().requestFocus(toFocus, true);
|
||||
});
|
||||
}
|
||||
|
||||
return ActionCallback.DONE;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user