Search in sources :

Example 11 with IdeFocusManager

use of com.intellij.openapi.wm.IdeFocusManager in project intellij-community by JetBrains.

the class EditableSchemesCombo method cancelEdit.

public void cancelEdit() {
    mySchemesPanel.clearInfo();
    myLayout.first(myRootPanel);
    final IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance();
    focusManager.doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myRootPanel, true));
}
Also used : IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager)

Example 12 with IdeFocusManager

use of com.intellij.openapi.wm.IdeFocusManager in project intellij-community by JetBrains.

the class EditableSchemesCombo method startEdit.

public void startEdit() {
    T scheme = getSelectedScheme();
    if (scheme != null) {
        showHint();
        myNameEditorField.setText(scheme.getName());
        myLayout.last(myRootPanel);
        final IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance();
        focusManager.doWhenFocusSettlesDown(() -> focusManager.requestFocus(myNameEditorField, true));
    }
}
Also used : IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager)

Example 13 with IdeFocusManager

use of com.intellij.openapi.wm.IdeFocusManager in project intellij-community by JetBrains.

the class WrapReturnValueDialog method toggleRadioEnablement.

private void toggleRadioEnablement() {
    UIUtil.setEnabled(myExistingClassPanel, useExistingClassButton.isSelected(), true);
    UIUtil.setEnabled(myNewClassPanel, createNewClassButton.isSelected(), true);
    UIUtil.setEnabled(myCreateInnerPanel, myCreateInnerClassButton.isSelected(), true);
    final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
    if (useExistingClassButton.isSelected()) {
        focusManager.requestFocus(existingClassField, true);
    } else if (myCreateInnerClassButton.isSelected()) {
        focusManager.requestFocus(myInnerClassNameTextField, true);
    } else {
        focusManager.requestFocus(classNameField, true);
    }
    validateButtons();
}
Also used : IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager)

Example 14 with IdeFocusManager

use of com.intellij.openapi.wm.IdeFocusManager in project android by JetBrains.

the class ThemeSelectionPanel method focus.

public void focus() {
    final Project project = myConfiguration.getModule().getProject();
    final IdeFocusManager focusManager = project.isDefault() ? IdeFocusManager.getGlobalInstance() : IdeFocusManager.getInstance(project);
    focusManager.doWhenFocusSettlesDown(new Runnable() {

        @Override
        public void run() {
            focusManager.requestFocus(myThemeList, true);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager)

Example 15 with IdeFocusManager

use of com.intellij.openapi.wm.IdeFocusManager in project intellij-community by JetBrains.

the class IdeEventQueue method storeLastFocusedComponent.

private static void storeLastFocusedComponent(@NotNull WindowEvent we) {
    final Window eventWindow = we.getWindow();
    if (we.getID() == WindowEvent.WINDOW_DEACTIVATED || we.getID() == WindowEvent.WINDOW_LOST_FOCUS) {
        Component frame = UIUtil.findUltimateParent(eventWindow);
        Component focusOwnerInDeactivatedWindow = eventWindow.getMostRecentFocusOwner();
        IdeFrame[] allProjectFrames = WindowManager.getInstance().getAllProjectFrames();
        if (focusOwnerInDeactivatedWindow != null) {
            for (IdeFrame ideFrame : allProjectFrames) {
                JFrame aFrame = WindowManager.getInstance().getFrame(ideFrame.getProject());
                if (aFrame.equals(frame)) {
                    IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance();
                    if (focusManager instanceof FocusManagerImpl) {
                        ((FocusManagerImpl) focusManager).setLastFocusedAtDeactivation(ideFrame, focusOwnerInDeactivatedWindow);
                    }
                }
            }
        }
    }
}
Also used : FocusManagerImpl(com.intellij.openapi.wm.impl.FocusManagerImpl) IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager) IdeFrame(com.intellij.openapi.wm.IdeFrame)

Aggregations

IdeFocusManager (com.intellij.openapi.wm.IdeFocusManager)27 Project (com.intellij.openapi.project.Project)6 IdeFrame (com.intellij.openapi.wm.IdeFrame)5 NotNull (org.jetbrains.annotations.NotNull)4 FocusManagerImpl (com.intellij.openapi.wm.impl.FocusManagerImpl)3 DataManager (com.intellij.ide.DataManager)2 Disposable (com.intellij.openapi.Disposable)2 PersistentStateComponent (com.intellij.openapi.components.PersistentStateComponent)2 AsyncResult (com.intellij.openapi.util.AsyncResult)2 Nullable (org.jetbrains.annotations.Nullable)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Patches (com.intellij.Patches)1 DaemonCodeAnalyzer (com.intellij.codeInsight.daemon.DaemonCodeAnalyzer)1 PsiElement2UsageTargetAdapter (com.intellij.find.findUsages.PsiElement2UsageTargetAdapter)1 AllIcons (com.intellij.icons.AllIcons)1 IdeBundle (com.intellij.ide.IdeBundle)1 CopyReferenceAction (com.intellij.ide.actions.CopyReferenceAction)1 GotoFileAction (com.intellij.ide.actions.GotoFileAction)1 DarculaTextBorder (com.intellij.ide.ui.laf.darcula.ui.DarculaTextBorder)1 DarculaTextFieldUI (com.intellij.ide.ui.laf.darcula.ui.DarculaTextFieldUI)1