Revert: Better allocation trace for the focus tracer. Deprecation of forced requestFo...
authorDenis Fokin <Denis.Fokin@jetbrains.com>
Mon, 8 Feb 2016 12:36:17 +0000 (15:36 +0300)
committerDenis Fokin <Denis.Fokin@jetbrains.com>
Mon, 8 Feb 2016 12:37:55 +0000 (15:37 +0300)
101 files changed:
RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java
java/debugger/impl/src/com/intellij/debugger/ui/DebuggerEditorImpl.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/LayoutTree.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ClasspathPanelImpl.java
java/idea-ui/src/com/intellij/projectImport/ImportChooserStep.java
java/java-impl/src/com/intellij/application/options/editor/ExcludeTable.java
java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java
java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java
java/java-impl/src/com/intellij/refactoring/replaceConstructorWithBuilder/ReplaceConstructorWithBuilderDialog.java
java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java
java/java-impl/src/com/intellij/unscramble/ThreadDumpPanel.java
java/java-tests/testSrc/com/intellij/find/EditorSearchTest.java
platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java
platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffPanel.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupUi.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java
platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
platform/lang-impl/src/com/intellij/find/EditorSearchSession.java
platform/lang-impl/src/com/intellij/find/SearchReplaceComponent.java
platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInGroupTarget.java
platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPopup.java
platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java
platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java
platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerDialog.java
platform/lang-impl/src/com/intellij/openapi/editor/actions/IncrementalFindAction.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialogBase.java
platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java
platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java
platform/platform-api/src/com/intellij/ide/wizard/AbstractWizardEx.java
platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java
platform/platform-api/src/com/intellij/openapi/ui/ComboBox.java
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java
platform/platform-api/src/com/intellij/openapi/wm/FocusRequestor.java
platform/platform-api/src/com/intellij/openapi/wm/PassThroughIdeFocusManager.java
platform/platform-api/src/com/intellij/ui/table/JBTable.java
platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java
platform/platform-impl/src/com/intellij/designer/LightToolWindow.java
platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.java
platform/platform-impl/src/com/intellij/help/impl/IdeaHelpBroker.java
platform/platform-impl/src/com/intellij/ide/actions/Switcher.java
platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java
platform/platform-impl/src/com/intellij/ide/util/GotoLineNumberDialog.java
platform/platform-impl/src/com/intellij/internal/focus/FocusTracesAction.java
platform/platform-impl/src/com/intellij/internal/focus/FocusTracesDialog.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java
platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java
platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java
platform/platform-impl/src/com/intellij/openapi/ui/FrameWrapper.java
platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusRequestInfo.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFocusManagerHeadless.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFocusManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInEditorComponentCmd.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java
platform/platform-impl/src/com/intellij/ui/BalloonImpl.java
platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java
platform/platform-impl/src/com/intellij/ui/FocusTrackback.java
platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java
platform/platform-impl/src/com/intellij/util/ui/table/JBListTable.java
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java
platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/statistics/StatisticsPanel.java
platform/testRunner/src/com/intellij/execution/testframework/export/ExportTestResultsForm.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListChooserPanel.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogManager.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java
plugins/devkit/src/dom/generator/DomGenPanel.java
plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleWizardStep.java
plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicToolWindowWrapper.java
plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/GrDynamicImplicitProperty.java
plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java
plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/IntersectingLocalChangesPanel.java
plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
plugins/ui-designer-core/src/com/intellij/designer/propertyTable/PropertyTablePanel.java
python/educational-core/student/src/com/jetbrains/edu/learning/actions/StudyCheckAction.java
python/educational-core/student/src/com/jetbrains/edu/learning/actions/StudyRefreshTaskFileAction.java
python/src/com/jetbrains/python/console/PyOpenDebugConsoleAction.java
python/src/com/jetbrains/python/console/PythonConsoleView.java
python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java
xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetAbbreviationBalloon.java

index ac17a0ba7a22e8eb3835ac89b4486dd9245f53b2..9d1ea297ace6f7f95ba3274132d1cad5eb8ea417 100644 (file)
@@ -92,12 +92,12 @@ public class CheckRegExpForm {
         super.addNotify();
         disposable = Disposer.newDisposable();
 
-        IdeFocusManager.getGlobalInstance().requestFocus(mySampleText);
+        IdeFocusManager.getGlobalInstance().requestFocus(mySampleText, true);
 
         new AnAction(){
           @Override
           public void actionPerformed(AnActionEvent e) {
-            IdeFocusManager.findInstance().requestFocus(myRegExp.getFocusTarget());
+            IdeFocusManager.findInstance().requestFocus(myRegExp.getFocusTarget(), true);
           }
         }.registerCustomShortcutSet(CustomShortcutSet.fromString("shift TAB"), mySampleText);
 
index 215dda21e46e118e2059379c20b8d01276e5bc31..d24a2b3e7faa94475c8aad05627585b742ff5d66 100644 (file)
@@ -145,7 +145,7 @@ public abstract class DebuggerEditorImpl extends CompletionEditor {
         public void actionPerformed(AnActionEvent e) {
           setFactory(fragmentFactory);
           setText(getText());
-          IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this);
+          IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this, true);
         }
       });
     }
index f27e11e5d1649c2b251555940b4554e6140e5896..9ac88ac60f82465b420aebab21857897a8dc71d1 100644 (file)
@@ -241,7 +241,7 @@ public class LayoutTree extends SimpleDnDAwareTree implements AdvancedDnDSource
     }
 
     private void requestFocusToTree() {
-      IdeFocusManager.getInstance(myArtifactsEditor.getContext().getProject()).requestFocus(LayoutTree.this);
+      IdeFocusManager.getInstance(myArtifactsEditor.getContext().getProject()).requestFocus(LayoutTree.this, true);
     }
   }
 }
index a5f0ef2c4b69566281964648ec09c05f708c00e2..76f33318392c71bcfac224866682eb3237b140b1 100644 (file)
@@ -649,7 +649,7 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
         TableUtil.scrollSelectionToVisible(myEntryTable);
       }
     }
-    IdeFocusManager.getInstance(myState.getProject()).requestFocus(myEntryTable);
+    IdeFocusManager.getInstance(myState.getProject()).requestFocus(myEntryTable, true);
   }
 
   private int moveRow(final int row, final int increment) {
index e5613ef93366f0a7313536764514c8b3d4c9b1d7..07f5a8bbda8fe8bb86d9bb2143e1162dcf8190c3 100644 (file)
@@ -97,7 +97,7 @@ public class ImportChooserStep extends ProjectImportWizardStep {
       @Override
       public void actionPerformed(ActionEvent e) {
         if (myImportFrom.isSelected()) {
-          IdeFocusManager.getInstance(context.getProject()).requestFocus(myList);
+          IdeFocusManager.getInstance(context.getProject()).requestFocus(myList, false);
         }
         updateSteps();
       }
index f521e040716043378490142ce3f859752fd26c55..6673a8a75bf644f2ca1e08e1cb6ebe0a56ce8211 100644 (file)
@@ -185,7 +185,7 @@ class ExcludeTable extends ListTableWithButtons<ExcludeTable.Item> {
     getTableView().clearSelection();
     getTableView().addRowSelectionInterval(index, index);
     ScrollingUtil.ensureIndexIsVisible(getTableView(), index, 0);
-    IdeFocusManager.getGlobalInstance().requestFocus(getTableView());
+    IdeFocusManager.getGlobalInstance().requestFocus(getTableView(), false);
   }
 
   void reset() {
index 934b1e8f0a9c75d7cd2edc6ae9c747b260c850de..be4e56dc211950bf7c52e5c211ffe7eec56f23bb 100644 (file)
@@ -249,7 +249,7 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract
     final ActionListener updateSugnatureListener = new ActionListener() {
       public void actionPerformed(final ActionEvent e) {
         updateSignature();
-        IdeFocusManager.getInstance(myProject).requestFocus(myCreateInnerClassRb.isSelected() ? myInnerClassName :  myMethodName);
+        IdeFocusManager.getInstance(myProject).requestFocus(myCreateInnerClassRb.isSelected() ? myInnerClassName :  myMethodName, false);
       }
     };
 
index c62d6a6841c69d708d949da53f15120390e2d11f..5dc305a6884e2ced895a632432da7ba5831fc385 100644 (file)
@@ -120,11 +120,11 @@ public class IntroduceParameterObjectDialog extends RefactoringDialog {
         toggleRadioEnablement();
         final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
         if (useExistingClass()) {
-          focusManager.requestFocus(existingClassField);
+          focusManager.requestFocus(existingClassField, true);
         } else if (myCreateInnerClassRadioButton.isSelected()) {
-          focusManager.requestFocus(myInnerClassNameTextField);
+          focusManager.requestFocus(myInnerClassNameTextField, true);
         } else {
-          focusManager.requestFocus(classNameField);
+          focusManager.requestFocus(classNameField, true);
         }
       }
     };
index 7316d8e95ced2a67c48c7fca032b50c30f2d526a..f81aeca473bae0574f79fbcd32d79485afe3f71c 100644 (file)
@@ -169,7 +169,7 @@ public class ReplaceConstructorWithBuilderDialog extends RefactoringDialog {
       public void actionPerformed(final ActionEvent e) {
         setEnabled(myCreateBuilderClassRadioButton.isSelected());
         IdeFocusManager.getInstance(myProject).requestFocus(
-          myCreateBuilderClassRadioButton.isSelected() ? myNewClassName : myExistentClassTF.getChildComponent());
+          myCreateBuilderClassRadioButton.isSelected() ? myNewClassName : myExistentClassTF.getChildComponent(), true);
         validateButtons();
       }
     };
index 8514227754eec8fe7d9ec7c31dac4131b894230f..6c0eb5c41f5378c1b2b39aac14b88f7dc1f9cfb4 100644 (file)
@@ -241,13 +241,13 @@ class WrapReturnValueDialog extends RefactoringDialog {
     UIUtil.setEnabled(myCreateInnerPanel, myCreateInnerClassButton.isSelected(), true);
     final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
     if (useExistingClassButton.isSelected()) {
-      focusManager.requestFocus(existingClassField);
+      focusManager.requestFocus(existingClassField, true);
     }
     else if (myCreateInnerClassButton.isSelected()) {
-      focusManager.requestFocus(myInnerClassNameTextField);
+      focusManager.requestFocus(myInnerClassNameTextField, true);
     }
     else {
-      focusManager.requestFocus(classNameField);
+      focusManager.requestFocus(classNameField, true);
     }
     validateButtons();
   }
index af3e117def7ad3e68faa22c7d9adc4394d6ebc2c..e84a09a485d0ede2ad178090da5a7f54cc96e645 100644 (file)
@@ -383,7 +383,7 @@ public class ThreadDumpPanel extends JPanel implements DataProvider {
     public void setSelected(AnActionEvent e, boolean state) {
       myFilterPanel.setVisible(state);
       if (state) {
-        IdeFocusManager.getInstance(getEventProject(e)).requestFocus(myFilterField);
+        IdeFocusManager.getInstance(getEventProject(e)).requestFocus(myFilterField, true);
         myFilterField.selectText();
       }
       updateThreadList();
index cf44914da130b1cc42d6047155447a952a24b858..adcda7eab66f756494e7b127d308e99bee759c8a 100644 (file)
@@ -40,7 +40,7 @@ public class EditorSearchTest extends LightPlatformCodeInsightFixtureTestCase {
     assertEquals(key, getSearchTextComponent().getSelectedText());
     assertEquals(3, getSearchTextComponent().getCaretPosition());
     assertTrue(getEditorSearchComponent().hasMatches());
-    IdeFocusManager.findInstance().requestFocus(myFixture.getEditor().getContentComponent());
+    IdeFocusManager.findInstance().requestFocus(myFixture.getEditor().getContentComponent(), false);
     IdeEventQueue.getInstance().flushQueue();
 
     myFixture.performEditorAction("Find");
index f93729d6d8f717ea016de8866024d7bebe49b95e..fb87929c8f9d9666f5efb7a7a5cc92e033d0501d 100644 (file)
@@ -560,7 +560,7 @@ public class DiffUtil {
 
   public static void requestFocus(@Nullable Project project, @Nullable Component component) {
     if (component == null) return;
-    IdeFocusManager.getInstance(project).requestFocus(component);
+    IdeFocusManager.getInstance(project).requestFocus(component, true);
   }
 
   //
index 6e682fd80d55883be03f138ae97e6aa26e302d87..70b5ef3fae7afc0d610e8aa05878341ac5815b36 100644 (file)
@@ -447,7 +447,7 @@ public class DirDiffPanel implements Disposable, DataProvider {
     focusManager.doWhenFocusSettlesDown(new Runnable() {
       @Override
       public void run() {
-        focusManager.requestFocus(myTable);
+        focusManager.requestFocus(myTable, true);
       }
     });
   }
index f35c02358ed87efb082aeedd76e9660d602bf69b..0eccaa998362638e366347fa77f7ab1caf33f7c3 100644 (file)
@@ -144,7 +144,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
   @Override
   protected void restorePopupBehavior() {
     if (myPreviouslyFocused != null) {
-      IdeFocusManager.getInstance(myProject).requestFocus(myPreviouslyFocused);
+      IdeFocusManager.getInstance(myProject).requestFocus(myPreviouslyFocused, true);
     }
     super.restorePopupBehavior();
     updateComponent();
@@ -230,7 +230,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
     Component toFocus = myPreviouslyFocused;
     hint.cancel();
     if (toFocus != null) {
-      IdeFocusManager.getInstance(myProject).requestFocus(toFocus);
+      IdeFocusManager.getInstance(myProject).requestFocus(toFocus, true);
     }
   }
 
@@ -422,7 +422,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
           // focus toolwindow on the second actionPerformed
           boolean focus = requestFocus || CommandProcessor.getInstance().getCurrentCommand() != null;
           if (preferredFocusableComponent != null && focus) {
-            IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusableComponent);
+            IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusableComponent, true);
           }
         }
         if (!sameElement || !component.isUpToDate()) {
index a26250477f5b1291cfdc44037da54503ad683655..3349c17a82805d9abae35d1d3f6e400a528f71d7 100644 (file)
@@ -83,7 +83,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable,
     protected void processKeyEvent(@NotNull final KeyEvent e) {
       final char keyChar = e.getKeyChar();
       if (keyChar == KeyEvent.VK_ENTER || keyChar == KeyEvent.VK_TAB) {
-        IdeFocusManager.getInstance(myProject).requestFocus(myEditor.getContentComponent()).doWhenDone(new Runnable() {
+        IdeFocusManager.getInstance(myProject).requestFocus(myEditor.getContentComponent(), true).doWhenDone(new Runnable() {
           @Override
           public void run() {
             IdeEventQueue.getInstance().getKeyEventDispatcher().dispatchKeyEvent(e);
index 9ca1c72fd420c1cfe44e2e9b70e1c480709380d6..d9413ae318dd51ebe218479a43e0e0c5227af3c6 100644 (file)
@@ -207,7 +207,7 @@ class LookupUi {
     myLookup.getComponent().addFocusListener(new FocusAdapter() {
       @Override
       public void focusGained(FocusEvent e) {
-        final ActionCallback done = IdeFocusManager.getInstance(myProject).requestFocus(myLookup.getTopLevelEditor().getContentComponent());
+        final ActionCallback done = IdeFocusManager.getInstance(myProject).requestFocus(myLookup.getTopLevelEditor().getContentComponent(), true);
         IdeFocusManager.getInstance(myProject).typeAheadUntil(done);
         new Alarm(myLookup).addRequest(new Runnable() {
           @Override
index b0a823642cf7400571bc2a73e127a1bea5ae68a7..28956e411464478c0b63f1ddfc14f23c3936cdcd 100644 (file)
@@ -591,7 +591,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
   public void focusKey() {
     myKeyField.selectAll();
     //todo[peter,kirillk] without these invokeLaters this requestFocus conflicts with com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.MyDialog.MyWindowListener.windowOpened()
-    IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField);
+    IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true);
     final ModalityState modalityState = ModalityState.stateForComponent(myKeyField);
     ApplicationManager.getApplication().invokeLater(new Runnable() {
       @Override
@@ -602,7 +602,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
             ApplicationManager.getApplication().invokeLater(new Runnable() {
               @Override
               public void run() {
-                IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField);
+                IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true);
               }
             }, modalityState);
           }
index 08bea2b5a5594998021b997c1d24928c0955d505..ac3048cc37280ac4e976171b4b736d9f6ca32316 100644 (file)
@@ -1356,7 +1356,7 @@ class RunConfigurable extends BaseConfigurable {
           ((ConfigurationFactoryEx)factory).onConfigurationCopied(settings.getConfiguration());
         }
         final SingleConfigurationConfigurable<RunConfiguration> configurable = createNewConfiguration(settings, typeNode, getSelectedNode());
-        IdeFocusManager.getInstance(myProject).requestFocus(configurable.getNameTextField());
+        IdeFocusManager.getInstance(myProject).requestFocus(configurable.getNameTextField(), true);
         configurable.getNameTextField().setSelectionStart(0);
         configurable.getNameTextField().setSelectionEnd(copyName.length());
       }
index ae6c5f245776928ca72a67aafb8cfa1a0a24dc4a..b66616b06f358e362d3a88133e6f467311ecbdfd 100644 (file)
@@ -359,7 +359,7 @@ public class EditorSearchSession implements SearchSession,
 
   @Override
   public void close() {
-    IdeFocusManager.getInstance(getProject()).requestFocus(myEditor.getContentComponent());
+    IdeFocusManager.getInstance(getProject()).requestFocus(myEditor.getContentComponent(), false);
 
     myLivePreviewController.dispose();
     myEditor.setHeaderComponent(null);
index d625b2af322a37ead01693e10e03fb14ec605f79..f3a2fab88b96a4da6c9edfbf524dd129473c80bc 100644 (file)
@@ -332,7 +332,7 @@ public class SearchReplaceComponent extends EditorHeaderComponent implements Dat
                                                        close();
                                                      }
                                                      else {
-                                                       IdeFocusManager.getInstance(myProject).requestFocus(myTargetComponent);
+                                                       IdeFocusManager.getInstance(myProject).requestFocus(myTargetComponent, true);
                                                        addTextToRecent(mySearchTextComponent);
                                                      }
                                                    }
index 8f99e4c75c57d3200bd78481f24523f736f03190..11a490ba791bd1f5ecdea8c549283b498bd923a7 100644 (file)
@@ -808,7 +808,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
     myBalloon.show(showPoint);
     initSearchActions(myBalloon, myPopupField);
     IdeFocusManager focusManager = IdeFocusManager.getInstance(project);
-    focusManager.requestFocus(editor);
+    focusManager.requestFocus(editor, true);
     FeatureUsageTracker.getInstance().triggerFeatureUsed(IdeActions.ACTION_SEARCH_EVERYWHERE);
   }
 
index 7752d7889252d21bc037d7d5a7392f987b45acbd..62ebf41fb4e4ef01e3a146c056cf6ec1f7391ca9 100644 (file)
@@ -74,7 +74,7 @@ public class ProjectViewSelectInGroupTarget implements CompositeSelectInTarget,
               target.selectIn(context, requestFocus);
               return ActionCallback.DONE;
             }
-          });
+          }, true);
         }
         else {
           target.selectIn(context, requestFocus);
index f9fcf5f7d88971ae7f9487bcc6d3080dcbf2d182..f41b9f5705df8c0422ff5f322ab1eaec5591617d 100644 (file)
@@ -291,7 +291,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
         if (!myList.isEmpty()) {
           myModel.setSelectedIndex(myList.size() - 1);
           if (requestFocus) {
-            IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this);
+            IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this, true);
           }
         }
       }
@@ -412,7 +412,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
 
         if (e.isPopupTrigger()) {
           myModel.setSelectedIndex(index);
-          IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this);
+          IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this, true);
           rightClick(index);
           e.consume();
         }
@@ -424,7 +424,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
           }
           else if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
             myModel.setSelectedIndex(index);
-            IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this);
+            IdeFocusManager.getInstance(myProject).requestFocus(NavBarPanel.this, true);
             doubleClick(index);
             e.consume();
           }
index 4d64a42cdb1ec37493a4f589a01aff65f567b033..74417627abd15932833c9fa02927111741cb9b17 100644 (file)
@@ -76,7 +76,7 @@ public class NavBarPopup extends LightweightHint implements Disposable{
         if (e.getComponent() != getList()) return;
         if (!e.isConsumed() && e.isPopupTrigger()) {
           myPanel.getModel().setSelectedIndex(selectedIndex);
-          IdeFocusManager.getInstance(myPanel.getProject()).requestFocus(myPanel);
+          IdeFocusManager.getInstance(myPanel.getProject()).requestFocus(myPanel, true);
           myPanel.rightClick(selectedIndex);
           e.consume();
         } else {
index b14ae246dd9bffdfe33c8b345cb6a65540522b96..dd46f6496c4678e36418965dc43c04b0bddc2a25 100644 (file)
@@ -206,7 +206,7 @@ public abstract class BaseProjectTreeBuilder extends AbstractTreeBuilder {
       @Override
       public void run() {
         if (requestFocus && virtualSelectTarget == null && getUi().isReady()) {
-          focusRequestor.requestFocus(getTree());
+          focusRequestor.requestFocus(getTree(), true);
         }
 
         result.setDone();
index 034141d4507c54ba8abdb3275b082cbbff9add0b..aa5876292522302d850a328a59ff67d4316d2f98 100644 (file)
@@ -501,7 +501,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
 
     myAutoScrollToSourceHandler.install(newPane.myTree);
 
-    IdeFocusManager.getInstance(myProject).requestFocus(newPane.getComponentToFocus());
+    IdeFocusManager.getInstance(myProject).requestFocus(newPane.getComponentToFocus(), false);
 
     newPane.restoreExpandedPaths();
     if (selectedPsiElement != null) {
index 04c707c27974509c580a661a8ff24dd9e36d949a..0eec66ec69889c6c18fe4b8251b3ce48cfcfab51 100644 (file)
@@ -486,7 +486,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
               @Override
               public void run() {
                 if (requestFocus) {
-                  IdeFocusManager.getInstance(myProject).requestFocus(myAbstractTreeBuilder.getTree());
+                  IdeFocusManager.getInstance(myProject).requestFocus(myAbstractTreeBuilder.getTree(), false);
                 }
               }
             });
index 7c2fb1c58fd93ed2d59fff0f9547b2fc06e2cc5d..417d3685244a160d7ca5f433af069b42b4389fd4 100644 (file)
@@ -359,7 +359,7 @@ public class FileStructurePopup implements Disposable, TreeActionsOwner {
       myPopup.setSize(new Dimension(myPreferredWidth + 10, myPopup.getSize().height));
     }
 
-    IdeFocusManager.getInstance(myProject).requestFocus(myTree);
+    IdeFocusManager.getInstance(myProject).requestFocus(myTree, true);
     SwingUtilities.windowForComponent(myPopup.getContent()).addWindowFocusListener(new WindowFocusListener() {
       @Override
       public void windowGainedFocus(WindowEvent e) {
index 58ba85d4b85a6d45d8e2c5fe242fe0db4f285bfe..9dcc72110d80092d89730827817e3134a38bb55a 100644 (file)
@@ -527,13 +527,13 @@ public abstract class ChooseByNameBase {
               else {
                 Component oppositeComponent = e.getOppositeComponent();
                 if (oppositeComponent == myCheckBox) {
-                  IdeFocusManager.getInstance(myProject).requestFocus(myTextField);
+                  IdeFocusManager.getInstance(myProject).requestFocus(myTextField, true);
                   return;
                 }
                 if (oppositeComponent != null && !(oppositeComponent instanceof JFrame) &&
                     myList.isShowing() &&
                     (oppositeComponent == myList || SwingUtilities.isDescendingFrom(myList, oppositeComponent))) {
-                  IdeFocusManager.getInstance(myProject).requestFocus(myTextField);// Otherwise me may skip some KeyEvents
+                  IdeFocusManager.getInstance(myProject).requestFocus(myTextField, true);// Otherwise me may skip some KeyEvents
                   return;
                 }
 
@@ -642,7 +642,7 @@ public abstract class ChooseByNameBase {
       @Override
       public boolean onClick(@NotNull MouseEvent e, int clickCount) {
         if (!myTextField.hasFocus()) {
-          IdeFocusManager.getInstance(myProject).requestFocus(myTextField);
+          IdeFocusManager.getInstance(myProject).requestFocus(myTextField, true);
         }
 
         if (clickCount == 2) {
@@ -895,7 +895,7 @@ public abstract class ChooseByNameBase {
 
         IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
         if (isDescendingFromTemporarilyFocusableToolWindow(focusManager.getFocusOwner())) {
-          focusManager.requestFocus(myTextField);
+          focusManager.requestFocus(myTextField, true);
           return false;
         }
         else {
index 11d4739cce24fd863d7ffe7707993dde58eeb4c1..93f16d74899fb2033009ffaa2436230918ed85ff 100644 (file)
@@ -534,15 +534,15 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider, Disp
   }
 
   private void focusEditor() {
-    IdeFocusManager.getInstance(myProject).requestFocus(myEditor.getContentComponent());
+    IdeFocusManager.getInstance(myProject).requestFocus(myEditor.getContentComponent(), true);
   }
 
   private void focusTree() {
-    IdeFocusManager.getInstance(myProject).requestFocus(myPsiTree);
+    IdeFocusManager.getInstance(myProject).requestFocus(myPsiTree, true);
   }
 
   private void focusRefs() {
-    IdeFocusManager.getInstance(myProject).requestFocus(myRefs);
+    IdeFocusManager.getInstance(myProject).requestFocus(myRefs, true);
     if (myRefs.getModel().getSize() > 0) {
       if (myRefs.getSelectedIndex() == -1) {
         myRefs.setSelectedIndex(0);
@@ -551,7 +551,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider, Disp
   }
 
   private void focusBlockTree() {
-    IdeFocusManager.getInstance(myProject).requestFocus(myBlockTree);
+    IdeFocusManager.getInstance(myProject).requestFocus(myBlockTree, true);
   }
 
   private void initMnemonics() {
index 18ab71e9fc7db8d8f82973234a62ffd7a909d65e..7ab37c2ebfe2a834f8f0098df16c0c37fe2c6086 100644 (file)
@@ -46,7 +46,7 @@ public class IncrementalFindAction extends EditorAction {
       if (!editor.isOneLineMode()) {
         EditorSearchSession search = EditorSearchSession.get(editor);
         if (search != null) {
-          IdeFocusManager.getInstance(project).requestFocus(search.getComponent());
+          IdeFocusManager.getInstance(project).requestFocus(search.getComponent(), true);
           FindUtil.configureFindModel(myReplace, editor, search.getFindModel(), false);
         } else {
           FindManager findManager = FindManager.getInstance(project);
index 00c0bbbfdc750530b300a43e41e8cf847132ff12..2c9c8283c794bc0eb6956e8c919a47445db18c44 100644 (file)
@@ -560,7 +560,7 @@ public abstract class ChangeSignatureDialogBase<ParamInfo extends ParameterInfo,
         if (root != null) {
           Component c = root.getFocusTraversalPolicy().getComponentAfter(root, mySignatureArea);
           if (c != null) {
-            IdeFocusManager.findInstance().requestFocus(c);
+            IdeFocusManager.findInstance().requestFocus(c, true);
           }
         }
       }
index 8b5f07dff062f3f0d7ac316415edbda52aa63486..4b61c5a108a4a30fddfb3332eaa77a85aa7db09d 100644 (file)
@@ -387,7 +387,7 @@ public class ToolEditorDialog extends DialogWrapper {
         }
         ;
       }
-      IdeFocusManager.findInstance().requestFocus(myTextField);
+      IdeFocusManager.findInstance().requestFocus(myTextField, true);
     }
   }
 
index f9f73e060175742d259eded75dd744303eeb3768..55c80b9f69cdf84e845f4bddadfc461af4134491 100644 (file)
@@ -452,7 +452,7 @@ public abstract class AbstractWizard<T extends Step> extends DialogWrapper {
       @Override
       public void run() {
         final IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(component);
-        focusManager.requestFocus(component);
+        focusManager.requestFocus(component, false);
       }
     });
   }
index 9e5dc6ec1a22222a52497d2af5d36001be550db5..3c31629eee3eb798e27b271e5c67f2bf30c60203 100644 (file)
@@ -126,7 +126,7 @@ public class AbstractWizardEx extends AbstractWizard<AbstractWizardStepEx> {
     setTitle(stepTitle != null ? myTitle + ": " + stepTitle : myTitle);
     final JComponent toFocus = step.getPreferredFocusedComponent();
     if (toFocus != null) {
-      IdeFocusManager.findInstanceByComponent(getWindow()).requestFocus(toFocus);
+      IdeFocusManager.findInstanceByComponent(getWindow()).requestFocus(toFocus, true);
     }
   }
 
index 7675adb5b6c83fab5157a95b83cb4e4647426553..316fdd4640b254d1f0797a37c55355746f76d044 100644 (file)
@@ -149,7 +149,7 @@ public class OpenFileDescriptor implements Navigatable, Comparable<OpenFileDescr
         Editor e = ((TextEditor)editor).getEditor();
         unfoldCurrentLine(e);
         if (focusEditor) {
-          IdeFocusManager.getInstance(myProject).requestFocus(e.getContentComponent());
+          IdeFocusManager.getInstance(myProject).requestFocus(e.getContentComponent(), true);
         }
       }
     }
index c4099fd54add502008ef42301e487abaf59ab186..a3d8734e84ffb3f2713c120a5df40eb72146cc48 100644 (file)
@@ -113,7 +113,7 @@ public class ComboBox extends ComboBoxWithWidePopup implements AWTEventListener
               final Object value = list.getSelectedValue();
               if (value != null) {
                 configureEditor(getEditor(), value);
-                IdeFocusManager.getGlobalInstance().requestFocus(ComboBox.this);
+                IdeFocusManager.getGlobalInstance().requestFocus(ComboBox.this, true);
                 assert myJBPopup != null;
                 ComboBox.this.getUI().setPopupVisible(ComboBox.this, false);
                 myJBPopup.cancel();
index 58727d883a22e2dfa349bb5b96895450f5895fdf..9a66d45345a93cc3489c08e5a4986f88f0b0633a 100644 (file)
@@ -1835,7 +1835,7 @@ public abstract class DialogWrapper {
       ValidationInfo info = doValidate();
       if (info != null) {
         if (info.component != null && info.component.isVisible()) {
-          IdeFocusManager.getInstance(null).requestFocus(info.component);
+          IdeFocusManager.getInstance(null).requestFocus(info.component, true);
         }
         DialogEarthquakeShaker.shake((JDialog)getPeer().getWindow());
         startTrackingValidation();
index edf7ba726682f559c29b8cb222359c410ade9a2a..304a534826dfc78b06d531c902e2de740a6458cb 100644 (file)
@@ -38,7 +38,7 @@ import java.util.Arrays;
  */
 public abstract class FocusCommand extends ActiveRunnable implements Expirable {
   protected Component myDominationComponent;
-  protected Throwable myAllocation;
+  private Throwable myAllocation;
   private ActionCallback myCallback;
   private boolean myInvalidatesPendingFurtherRequestors = true;
   private Expirable myExpirable;
@@ -58,10 +58,6 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable {
 
   private boolean myForced;
 
-  protected FocusCommand(Throwable allocation) {
-    myAllocation = allocation;
-  }
-
   protected FocusCommand() {
     saveAllocation();
   }
@@ -165,6 +161,7 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable {
 
   public static class ByComponent extends FocusCommand {
     private Component myToFocus;
+    private Throwable myAllocation;
 
     public ByComponent(@Nullable Component toFocus, @NotNull Throwable allocation) {
       this(toFocus, toFocus, allocation);
index b09bd77c4ed142ac5d051a08b38646c58e30a7b9..0394d782d801e619918abee3c2973595906b7d06 100644 (file)
@@ -21,37 +21,16 @@ import org.jetbrains.annotations.NotNull;
 
 import java.awt.*;
 
-import static com.sun.tools.doclint.Entity.not;
-
 /**
  * Basic interface for requesting sending focus commands to <code>IdeFocusManager</code>
  */
 public interface FocusRequestor extends Disposable {
 
-  /**
-   * Requests focus on a component
-   * @param c - component to request focus to
-   * @return action callback that either notifies when the focus was obtained or focus request was dropped
-   */
-  @NotNull
-  ActionCallback requestFocus(@NotNull Component c);
-
-  /**
-   * Runs a request focus command, actual focus request is defined by the user in the command itself
-   * @return action callback that either notifies when the focus was obtained or focus request was dropped
-   */
-  @NotNull
-  ActionCallback requestFocus(@NotNull FocusCommand command);
-
-  @NotNull
-  ActionCallback requestFocus(@NotNull Component c, @NotNull Throwable creationTrace);
-
   /**
    * Requests focus on a component
    * @param c - component to request focus to
    * @param forced - if true - focus request is explicit, must be fulfilled, if false - can be dropped
    * @return action callback that either notifies when the focus was obtained or focus request was dropped
-   * @Deprecated
    */
   @NotNull
   ActionCallback requestFocus(@NotNull Component c, boolean forced);
@@ -60,7 +39,6 @@ public interface FocusRequestor extends Disposable {
    * Runs a request focus command, actual focus request is defined by the user in the command itself
    * @param forced - if true - focus request is explicit, must be fulfilled, if false - can be dropped
    * @return action callback that either notifies when the focus was obtained or focus request was dropped
-   * * @Deprecated
    */
   @NotNull
   ActionCallback requestFocus(@NotNull FocusCommand command, boolean forced);
index 28ff040d58ab2dac04a29af77f8e0cf68ce32f0f..f124c85a9f5a670965c8afd5f1fa3bb1812497aa 100644 (file)
@@ -34,35 +34,12 @@ public class PassThroughIdeFocusManager extends IdeFocusManager {
   }
 
   @NotNull
-  @Override
-  public ActionCallback requestFocus(@NotNull Component c) {
-    c.requestFocus();
-    return ActionCallback.DONE;
-  }
-
-  @NotNull
-  @Override
-  public ActionCallback requestFocus(@NotNull FocusCommand command) {
-    return command.run();
-  }
-
-
-  @NotNull
-  @Override
-  public ActionCallback requestFocus(@NotNull Component c, @NotNull Throwable creationTrace) {
-    return requestFocus(c);
-  }
-
-  @NotNull
-  @Override
   public ActionCallback requestFocus(@NotNull Component c, boolean forced) {
     c.requestFocus();
     return ActionCallback.DONE;
   }
 
   @NotNull
-  @Override
-  @Deprecated
   public ActionCallback requestFocus(@NotNull FocusCommand command, boolean forced) {
     return command.run();
   }
index 16dad55baf8bb6d85f662904251ffe67e9b2e64f..b90181303795fef4c99b74c0a41866cae0e94bb4 100644 (file)
@@ -444,7 +444,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
         // this replaces focus request in JTable.processKeyBinding
         final IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(this);
         focusManager.setTypeaheadEnabled(false);
-        focusManager.requestFocus(editorComp).doWhenProcessed(new Runnable() {
+        focusManager.requestFocus(editorComp, true).doWhenProcessed(new Runnable() {
           @Override
           public void run() {
             focusManager.setTypeaheadEnabled(true);
index 6d6158d8bb0af68ed6b1c24cbe70a538cdca42b3..fb5006d1807add2b2b1fb0d279d0b1d36e8e0b54 100644 (file)
@@ -1001,7 +1001,7 @@ public class JBTabsImpl extends JComponent
 
 
     if (isShowing()) {
-      return myFocusManager.requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()));
+      return myFocusManager.requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()), true);
     }
     else {
       final ActionCallback result = new ActionCallback();
@@ -1019,7 +1019,7 @@ public class JBTabsImpl extends JComponent
         @Override
         public void run() {
           queued.set(true);
-          requestor.requestFocus(new FocusCommand.ByComponent(toFocus, new Exception())).notify(result);
+          requestor.requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()), true).notify(result);
         }
       };
       return result;
index 7c523a595a51785dab3c2c6517f99fadc8a91c0d..92348089686ec4f77328b7af5b85bb3ecca7b804 100644 (file)
@@ -846,7 +846,7 @@ public final class TreeUtil {
     tree.expandPath(treePath);
     if (requestFocus) {
       ActionCallback result = new ActionCallback(2);
-      IdeFocusManager.getInstance(project).requestFocus(tree).notifyWhenDone(result);
+      IdeFocusManager.getInstance(project).requestFocus(tree, true).notifyWhenDone(result);
       selectPath(tree, treePath, center).notifyWhenDone(result);
       return result;
     }
index 46a587a66c82e2f78004dedae4e073390e944289..7bdb59ea19e27a888a464b5093c41485f7d55c2a 100644 (file)
@@ -140,7 +140,7 @@ public class LightToolWindow extends JPanel {
 
     addMouseListener(new MouseAdapter() {
       public void mouseReleased(final MouseEvent e) {
-        IdeFocusManager.getInstance(myProject).requestFocus(myFocusedComponent);
+        IdeFocusManager.getInstance(myProject).requestFocus(myFocusedComponent, true);
       }
     });
 
index 0e9d87b3ce0115b0e54a5832d9d25045764d0f04..098f86b887007c3553c909f8c154c41f4901a586 100644 (file)
@@ -331,7 +331,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
       public void stateChanged(ChangeEvent e) {
         final JComponent c = getPreferredFocusedComponent();
         if (c != null) {
-          IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(c);
+          IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(c, true);
         }
       }
     });
index b80e73eeee70b738ee96c296b15c120607a41a8f..4b5e5d87c232163e641a29258255522424e2cf2e 100644 (file)
@@ -214,7 +214,7 @@ class IdeaHelpBroker extends DefaultHelpBroker implements KeyListener{
       myFrame.setState(JFrame.NORMAL);
       IdeFocusManager focusManager = IdeFocusManager.findInstance();
       JComponent target = focusManager.getFocusTargetFor(myFrame.getRootPane());
-      focusManager.requestFocus(target != null ? target : myFrame);
+      focusManager.requestFocus(target != null ? target : myFrame, true);
     }
   }
 
index e2024107fceaae92e45d6990dc719a2e8c0fb10a..8d2aca5b48ae67986fbec11940bfa266ab312fea 100644 (file)
@@ -717,7 +717,7 @@ public class Switcher extends AnAction implements DumbAware {
               if (selectedList.getModel().getSize() == 0) {
                 focusTarget = selectedList == files ? toolWindows : files;
               }
-              focusManager.requestFocus(focusTarget);
+              focusManager.requestFocus(focusTarget, true);
             }
           }, 300);
           if (jList.getModel().getSize() == 1) {
@@ -803,7 +803,7 @@ public class Switcher extends AnAction implements DumbAware {
           files.setSelectedIndex(index);
           files.ensureIndexIsVisible(index);
           toolWindows.getSelectionModel().clearSelection();
-          IdeFocusManager.findInstanceByComponent(files).requestFocus(files);
+          IdeFocusManager.findInstanceByComponent(files).requestFocus(files, true);
         }
       }
     }
@@ -820,7 +820,7 @@ public class Switcher extends AnAction implements DumbAware {
         if (toolWindows.getModel().getSize() > 0) {
           toolWindows.setSelectedIndex(Math.min(files.getSelectedIndex(), toolWindows.getModel().getSize() - 1));
           files.getSelectionModel().clearSelection();
-          IdeFocusManager.findInstanceByComponent(toolWindows).requestFocus(toolWindows);
+          IdeFocusManager.findInstanceByComponent(toolWindows).requestFocus(toolWindows, true);
         }
       }
     }
@@ -839,7 +839,7 @@ public class Switcher extends AnAction implements DumbAware {
       list.setSelectedIndex(index);
       list.ensureIndexIsVisible(index);
       if (selected != list) {
-        IdeFocusManager.findInstanceByComponent(list).requestFocus(list);
+        IdeFocusManager.findInstanceByComponent(list).requestFocus(list, true);
       }
     }
 
@@ -1081,7 +1081,7 @@ public class Switcher extends AnAction implements DumbAware {
       protected void selectElement(final Object element, String selectedText) {
         if (element instanceof FileInfo) {
           if (!toolWindows.isSelectionEmpty()) toolWindows.clearSelection();
-          IdeFocusManager.findInstanceByComponent(files).requestFocus(files).doWhenDone(new Runnable() {
+          IdeFocusManager.findInstanceByComponent(files).requestFocus(files, true).doWhenDone(new Runnable() {
             @Override
             public void run() {
               files.setSelectedValue(element, true);
@@ -1090,7 +1090,7 @@ public class Switcher extends AnAction implements DumbAware {
         }
         else {
           if (!files.isSelectionEmpty()) files.clearSelection();
-          IdeFocusManager.findInstanceByComponent(toolWindows).requestFocus(toolWindows).doWhenDone(new Runnable() {
+          IdeFocusManager.findInstanceByComponent(toolWindows).requestFocus(toolWindows, true).doWhenDone(new Runnable() {
             @Override
             public void run() {
               toolWindows.setSelectedValue(element, true);
index b35a5ef16dd50f23e5dc1b3ee404e3cf7373999c..6a35377e6d5299bc1b70de89ab77a549df477a63 100644 (file)
@@ -286,7 +286,7 @@ public class ProjectUtil {
       AppIcon.getInstance().requestFocus((IdeFrame)WindowManager.getInstance().getFrame(p));
       cmd.run();
     } else {
-      IdeFocusManager.getInstance(p).requestFocus(cmd);
+      IdeFocusManager.getInstance(p).requestFocus(cmd, true);
     }
   }
 
index 4e3c0513a47ca5df623bf98f64c0d007076807d2..2cfe3ec9266a3662ba6b63ba5345ec2c38449f52 100644 (file)
@@ -54,7 +54,7 @@ public class GotoLineNumberDialog extends DialogWrapper {
     myEditor.getCaretModel().moveToLogicalPosition(position);
     myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
     myEditor.getSelectionModel().removeSelection();
-    IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent());
+    IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
     super.doOKAction();
   }
 
index e19e6b6233c201a881eec71b2c5141e92bb9af51..5af732fbb0ef7715f78d6a9e8f82f17908762414 100644 (file)
@@ -52,7 +52,7 @@ public class FocusTracesAction extends AnAction implements DumbAware {
         @Override
         public void eventDispatched(AWTEvent event) {
           if (event instanceof FocusEvent && event.getID() == FocusEvent.FOCUS_GAINED) {
-            focusManager.recordFocusRequest(((FocusEvent)event).getComponent(), new Exception());
+            focusManager.recordFocusRequest(((FocusEvent)event).getComponent(), false);
           }
         }
       };
index bf7b2b5c9b94c4f99759b9cb2a321772571eb503..d842e274cf7d1ddca07aa55f38a16794cc0358de 100644 (file)
@@ -47,7 +47,7 @@ import java.util.List;
 public class FocusTracesDialog extends DialogWrapper {
   private final JBTable myRequestsTable;
   private final List<FocusRequestInfo> myRequests;
-  private static final String[] COLUMNS = {"Time", "Component"};
+  private static final String[] COLUMNS = {"Time", "Forced", "Component"};
   private final ConsoleView consoleView;
 
   public FocusTracesDialog(Project project, ArrayList<FocusRequestInfo> requests) {
@@ -57,7 +57,7 @@ public class FocusTracesDialog extends DialogWrapper {
     final String[][] data = new String[requests.size()][];
     for (int i = 0; i < data.length; i++) {
       final FocusRequestInfo r = requests.get(i);
-      data[i] = new String[]{r.getDate(), String.valueOf(r.getComponent())};
+      data[i] = new String[]{r.getDate(), String.valueOf(r.isForced()), String.valueOf(r.getComponent())};
     }
     setModal(false);
     myRequestsTable = new JBTable(new DefaultTableModel(data, COLUMNS) {
index 514e6e56f5421a4bccba0632cc1ed2c548352cb9..1ccf842898cd03804f0617f28c6e2a43728892d3 100644 (file)
@@ -215,7 +215,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
       public void actionPerformed(AnActionEvent e) {
         if (getEditor1() != null && getEditor2() != null) {
           Editor focus = getEditor1().getContentComponent().hasFocus() ? getEditor2() : getEditor1();
-          IdeFocusManager.getGlobalInstance().requestFocus(focus.getContentComponent());
+          IdeFocusManager.getGlobalInstance().requestFocus(focus.getContentComponent(), true);
           focus.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
         }
       }
@@ -701,7 +701,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
       if (isEditor1Focused || isEditor2Focused) {
         Editor e = isEditor2Focused ? getEditor2() : getEditor1();
         if (e != null) {
-          fm.requestFocus(e.getContentComponent());
+          fm.requestFocus(e.getContentComponent(), true);
         }
       }
 
index 80094da60868f680716944e6de1d913241dbc15a..cdc2d8b84778539e509092b7850ad52bb101eb66 100644 (file)
@@ -4392,7 +4392,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
   private void requestFocus() {
     final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
     if (focusManager.getFocusOwner() != myEditorComponent) { //IDEA-64501
-      focusManager.requestFocus(myEditorComponent);
+      focusManager.requestFocus(myEditorComponent, true);
     }
   }
 
index 7e8e666c314545ad848bc894bf20610e1c7038b2..d6320f5d290b048fefc3f913fa37b851a3f8645d 100644 (file)
@@ -359,7 +359,7 @@ public final class EditorTabbedContainer implements Disposable, CloseAction.Clos
 
   public void requestFocus(boolean forced) {
     if (myTabs != null) {
-      IdeFocusManager.getInstance(myProject).requestFocus(myTabs.getComponent());
+      IdeFocusManager.getInstance(myProject).requestFocus(myTabs.getComponent(), forced);
     }
   }
 
index 9c0b7593c7c44f1b6bf13964cfe135d9e71d14bb..cbc8a0f1fb62be565871e317577d012cb3c3a042 100644 (file)
@@ -251,7 +251,7 @@ public class EditorWindow {
               JComponent otherComponent = splitter.getOtherComponent(myPanel);
 
               if (otherComponent != null) {
-                IdeFocusManager.findInstance().requestFocus(otherComponent);
+                IdeFocusManager.findInstance().requestFocus(otherComponent, true);
               }
             }
 
@@ -505,7 +505,7 @@ public class EditorWindow {
     else {
       EditorWithProviderComposite editor = getSelectedEditor();
       JComponent preferred = editor == null ? null : editor.getPreferredFocusedComponent();
-      IdeFocusManager.findInstanceByComponent(preferred == null ? myPanel : preferred).requestFocus(myPanel);
+      IdeFocusManager.findInstanceByComponent(preferred == null ? myPanel : preferred).requestFocus(myPanel, forced);
     }
   }
 
@@ -537,7 +537,7 @@ public class EditorWindow {
               if (!TComp.this.hasFocus()) return;
               final JComponent focus = myEditor.getSelectedEditorWithProvider().getFirst().getPreferredFocusedComponent();
               if (focus != null && !focus.hasFocus()) {
-                IdeFocusManager.getGlobalInstance().requestFocus(focus);
+                IdeFocusManager.getGlobalInstance().requestFocus(focus, true);
               }
             }
           });
index f3c938deddb50ba8c6e3330c54c7efbcaed27eec..d0b74234546dd28ad4c10a7de26088af56e676ad 100644 (file)
@@ -277,7 +277,7 @@ final class SettingsEditor extends AbstractEditor implements DataProvider {
           public void run() {
             JComponent component = myEditor.getPreferredFocusedComponent();
             if (component != null) {
-              IdeFocusManager.findInstanceByComponent(component).requestFocus(component);
+              IdeFocusManager.findInstanceByComponent(component).requestFocus(component, true);
             }
           }
         });
index 0055904610d51500bc54a7155400c06c52a9ea46..248eb2a42fdf66d0e8819f6143a87cd6ba943277 100644 (file)
@@ -63,7 +63,7 @@ abstract class SettingsFilter extends ElementFilter.Active.Impl<SimpleNode> {
         // request focus if needed on changing the filter text
         IdeFocusManager manager = IdeFocusManager.findInstanceByComponent(mySearch);
         if (manager.getFocusedDescendantFor(mySearch) == null) {
-          manager.requestFocus(mySearch);
+          manager.requestFocus(mySearch, true);
         }
       }
     });
index e2c9bb7c1a570b58a131a0de3d0d8846cebebf41..ce1264b644bc67ed993a1e0eceb69dc923a19938 100644 (file)
@@ -331,7 +331,7 @@ class ProgressDialog implements Disposable {
             }
           }
 
-          myProgressWindow.getFocusManager().requestFocus(myCancelButton).doWhenDone(myRepaintRunnable);
+          myProgressWindow.getFocusManager().requestFocus(myCancelButton, true).doWhenDone(myRepaintRunnable);
         }
       }
     });
index 3f134f7e809d5285469ccb569cc0ae0cb14c390c..e18e48f55fd5922461784f6bebef85015b607a6e 100644 (file)
@@ -148,7 +148,7 @@ public class FrameWrapper implements Disposable, DataProvider {
         }
 
         if (toFocus != null) {
-          fm.requestFocus(toFocus).notify(myFocusedCallback);
+          fm.requestFocus(toFocus, true).notify(myFocusedCallback);
         } else {
           myFocusedCallback.setRejected();
         }
index 0071f919820c1e6bab1141d5e53c11c3533b188b..63e028c809dea7e2a99aef98de487a426a5c57f4 100644 (file)
@@ -999,7 +999,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
 
             if (toFocus != null) {
               if (isShowing() && isActive()) {
-                getFocusManager().requestFocus(toFocus);
+                getFocusManager().requestFocus(toFocus, true);
                 notifyFocused(wrapper);
               }
             } else {
index 1302c5867cb66356420b7d6f5ee37d864f74157d..3e50443a24cd03614358c6d7a915e96ee831672a 100644 (file)
@@ -86,7 +86,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
   private final EdtAlarm myForcedFocusRequestsAlarm;
 
   private final SimpleTimer myTimer = SimpleTimer.newInstance("FocusManager timer");
-
+  
   private final EdtAlarm myIdleAlarm;
   private final Set<Runnable> myIdleRequests = new LinkedHashSet<Runnable>();
 
@@ -194,54 +194,17 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
   @Override
   @NotNull
-  public ActionCallback requestFocus(@NotNull Component c, @NotNull Throwable creationTrace) {
-    return requestFocus(new FocusCommand.ByComponent(c, creationTrace));
-  }
-
-  @Override
-  @NotNull
-  public ActionCallback requestFocus(@NotNull final Component c) {
-    return requestFocus(new FocusCommand.ByComponent(c, new Exception()));
-  }
-
-  @Override
-  @NotNull
-  public ActionCallback requestFocus(@NotNull final FocusCommand command) {
-    assertDispatchThread();
-
-    if (isInternalMode) {
-      recordCommand(command, command.getAllocation());
-    }
-    final ActionCallback result = new ActionCallback();
-
-    myActivityMonitor.addActivity(FOCUS, ModalityState.any());
-    _requestFocus(command, result);
-
-    result.doWhenProcessed(new Runnable() {
-      @Override
-      public void run() {
-        restartIdleAlarm();
-      }
-    });
-
-    return result;
-  }
-
-  @Override
-  @Deprecated
-  @NotNull
   public ActionCallback requestFocus(@NotNull final Component c, final boolean forced) {
     return requestFocus(new FocusCommand.ByComponent(c, new Exception()), forced);
   }
 
   @Override
-  @Deprecated
   @NotNull
   public ActionCallback requestFocus(@NotNull final FocusCommand command, final boolean forced) {
     assertDispatchThread();
 
     if (isInternalMode) {
-      recordCommand(command, new Throwable());
+      recordCommand(command, new Throwable(), forced);
     }
     final ActionCallback result = new ActionCallback();
 
@@ -261,12 +224,12 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
         @Override
         public void run() {
           resetUnforcedCommand(command);
-          _requestFocus(command, result);
+          _requestFocus(command, forced, result);
         }
       });
     }
     else {
-      _requestFocus(command, result);
+      _requestFocus(command, forced, result);
     }
 
     result.doWhenProcessed(new Runnable() {
@@ -284,84 +247,95 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
     return myRequests;
   }
 
-  public void recordFocusRequest(Component c, @NotNull Throwable causeTrace) {
-    myRequests.add(new FocusRequestInfo(c, causeTrace));
+  public void recordFocusRequest(Component c, boolean forced) {
+    myRequests.add(new FocusRequestInfo(c, new Throwable(), forced));
     if (myRequests.size() > 200) {
       myRequests.removeFirst();
     }
   }
 
-  private void recordCommand(@NotNull FocusCommand command, @NotNull Throwable trace) {
+  private void recordCommand(@NotNull FocusCommand command, @NotNull Throwable trace, boolean forced) {
     if (FocusTracesAction.isActive()) {
-      recordFocusRequest(command.getDominationComponent(), trace);
+      recordFocusRequest(command.getDominationComponent(), forced);
     }
   }
 
-  private void _requestFocus(@NotNull final FocusCommand command, @NotNull final ActionCallback result) {
+  private void _requestFocus(@NotNull final FocusCommand command, final boolean forced, @NotNull final ActionCallback result) {
     result.doWhenProcessed(new Runnable() {
       @Override
       public void run() {
         maybeRemoveFocusActivity();
       }
     });
-
-    if (checkForRejectOrByPass(command, result)) return;
+    
+    if (checkForRejectOrByPass(command, forced, result)) return;
 
     setCommand(command);
     command.setCallback(result);
 
-    myForcedFocusRequestsAlarm.cancelAllRequests();
-    setLastEffectiveForcedRequest(command);
+    if (forced) {
+      myForcedFocusRequestsAlarm.cancelAllRequests();
+      setLastEffectiveForcedRequest(command);
+    }
 
-    if (checkForRejectOrByPass(command, result)) return;
+    SwingUtilities.invokeLater(new Runnable() {
+      @Override
+      public void run() {
+        if (checkForRejectOrByPass(command, forced, result)) return;
+
+        if (myRequestFocusCmd == command) {
+          final TimedOutCallback focusTimeout =
+            new TimedOutCallback(Registry.intValue("actionSystem.commandProcessingTimeout"),
+                                        "Focus command timed out, cmd=" + command, command.getAllocation(), true) {
+              @Override
+              protected void onTimeout() {
+                forceFinishFocusSettleDown(command, result);
+              }
+            };
 
-    if (myRequestFocusCmd == command) {
-      final TimedOutCallback focusTimeout =
-        new TimedOutCallback(Registry.intValue("actionSystem.commandProcessingTimeout"),
-                             "Focus command timed out, cmd=" + command, command.getAllocation(), true) {
-          @Override
-          protected void onTimeout() {
-            forceFinishFocusSettleDown(command, result);
+          if (command.invalidatesRequestors()) {
+            myCmdTimestamp++;
+          }
+          revalidateFurtherRequestors();
+          if (forced) {
+            if (command.invalidatesRequestors()) {
+              myForcedCmdTimestamp++;
+            }
+            revalidateFurtherRequestors();
           }
-        };
-
-      if (command.invalidatesRequestors()) {
-        myCmdTimestamp++;
-      }
-      revalidateFurtherRequestors();
-      if (command.invalidatesRequestors()) {
-        myForcedCmdTimestamp++;
-      }
-      revalidateFurtherRequestors();
 
-      command.run().doWhenDone(new Runnable() {
-        @Override
-        public void run() {
-          UIUtil.invokeLaterIfNeeded(new Runnable() {
+          command.setForced(forced);
+          command.run().doWhenDone(new Runnable() {
             @Override
             public void run() {
-              resetCommand(command, false);
-              result.setDone();
+              UIUtil.invokeLaterIfNeeded(new Runnable() {
+                @Override
+                public void run() {
+                  resetCommand(command, false);
+                  result.setDone();
+                }
+              });
             }
-          });
-        }
-      }).doWhenRejected(new Runnable() {
-        @Override
-        public void run() {
-          result.setRejected();
-          resetCommand(command, true);
+          }).doWhenRejected(new Runnable() {
+            @Override
+            public void run() {
+              result.setRejected();
+              resetCommand(command, true);
+            }
+          }).doWhenProcessed(new Runnable() {
+            @Override
+            public void run() {
+              if (forced) {
+                myForcedFocusRequestsAlarm.addRequest(new SetLastEffectiveRunnable(), 250);
+              }
+            }
+          }).notify(focusTimeout);
         }
-      }).doWhenProcessed(new Runnable() {
-        @Override
-        public void run() {
-          myForcedFocusRequestsAlarm.addRequest(new SetLastEffectiveRunnable(), 250);
+        else {
+          rejectCommand(command, result);
         }
-      }).notify(focusTimeout);
-    }
-    else {
-      rejectCommand(command, result);
-    }
-
+      }
+    });
   }
 
   private void maybeRemoveFocusActivity() {
@@ -370,7 +344,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
     }
   }
 
-  private boolean checkForRejectOrByPass(@NotNull FocusCommand cmd, @NotNull ActionCallback result) {
+  private boolean checkForRejectOrByPass(@NotNull FocusCommand cmd, final boolean forced, @NotNull ActionCallback result) {
     if (cmd.isExpired()) {
       rejectCommand(cmd, result);
       return true;
@@ -378,6 +352,18 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
     final FocusCommand lastRequest = getLastEffectiveForcedRequest();
 
+    if (!forced && !isUnforcedRequestAllowed()) {
+      if (cmd.equals(lastRequest)) {
+        resetCommand(cmd, false);
+        result.setDone();
+      }
+      else {
+        rejectCommand(cmd, result);
+      }
+      return true;
+    }
+
+
     if (lastRequest != null && lastRequest.dominatesOver(cmd)) {
       rejectCommand(cmd, result);
       return true;
@@ -654,12 +640,12 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
   private boolean processFocusRevalidation() {
     ExpirableRunnable revalidator = myFocusRevalidator;
     myFocusRevalidator = null;
-
+    
     if (revalidator != null && !revalidator.isExpired()) {
       revalidator.run();
       return true;
     }
-
+    
     return false;
   }
 
@@ -675,7 +661,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
         break;
       }
     }
-
+    
     maybeRemoveFocusActivity();
   }
 
@@ -809,14 +795,14 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
     myTypeAheadRequestors.add(done);
     done.notify(new TimedOutCallback(Registry.intValue("actionSystem.commandProcessingTimeout"),
-                                     "Typeahead request blocked",
-                                     new Exception() {
-                                       @Override
-                                       public String getMessage() {
-                                         return "Time: " + (System.currentTimeMillis() - currentTime);
-                                       }
-                                     },
-                                     true).doWhenProcessed(new Runnable() {
+                                            "Typeahead request blocked",
+                                            new Exception() {
+                                              @Override
+                                              public String getMessage() {
+                                                return "Time: " + (System.currentTimeMillis() - currentTime);
+                                              }
+                                            },
+                                            true).doWhenProcessed(new Runnable() {
       @Override
       public void run() {
         if (myTypeAheadRequestors.remove(done)) {
@@ -882,7 +868,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
   private static boolean isModalContextPopup(@NotNull JRootPane rootPane) {
     final JBPopup popup = (JBPopup)rootPane.getClientProperty(JBPopup.KEY);
     return popup != null && popup.isModalContext();
-  }
+  } 
 
   @NotNull
   @Override
@@ -920,7 +906,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
       }
     }
   }
-
+  
   @Override
   public void revalidateFocus(@NotNull final ExpirableRunnable runnable) {
     SwingUtilities.invokeLater(new Runnable() {
@@ -954,7 +940,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
       if (permOwner != null) {
         result = permOwner;
       }
-
+      
       if (UIUtil.isMeaninglessFocusOwner(result)) {
         result = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
       }
@@ -1026,39 +1012,6 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
     @NotNull
     @Override
-    public ActionCallback requestFocus(@NotNull Component c) {
-      final ActionCallback result = isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(c);
-      result.doWhenProcessed(new Runnable() {
-        @Override
-        public void run() {
-          Disposer.dispose(FurtherRequestor.this);
-        }
-      });
-      return result;
-    }
-
-    @NotNull
-    @Override
-    public ActionCallback requestFocus(@NotNull FocusCommand command) {
-      return isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(command);
-    }
-
-    @NotNull
-    @Override
-    public ActionCallback requestFocus(@NotNull Component c, @NotNull Throwable creationTrace) {
-      final ActionCallback result = isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(c, creationTrace);
-      result.doWhenProcessed(new Runnable() {
-        @Override
-        public void run() {
-          Disposer.dispose(FurtherRequestor.this);
-        }
-      });
-      return result;
-    }
-
-    @NotNull
-    @Override
-    @Deprecated
     public ActionCallback requestFocus(@NotNull Component c, boolean forced) {
       final ActionCallback result = isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(c, forced);
       result.doWhenProcessed(new Runnable() {
@@ -1076,7 +1029,6 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
     @NotNull
     @Override
-    @Deprecated
     public ActionCallback requestFocus(@NotNull FocusCommand command, boolean forced) {
       return isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(command, forced);
     }
@@ -1090,7 +1042,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
   class EdtAlarm {
     private final Set<EdtRunnable> myRequests = new HashSet<EdtRunnable>();
-
+    
     public void cancelAllRequests() {
       for (EdtRunnable each : myRequests) {
         each.expire();
@@ -1126,7 +1078,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
       myCallbackOnActivation = null;
 
       if (cmd != null) {
-        requestFocus(cmd).notify(callback);
+        requestFocus(cmd, true).notify(callback);
       } else {
         focusLastFocusedComponent(ideFrame);
       }
@@ -1134,12 +1086,12 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
 
     @Override
     public void delayedApplicationDeactivated(IdeFrame ideFrame) {
-      final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
-      Component parent = UIUtil.findUltimateParent(owner);
+        final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+        Component parent = UIUtil.findUltimateParent(owner);
 
-      if (parent == ideFrame) {
-        myLastFocusedAtDeactivation.put(ideFrame, owner);
-      }
+        if (parent == ideFrame) {
+          myLastFocusedAtDeactivation.put(ideFrame, owner);
+        }
     }
 
     private void focusLastFocusedComponent(IdeFrame ideFrame) {
@@ -1156,7 +1108,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
           if (policy != null) {
             policy.setNoDefaultComponent(true, FocusManagerImpl.this);
           }
-          requestFocus(c).doWhenProcessed(new Runnable() {
+          requestFocus(c, false).doWhenProcessed(new Runnable() {
             @Override
             public void run() {
               if (policy != null) {
@@ -1224,16 +1176,16 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
           } else if (each instanceof JWindow) {
             toFocus = getFocusTargetFor(((JWindow)each).getRootPane());
             break;
-          }
+          }          
         }
       }
-    }
-
+    } 
+    
     if (toFocus != null) {
-      return requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()).setToInvalidateRequestors(false));
+      return requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()).setToInvalidateRequestors(false), forced);
     }
-
-
+    
+    
     return ActionCallback.DONE;
   }
 
index 183895f790c32416bed0592b30ad8f21b702ca57..a1dccc18630ac58f2085701592e716bdac1eadfb 100644 (file)
@@ -28,9 +28,11 @@ public final class FocusRequestInfo {
   private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS");
   private final String when;
   private final Throwable trace;
+  private final boolean forced;
   private Component component;
 
-  public FocusRequestInfo(Component c, Throwable trace) {
+  public FocusRequestInfo(Component c, Throwable trace, boolean forced) {
+    this.forced = forced;
     this.trace = trace;
     when = DATE_FORMAT.format(new Date());
     component = c;
@@ -40,6 +42,10 @@ public final class FocusRequestInfo {
     return ExceptionUtil.getThrowableText(trace);
   }
 
+  public boolean isForced() {
+    return forced;
+  }
+
   public String getDate() {
     return when;
   }
index b0095929ffd53f57ab8f36cb104b1535aad0c9eb..7b545578bc101c646bb078d0fd4ba19472b872dd 100644 (file)
@@ -35,32 +35,12 @@ public class IdeFocusManagerHeadless extends IdeFocusManager {
 
   @Override
   @NotNull
-  public ActionCallback requestFocus(@NotNull final Component c) {
-    return ActionCallback.DONE;
-  }
-
-  @Override
-  @NotNull
-  public ActionCallback requestFocus(@NotNull final FocusCommand command) {
-    return ActionCallback.DONE;
-  }
-
-  @NotNull
-  @Override
-  public ActionCallback requestFocus(@NotNull Component c, @NotNull Throwable creationTrace) {
-    return ActionCallback.DONE;
-  }
-
-  @Override
-  @NotNull
-  @Deprecated
   public ActionCallback requestFocus(@NotNull final Component c, final boolean forced) {
     return ActionCallback.DONE;
   }
 
   @Override
   @NotNull
-  @Deprecated
   public ActionCallback requestFocus(@NotNull final FocusCommand command, final boolean forced) {
     return ActionCallback.DONE;
   }
index e6c03c2bb97114eb7726bc54f955790d20c17373..3199e93f58288fa691ce426d10d8adb63c40c683 100644 (file)
@@ -37,32 +37,12 @@ public class IdeFocusManagerImpl extends IdeFocusManager {
     myToolWindowManager = twManager;
   }
 
-  @Override
-  @NotNull
-  public ActionCallback requestFocus(@NotNull final Component c) {
-    return getGlobalInstance().requestFocus(c, new Throwable());
-  }
-
-  @Override
-  @NotNull
-  public ActionCallback requestFocus(@NotNull final FocusCommand command) {
-    return getGlobalInstance().requestFocus(command);
-  }
-
-  @NotNull
-  @Override
-  public ActionCallback requestFocus(@NotNull Component c, @NotNull Throwable creationTrace) {
-    return getGlobalInstance().requestFocus(c, creationTrace);
-  }
-
-  @Deprecated
   @Override
   @NotNull
   public ActionCallback requestFocus(@NotNull final Component c, final boolean forced) {
     return getGlobalInstance().requestFocus(c, forced);
   }
 
-  @Deprecated
   @Override
   @NotNull
   public ActionCallback requestFocus(@NotNull final FocusCommand command, final boolean forced) {
index b32628c257890abc567bb139699536e8af9721ac..bfab3e62e1c8a5767ea031a26be2368e3b02ea97 100644 (file)
@@ -665,7 +665,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
     }
     else {
       final FocusRequestor requestor = getFocusManager().getFurtherRequestor();
-      final Throwable creationTrace = new Throwable();
       getFocusManager().doWhenFocusSettlesDown(new ExpirableRunnable.ForProject(myProject) {
         @Override
         public void run() {
@@ -676,7 +675,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
               runnable.run();
               return ActionCallback.DONE;
             }
-          }.setExpirable(runnable));
+          }.setExpirable(runnable), forced);
         }
       });
     }
@@ -727,7 +726,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
               }
               return ActionCallback.DONE;
             }
-          });
+          }, false);
         }
       }
     });
@@ -2486,7 +2485,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
       public ActionCallback run() {
         return processDefaultFocusRequest(forced);
       }
-    });
+    }, forced);
   }
 
   private void focusToolWinowByDefault(@Nullable String idToIngore) {
@@ -2545,7 +2544,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
           if (DialogWrapper.findInstance(toFocus) != null) {
             return ActionCallback.DONE; //IDEA-80929
           }
-          return IdeFocusManager.findInstanceByComponent(toFocus).requestFocus(toFocus);
+          return IdeFocusManager.findInstanceByComponent(toFocus).requestFocus(toFocus, forced);
         }
       }
     }
@@ -2558,12 +2557,12 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
    */
   @NotNull
   public ActionCallback requestFocus(@NotNull Component c, boolean forced) {
-    return IdeFocusManager.getInstance(myProject).requestFocus(c);
+    return IdeFocusManager.getInstance(myProject).requestFocus(c, forced);
   }
 
   @NotNull
   public ActionCallback requestFocus(@NotNull FocusCommand command, boolean forced) {
-    return IdeFocusManager.getInstance(myProject).requestFocus(command);
+    return IdeFocusManager.getInstance(myProject).requestFocus(command, forced);
   }
 
   public void doWhenFocusSettlesDown(@NotNull Runnable runnable) {
index 70cf73a05b93382c93ced5043295c78fc7a0c75c..f9685ad1666c7cfcdefe01529dfcb932a78839b1 100644 (file)
@@ -26,7 +26,6 @@ import com.intellij.openapi.fileEditor.impl.EditorsSplitters;
 import com.intellij.openapi.util.ActionCallback;
 import com.intellij.openapi.util.Expirable;
 import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.Throwable2Computable;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.openapi.wm.impl.FloatingDecorator;
@@ -50,14 +49,14 @@ public final class RequestFocusInEditorComponentCmd extends FinalizableCommand{
 
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.wm.impl.commands.RequestFocusInEditorComponentCmd");
 
-  private final Throwable myCreationTrace;
-
   public RequestFocusInEditorComponentCmd(@NotNull final EditorsSplitters splitters, IdeFocusManager
                                           focusManager, final Runnable finishCallBack, boolean forced){
     super(finishCallBack);
 
-    myCreationTrace = new Throwable();
-
+    boolean shouldLogFocuses = Registry.is("ide.log.focuses");
+    if (shouldLogFocuses) {
+      LOG.info(new Exception());
+    }
     myComponent = null;
     final EditorWindow window = splitters.getCurrentWindow();
     if (window != null) {
@@ -105,7 +104,7 @@ public final class RequestFocusInEditorComponentCmd extends FinalizableCommand{
 
       if(myComponent != null){
         final boolean forced = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == null;
-        myFocusManager.requestFocus(myComponent, myCreationTrace).notifyWhenDone(myDoneCallback).doWhenDone(new Runnable() {
+        myFocusManager.requestFocus(myComponent, myForced || forced).notifyWhenDone(myDoneCallback).doWhenDone(new Runnable() {
           public void run() {
             if (SystemInfo.isLinux && Registry.is("suppress.focus.stealing")) return;
             // if owner is active window or it has active child window which isn't floating decorator then
index ff2c19cb3e0da2a8650e67098a6d4123baa7e9fa..62d6cc4978a8e4ae278366e8b35f3462741e38b3 100644 (file)
@@ -46,16 +46,12 @@ public final class RequestFocusInToolWindowCmd extends FinalizableCommand {
   private final boolean myForced;
   private final Expirable myTimestamp;
 
-  private final Throwable myAllocation;
-
   public RequestFocusInToolWindowCmd(IdeFocusManager focusManager, final ToolWindowImpl toolWindow, final FocusWatcher focusWatcher, final Runnable finishCallBack, boolean forced) {
     super(finishCallBack);
     myToolWindow = toolWindow;
     myFocusWatcher = focusWatcher;
     myForced = forced;
 
-    myAllocation = new Throwable();
-
     myTimestamp = focusManager.getTimestamp(true);
   }
 
@@ -180,7 +176,7 @@ public final class RequestFocusInToolWindowCmd extends FinalizableCommand {
               public ActionCallback run() {
                 return ActionCallback.DONE;
               }
-            }).doWhenProcessed(new Runnable() {
+            }, myForced).doWhenProcessed(new Runnable() {
               @Override
               public void run() {
                 updateToolWindow(c);
@@ -188,7 +184,7 @@ public final class RequestFocusInToolWindowCmd extends FinalizableCommand {
             }).notify(result);
           }
           else {
-            myManager.getFocusManager().requestFocus(new FocusCommand.ByComponent(c, myToolWindow.getComponent(), myAllocation))
+            myManager.getFocusManager().requestFocus(new FocusCommand.ByComponent(c, myToolWindow.getComponent(), new Exception()), myForced)
               .doWhenProcessed(new Runnable() {
                 @Override
                 public void run() {
index 9f5cd1fcbfe93937666b9b0360da4f40ac7820a7..ef596f892c2a6ac74cfe3346c9416538a384b0b0 100644 (file)
@@ -479,7 +479,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
         public void run() {
           IdeEventQueue.getInstance().disableInputMethods(BalloonImpl.this);
           originalFocusOwner.set(myFocusManager.getFocusOwner());
-          myFocusManager.requestFocus(glassPane.getProxyComponent()).notify(proxyFocusRequest.get());
+          myFocusManager.requestFocus(glassPane.getProxyComponent(), true).notify(proxyFocusRequest.get());
           focusRequestor.set(myFocusManager.getFurtherRequestor());
         }
       });
@@ -559,7 +559,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
       proxyFocusRequest.get().doWhenDone(new Runnable() {
         @Override
         public void run() {
-          myFocusManager.requestFocus(originalFocusOwner.get());
+          myFocusManager.requestFocus(originalFocusOwner.get(), true);
         }
       });
     }
index b8aa647c55f06c0fc3a6f2df549cb5fbbc1bd396..f1581b5dcde139ddcc5578077b8c71a246ba907e 100644 (file)
@@ -227,7 +227,7 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
   }
 
   private void handleGotoPrevious() {
-    IdeFocusManager.getInstance(myProject).requestFocus(myList);
+    IdeFocusManager.getInstance(myProject).requestFocus(myList, true);
   }
 
   private void handleGotoNext() {
@@ -237,7 +237,7 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
         updateRightComponent(true);
       }
     }
-    IdeFocusManager.getInstance(myProject).requestFocus(myList);
+    IdeFocusManager.getInstance(myProject).requestFocus(myList, true);
   }
 
   private void installListActions(JBList list) {
@@ -459,7 +459,7 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
       }
     }
 
-    IdeFocusManager.getInstance(myProject).requestFocus(panel.myList);
+    IdeFocusManager.getInstance(myProject).requestFocus(panel.myList, true);
 
     myUpdateSelectedPathModeActive.set(false);
   }
index d35d65fec3c4ea668bcc404e6e36b7b9ee8d2a25..b9bc4de59b62f9e803a8ffd934b4e34bb5f7aed7 100644 (file)
@@ -216,7 +216,7 @@ public class FocusTrackback {
       final IdeFocusManager focusManager = IdeFocusManager.getInstance(project);
       cleanParentWindow();
       final Project finalProject = project;
-      focusManager.requestFocus(new MyFocusCommand()).doWhenProcessed(new Runnable() {
+      focusManager.requestFocus(new MyFocusCommand(), myForcedRestore).doWhenProcessed(new Runnable() {
         public void run() {
           dispose();
         }
index 546346efba4f7a0df526d7a2457f43f0deff3cc7..a6903fd03646dd3c1905b7c90fffdb75a590599c 100644 (file)
@@ -530,7 +530,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
     boolean enabledFocus = getFocusManager().isFocusTransferEnabled();
     if (focused || requestFocus) {
       if (enabledFocus) {
-        return getFocusManager().requestFocus(myFocusProxy).doWhenProcessed(new Runnable() {
+        return getFocusManager().requestFocus(myFocusProxy, true).doWhenProcessed(new Runnable() {
           @Override
           public void run() {
             selection.run().notify(result);
@@ -646,7 +646,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
       public ActionCallback run() {
         return doRequestFocus(toSelect);
       }
-    });
+    }, forced);
   }
 
   private IdeFocusManager getFocusManager() {
index 0e6d36e297e9428c113288557671439b71319be4..ec6cc41fe9f360e282e6e7ced7b425c7ecf9c634 100644 (file)
@@ -989,7 +989,7 @@ public class AbstractPopup implements JBPopup {
 
                     return ActionCallback.DONE;
                   }
-                }).notify(result).doWhenProcessed(new Runnable() {
+                }, true).notify(result).doWhenProcessed(new Runnable() {
                   @Override
                   public void run() {
                     removeActivity();
@@ -1003,7 +1003,7 @@ public class AbstractPopup implements JBPopup {
 
           return result;
         }
-      }).doWhenRejected(new Runnable() {
+      }, true).doWhenRejected(new Runnable() {
         @Override
         public void run() {
           afterShow.run();
@@ -1025,7 +1025,7 @@ public class AbstractPopup implements JBPopup {
               @Override
               public void run() {
                 if (isFocused()) {
-                  IdeFocusManager.getInstance(myProject).requestFocus(prevOwner);
+                  IdeFocusManager.getInstance(myProject).requestFocus(prevOwner, false);
                 }
               }
             }, Registry.intValue("actionSystem.xWindow.remove.focus.from.nonFocusable.popups.delay"));
@@ -1204,7 +1204,7 @@ public class AbstractPopup implements JBPopup {
         _requestFocus();
         return ActionCallback.DONE;
       }
-    });
+    }, true);
 
     return true;
   }
index ebd88db88892062e993dd70a8841d9463174aecf..fdcb69d54a4da277923663cfbbc9f5bbd7fb8d54 100644 (file)
@@ -285,7 +285,7 @@ public abstract class ValidatingTableEditor<Item> implements ComponentWithEmptyT
     myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
     if (getTableModel().getColumnInfos()[1].isCellEditable(items.get(row))) {
       myTable.editCellAt(row, 1);
-      IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(myTable.getEditorComponent());
+      IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(myTable.getEditorComponent(), true);
     }
     updateMessage(-1, null);
   }
index b5e97c746b70b433f16dd96a2490b34b3f91890d..b491438ac5a86a7fd80cfc3aaff1a0a321e463a1 100644 (file)
@@ -164,7 +164,7 @@ public abstract class JBListTable {
         @Override
         public void focusGained(FocusEvent e) {
           IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(p);
-          focusManager.requestFocus(getComponentToFocus());
+          focusManager.requestFocus(getComponentToFocus(), true);
         }
 
         private Component getComponentToFocus() {
index 9d56ff99dc4dc805cf3a70f1a1f0d1c11ddecef0..fe2f478346cadbb16a0b8d903af96f2421a50587 100644 (file)
@@ -727,7 +727,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
             // Request focus if necessary
             if (requestFocus) {
               //myTreeView.requestFocusInWindow();
-              IdeFocusManager.getInstance(myProject).requestFocus(myTreeView);
+              IdeFocusManager.getInstance(myProject).requestFocus(myTreeView, true);
             }
           }
         });
index 348c5e191784f6e0d13953b588c6b8973b21bf13..564a26ce29e8584291bd84a09fcf07b84df6f10d 100644 (file)
@@ -193,7 +193,7 @@ public class StatisticsPanel implements DataProvider {
       public void run() {
         // Select tab if focus was requested
         if (requestFocus) {
-          IdeFocusManager.getInstance(myProject).requestFocus(myStatisticsTableView);
+          IdeFocusManager.getInstance(myProject).requestFocus(myStatisticsTableView, true);
         }
 
         // Select proxy in table
index 3b87777b78833d82f8651a93684717c6d90b601e..c49df8b5e8ac5677c8e05816808303eb5051c643 100644 (file)
@@ -109,7 +109,7 @@ public class ExportTestResultsForm {
       b = myCustomTemplateRb;
     }
     b.setSelected(true);
-    IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(b);
+    IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(b, true);
     myFolderField.setText(defaultFolder);
     myCustomTemplateField.setText(FileUtil.toSystemDependentName(StringUtil.notNullize(config.getUserTemplatePath())));
     myOpenExportedFileCb.setSelected(config.isOpenResults());
@@ -129,7 +129,7 @@ public class ExportTestResultsForm {
   private void updateOnFormatChange() {
     if (getExportFormat() == ExportTestResultsConfiguration.ExportFormat.UserTemplate) {
       myCustomTemplateField.setEnabled(true);
-      IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(myCustomTemplateField.getChildComponent());
+      IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(myCustomTemplateField.getChildComponent(), true);
     }
     else {
       myCustomTemplateField.setEnabled(false);
index 04ca93f2470e27d46f7d11df60f1275547fdcede..363d5f1e319f67e42d03a773b1b7366bcdd7ec51 100644 (file)
@@ -106,7 +106,7 @@ public class ChangeListChooserPanel extends JPanel {
       @Override
       public void focusGained(FocusEvent e) {
         if (myRbNew.isSelected()) {
-          IdeFocusManager.getInstance(myProject).requestFocus(myNewListPanel.getPreferredFocusedComponent());
+          IdeFocusManager.getInstance(myProject).requestFocus(myNewListPanel.getPreferredFocusedComponent(), true);
         }
       }
     });
index 18d57477983a5ab0fb0bba50662c6d6167d25193..16236e5f15a42710ec75130679b181c07b02f308 100644 (file)
@@ -315,7 +315,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
           ApplicationManager.getApplication().invokeLater(new Runnable() {
             @Override
             public void run() {
-              IdeFocusManager.findInstance().requestFocus(myBrowser.getViewer().getPreferredFocusedComponent());
+              IdeFocusManager.findInstance().requestFocus(myBrowser.getViewer().getPreferredFocusedComponent(), true);
             }
           });
         }
index 64e72e4d3d0305644d61fbdd7293dda75cf196ff..bb8847f8673e20f4f1dc5ee5220494e9cecb633f 100644 (file)
@@ -112,7 +112,7 @@ public class VcsLogManager implements Disposable {
     // todo fix selection
     final VcsLogGraphTable graphTable = myUi.getTable();
     if (graphTable.getRowCount() > 0) {
-      IdeFocusManager.getInstance(myProject).requestFocus(graphTable).doWhenProcessed(new Runnable() {
+      IdeFocusManager.getInstance(myProject).requestFocus(graphTable, true).doWhenProcessed(new Runnable() {
         @Override
         public void run() {
           graphTable.setRowSelectionInterval(0, 0);
index 20f6efa7752cfd364359f6ba22702430ec1a262d..882a2c1bc36e9747a0ce1bd05a9b1c481f55bfb2 100644 (file)
@@ -209,7 +209,7 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
           compToFocus = myActionsPanel.getDefaultFocusComponent();
         }
         if (compToFocus != null) {
-          IdeFocusManager.findInstance().requestFocus(compToFocus);
+          IdeFocusManager.findInstance().requestFocus(compToFocus, false);
         }
       }
     });
index e76ce65d57ba1c38fbd369cd681180a2c9ddcc2a..49947040683e19ba26a1c68f4bd30eb7cae5a5f5 100644 (file)
@@ -123,7 +123,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
     new AnAction() {
       @Override
       public void actionPerformed(AnActionEvent e) {
-        IdeFocusManager.getInstance(mySession.getProject()).requestFocus(myTreePanel.getTree());
+        IdeFocusManager.getInstance(mySession.getProject()).requestFocus(myTreePanel.getTree(), true);
       }
     }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK)), getRootPane(),
                                 myDisposable);
index cce5cae99ef5e8554a604128ee4a1f0b334500eb..79197d3f7943b7700196523eec691f2aa850d348 100644 (file)
@@ -250,7 +250,7 @@ public class DebuggerUIUtil {
     ApplicationManager.getApplication().invokeLater(new Runnable() {
       @Override
       public void run() {
-        IdeFocusManager.findInstance().requestFocus(mainPanel);
+        IdeFocusManager.findInstance().requestFocus(mainPanel, true);
       }
     });
   }
index 7d6dddaaf13ff2792bae994ebd2628340233061e..7ebd4066a39bc44837e2d111201879f95bbc4a54 100644 (file)
@@ -190,7 +190,7 @@ public abstract class XDebuggerEditorBase {
   public void requestFocusInEditor() {
     JComponent preferredFocusedComponent = getPreferredFocusedComponent();
     if (preferredFocusedComponent != null) {
-      IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusedComponent);
+      IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusedComponent, true);
     }
   }
 
index 65b52cf4b7bf1eb9ad75350ccd501ff708b0f0f0..7d5229c9e64c15d2d840d97b18197acc02558ac3 100644 (file)
@@ -156,13 +156,13 @@ public class DomGenPanel {
   public boolean validate() {
     if (!new File(mySchemaLocation.getText()).exists()) {
       Messages.showErrorDialog(myProject, "Schema location doesn't exist", "Error");
-      IdeFocusManager.getInstance(myProject).requestFocus(mySchemaLocation);
+      IdeFocusManager.getInstance(myProject).requestFocus(mySchemaLocation, true);
       return false;
     }
 
     if (!new File(myOutputDir.getText()).exists()) {
       Messages.showErrorDialog(myProject, "Output dir doesn't exist", "Error");
-      IdeFocusManager.getInstance(myProject).requestFocus(myOutputDir);
+      IdeFocusManager.getInstance(myProject).requestFocus(myOutputDir, true);
       return false;
     }
 
index acd480762f8d43806e8c5515664488adcc50fb6c..fa0a7882b780e12476b44effbfd9905a03e41069 100644 (file)
@@ -215,7 +215,7 @@ public class GitPushTargetPanel extends PushTargetPanel<GitPushTarget> {
         if (myTargetEditor.isShowing()) {
           //repaint and force move focus to target editor component
           GitPushTargetPanel.this.repaint();
-          IdeFocusManager.getInstance(myProject).requestFocus(myTargetEditor);
+          IdeFocusManager.getInstance(myProject).requestFocus(myTargetEditor, true);
         }
       }
     };
index fd0f5d0e34b9ebfe993bc14b717392960dfb3852..19948a3ee6a40a2c20b948f07ede69f42324a159 100644 (file)
@@ -146,7 +146,7 @@ public class GradleModuleWizardStep extends ModuleWizardStep {
       ApplicationManager.getApplication().invokeLater(new Runnable() {
         @Override
         public void run() {
-          IdeFocusManager.getInstance(myProjectOrNull).requestFocus(myArtifactIdField);
+          IdeFocusManager.getInstance(myProjectOrNull).requestFocus(myArtifactIdField, true);
         }
       });
       throw new ConfigurationException("Please, specify artifactId");
index 81ab9e76362c6db57db72d5cc3cbb10e060a24e0..182eb1bed731428ce1172cacbe27ae4ea800c1ec 100644 (file)
@@ -487,7 +487,7 @@ public class DynamicToolWindowWrapper {
     int row = tree.getRowForPath(path);
     myTreeTable.getSelectionModel().setSelectionInterval(row, row);
     myTreeTable.scrollRectToVisible(myTreeTable.getCellRect(row, 0, true));
-    IdeFocusManager.getInstance(myProject).requestFocus(myTreeTable);
+    IdeFocusManager.getInstance(myProject).requestFocus(myTreeTable, true);
   }
 
   public void removeFromParent(DefaultMutableTreeNode parent, DefaultMutableTreeNode child) {
index f5686a62dc8b49625beb8975277236c0e2e9a73e..530c908a608b7804e92ac47bd340721dbece0c28 100644 (file)
@@ -148,7 +148,7 @@ public class GrDynamicImplicitProperty extends GrImplicitVariableImpl implements
         treeTable.getTree().setSelectionPath(path);
         treeTable.getTree().fireTreeExpanded(path);
 
-        ToolWindowManager.getInstance(myProject).getFocusManager().requestFocus(treeTable);
+        ToolWindowManager.getInstance(myProject).getFocusManager().requestFocus(treeTable, true);
         treeTable.revalidate();
         treeTable.repaint();
 
index 63350dfa2d55aa1eaa5c097656be5f697c5d408e..1c057eda6f3b0739c23b3c9404a5e3fa817c5865 100644 (file)
@@ -108,7 +108,7 @@ public class CopiesPanel {
     final Runnable focus = new Runnable() {
       @Override
       public void run() {
-        IdeFocusManager.getInstance(myProject).requestFocus(myRefreshLabel);
+        IdeFocusManager.getInstance(myProject).requestFocus(myRefreshLabel, true);
       }
     };
     final Runnable refreshView = new Runnable() {
index d8646b0b3955b4e0eb5e85b897907cb99c5e0a5e..60a5d798abebec62acf90a2cd93d1fd1d02f93d7 100644 (file)
@@ -137,7 +137,7 @@ public class IntersectingLocalChangesPanel {
     ContentsUtil.addContent(contentManager, content, true);
     toolWindow.activate(new Runnable() {
       public void run() {
-        IdeFocusManager.getInstance(project).requestFocus(component.getPrefferedFocusComponent());
+        IdeFocusManager.getInstance(project).requestFocus(component.getPrefferedFocusComponent(), true);
       }
     });
 
index df65c1f8bc859ef56533fc77342ac8c2191f9d74..8bf81bccfc56ec8760b9bc20c740263a434f6c61 100644 (file)
@@ -166,7 +166,7 @@ public abstract class AbstractTerminalRunner<T extends Process> {
     final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(defaultExecutor.getId());
     window.activate(new Runnable() {
       public void run() {
-        IdeFocusManager.getInstance(myProject).requestFocus(toFocus);
+        IdeFocusManager.getInstance(myProject).requestFocus(toFocus, true);
       }
     });
   }
index 5ca2b501769a9fe8c1f11700c9b5e3649d00c678..a44a34398d3c80c7313f7808dcf5d820af147f2f 100644 (file)
@@ -133,7 +133,7 @@ public final class PropertyTablePanel extends JPanel implements ListSelectionLis
 
     addMouseListener(new MouseAdapter() {
       public void mouseReleased(final MouseEvent e) {
-        IdeFocusManager.getInstance(project).requestFocus(myPropertyTable);
+        IdeFocusManager.getInstance(project).requestFocus(myPropertyTable, true);
       }
     });
   }
index 31638cdc72bbeb81676802e2f540838de9119fc3..3a7486a4d859fa963d434d3aa3a5a486624df465 100644 (file)
@@ -134,7 +134,7 @@ public class StudyCheckAction extends DumbAwareAction {
           }
           runAction.run(project);
           ApplicationManager.getApplication().invokeLater(
-            () -> IdeFocusManager.getInstance(project).requestFocus(studyState.getEditor().getComponent()));
+            () -> IdeFocusManager.getInstance(project).requestFocus(studyState.getEditor().getComponent(), true));
 
           final StudyTestRunner testRunner = StudyUtils.getTestRunner(task, taskDir);
           Process testProcess = null;
@@ -288,7 +288,7 @@ public class StudyCheckAction extends DumbAwareAction {
     }
     final Editor editorToNavigate = editor;
     ApplicationManager.getApplication().invokeLater(
-      () -> IdeFocusManager.getInstance(project).requestFocus(editorToNavigate.getContentComponent()));
+      () -> IdeFocusManager.getInstance(project).requestFocus(editorToNavigate.getContentComponent(), true));
 
     StudyNavigator.navigateToFirstFailedAnswerPlaceholder(editor, taskFileToNavigate);
   }
index 3fa294c2432451413069f81ba14dad063b546f66..0cb33f2d04e9ec75d6c7c6a0a11cea8ab0a4caf3 100644 (file)
@@ -77,7 +77,7 @@ public class StudyRefreshTaskFileAction extends DumbAwareAction {
     ApplicationManager.getApplication().invokeLater(new Runnable() {
       @Override
       public void run() {
-        IdeFocusManager.getInstance(project).requestFocus(editor.getContentComponent());
+        IdeFocusManager.getInstance(project).requestFocus(editor.getContentComponent(), true);
       }
     });
 
index 8fd06eaef2e0908c334181c327dce8e4c1758a3b..de671e33464bb352cfa66798730e26fb3690e5f2 100644 (file)
@@ -60,7 +60,7 @@ public class PyOpenDebugConsoleAction extends AnAction implements DumbAware {
         @Override
         public void consume(PythonDebugLanguageConsoleView view) {
           view.enableConsole(false);
-          IdeFocusManager.getInstance(project).requestFocus(view.getPydevConsoleView().getComponent());
+          IdeFocusManager.getInstance(project).requestFocus(view.getPydevConsoleView().getComponent(), true);
         }
       });
     }
index 5d064ddba0418197d19ab20d49a31a33a0911256..a8a18a59ec76259b1626a9f79c602b9b9d5f9238 100644 (file)
@@ -97,7 +97,7 @@ public class PythonConsoleView extends LanguageConsoleImpl implements Observable
 
   @Override
   public void requestFocus() {
-    IdeFocusManager.findInstance().requestFocus(getConsoleEditor().getContentComponent());
+    IdeFocusManager.findInstance().requestFocus(getConsoleEditor().getContentComponent(), true);
   }
 
   @Override
index 6657dc0c835945d62378d244bf30313460b3646e..7561151b59f13c92a65bd9327ce12378239d6402 100644 (file)
@@ -71,7 +71,7 @@ public class PythonDebugLanguageConsoleView extends DuplexConsoleView<ConsoleVie
     if (!primary && !isPrimaryConsoleEnabled()) {
       PythonConsoleView console = getPydevConsoleView();
 
-      IdeFocusManager.findInstance().requestFocus(console.getConsoleEditor().getContentComponent());
+      IdeFocusManager.findInstance().requestFocus(console.getConsoleEditor().getContentComponent(), true);
     }
   }
 }
index 5fd90ec34eda3dd63e8dc229fb2a60c0d6a52cf4..7e51343a6ca63ab46b0eaed6085f7639e085ea41 100644 (file)
@@ -134,7 +134,7 @@ public class EmmetAbbreviationBalloon {
     focusManager.doWhenFocusSettlesDown(new Runnable() {
       @Override
       public void run() {
-        focusManager.requestFocus(field);
+        focusManager.requestFocus(field, true);
         field.selectText();
       }
     });