mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-81401 Search field in settings dialog loses first few keystrokes
This commit is contained in:
+6
-1
@@ -33,6 +33,7 @@ import com.intellij.openapi.ui.*;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.EdtRunnable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeGlassPaneUtil;
|
||||
import com.intellij.ui.LightColors;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
@@ -288,7 +289,11 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
|
||||
}
|
||||
|
||||
public ActionCallback select(Configurable configurable) {
|
||||
return select(configurable, "");
|
||||
if (StringUtil.isEmpty(mySearch.getText())) {
|
||||
return select(configurable, "");
|
||||
} else {
|
||||
return myFilter.refilterFor(mySearch.getText(), true, true);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionCallback select(Configurable configurable, final String text) {
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.ui.impl;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.FocusTrackback;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
interface AbstractDialog extends Disposable {
|
||||
void setUndecorated(boolean undecorated);
|
||||
|
||||
void addMouseListener(MouseListener listener);
|
||||
|
||||
void addMouseMotionListener(MouseMotionListener listener);
|
||||
|
||||
void addKeyListener(KeyListener listener);
|
||||
|
||||
void setModal(boolean b);
|
||||
|
||||
void toFront();
|
||||
|
||||
void setContentPane(Container content);
|
||||
|
||||
void centerInParent();
|
||||
|
||||
void toBack();
|
||||
|
||||
JRootPane getRootPane();
|
||||
|
||||
void remove(Component root);
|
||||
|
||||
Container getContentPane();
|
||||
|
||||
void validate();
|
||||
|
||||
void repaint();
|
||||
|
||||
Window getOwner();
|
||||
|
||||
JDialog getWindow();
|
||||
|
||||
Dimension getSize();
|
||||
|
||||
String getTitle();
|
||||
|
||||
void pack();
|
||||
|
||||
Dimension getPreferredSize();
|
||||
|
||||
boolean isVisible();
|
||||
|
||||
boolean isShowing();
|
||||
|
||||
void setSize(int width, int height);
|
||||
|
||||
void setTitle(String title);
|
||||
|
||||
boolean isResizable();
|
||||
|
||||
void setResizable(boolean resizable);
|
||||
|
||||
Point getLocation();
|
||||
|
||||
void setLocation(Point p);
|
||||
|
||||
void setLocation(int x, int y);
|
||||
|
||||
boolean isModal();
|
||||
|
||||
void show();
|
||||
|
||||
IdeFocusManager getFocusManager();
|
||||
|
||||
FocusTrackback getFocusTrackback();
|
||||
}
|
||||
+12
-193
@@ -82,6 +82,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
|
||||
private final ActionCallback myWindowFocusedCallback = new ActionCallback("DialogFocusedCallback");
|
||||
private final ActionCallback myTypeAheadDone = new ActionCallback("DialogTypeAheadDone");
|
||||
private final ActionCallback myTypeAheadCallback = new ActionCallback();
|
||||
|
||||
/**
|
||||
* Creates modal <code>DialogWrapper</code>. The currently active window will be the dialog's parent.
|
||||
@@ -211,10 +212,10 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
}
|
||||
|
||||
if (owner instanceof Frame) {
|
||||
myDialog = new MyDialog((Frame)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);
|
||||
myDialog = new MyDialog((Frame)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone, myTypeAheadCallback);
|
||||
}
|
||||
else {
|
||||
myDialog = new MyDialog((Dialog)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);
|
||||
myDialog = new MyDialog((Dialog)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone, myTypeAheadCallback);
|
||||
}
|
||||
myDialog.setModal(true);
|
||||
myCanBeParent = canBeParent;
|
||||
@@ -377,6 +378,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
}
|
||||
|
||||
public ActionCallback show() {
|
||||
IdeFocusManager.getInstance(myProject).typeAheadUntil(myTypeAheadCallback);
|
||||
final ActionCallback result = new ActionCallback();
|
||||
|
||||
LOG.assertTrue(EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only");
|
||||
@@ -504,27 +506,29 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
private final WeakReference<Project> myProject;
|
||||
private ActionCallback myFocusedCallback;
|
||||
private ActionCallback myTypeAheadDone;
|
||||
private ActionCallback myTypeAheadCallback;
|
||||
private MyComponentListener myComponentListener;
|
||||
|
||||
public MyDialog(Dialog owner, DialogWrapper dialogWrapper, Project project, ActionCallback focused, ActionCallback typeAheadDone) {
|
||||
public MyDialog(Dialog owner, DialogWrapper dialogWrapper, Project project, ActionCallback focused, ActionCallback typeAheadDone, ActionCallback typeAheadCallback) {
|
||||
super(owner);
|
||||
myDialogWrapper = new WeakReference<DialogWrapper>(dialogWrapper);
|
||||
myProject = project != null ? new WeakReference<Project>(project) : null;
|
||||
initDialog(focused, typeAheadDone);
|
||||
initDialog(focused, typeAheadDone, typeAheadCallback);
|
||||
}
|
||||
|
||||
public MyDialog(Frame owner, DialogWrapper dialogWrapper, Project project, ActionCallback focused, ActionCallback typeAheadDone) {
|
||||
public MyDialog(Frame owner, DialogWrapper dialogWrapper, Project project, ActionCallback focused, ActionCallback typeAheadDone, ActionCallback typeAheadCallback) {
|
||||
super(owner);
|
||||
myDialogWrapper = new WeakReference<DialogWrapper>(dialogWrapper);
|
||||
myProject = project != null ? new WeakReference<Project>(project) : null;
|
||||
initDialog(focused, typeAheadDone);
|
||||
initDialog(focused, typeAheadDone, typeAheadCallback);
|
||||
}
|
||||
|
||||
private void initDialog(ActionCallback focused, ActionCallback typeAheadDone) {
|
||||
private void initDialog(ActionCallback focused, ActionCallback typeAheadDone, ActionCallback typeAheadCallback) {
|
||||
setFocusTraversalPolicy(new LayoutFocusTraversalPolicyExt());
|
||||
|
||||
myFocusedCallback = focused;
|
||||
myTypeAheadDone = typeAheadDone;
|
||||
myTypeAheadCallback = typeAheadCallback;
|
||||
|
||||
final long typeAhead = getDialogWrapper().getTypeAheadTimeoutMs();
|
||||
if (typeAhead <= 0) {
|
||||
@@ -949,6 +953,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
notifyFocused(wrapper);
|
||||
}
|
||||
}
|
||||
myTypeAheadCallback.setDone();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1108,190 +1113,4 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
public void centerInParent() {
|
||||
myDialog.centerInParent();
|
||||
}
|
||||
|
||||
interface AbstractDialog extends Disposable {
|
||||
void setUndecorated(boolean undecorated);
|
||||
|
||||
void addMouseListener(MouseListener listener);
|
||||
|
||||
void addMouseMotionListener(MouseMotionListener listener);
|
||||
|
||||
void addKeyListener(KeyListener listener);
|
||||
|
||||
void setModal(boolean b);
|
||||
|
||||
void toFront();
|
||||
|
||||
void setContentPane(Container content);
|
||||
|
||||
void centerInParent();
|
||||
|
||||
void toBack();
|
||||
|
||||
JRootPane getRootPane();
|
||||
|
||||
void remove(Component root);
|
||||
|
||||
Container getContentPane();
|
||||
|
||||
void validate();
|
||||
|
||||
void repaint();
|
||||
|
||||
Window getOwner();
|
||||
|
||||
JDialog getWindow();
|
||||
|
||||
Dimension getSize();
|
||||
|
||||
String getTitle();
|
||||
|
||||
void pack();
|
||||
|
||||
Dimension getPreferredSize();
|
||||
|
||||
boolean isVisible();
|
||||
|
||||
boolean isShowing();
|
||||
|
||||
void setSize(int width, int height);
|
||||
|
||||
void setTitle(String title);
|
||||
|
||||
boolean isResizable();
|
||||
|
||||
void setResizable(boolean resizable);
|
||||
|
||||
Point getLocation();
|
||||
|
||||
void setLocation(Point p);
|
||||
|
||||
void setLocation(int x, int y);
|
||||
|
||||
boolean isModal();
|
||||
|
||||
void show();
|
||||
|
||||
IdeFocusManager getFocusManager();
|
||||
|
||||
FocusTrackback getFocusTrackback();
|
||||
}
|
||||
|
||||
class HeadlessDialog implements AbstractDialog {
|
||||
public void setUndecorated(boolean undecorated) {
|
||||
}
|
||||
|
||||
public void addMouseListener(MouseListener listener) {
|
||||
}
|
||||
|
||||
public void addMouseMotionListener(MouseMotionListener listener) {
|
||||
}
|
||||
|
||||
public void addKeyListener(KeyListener listener) {
|
||||
}
|
||||
|
||||
public void setModal(boolean b) {
|
||||
}
|
||||
|
||||
public void toFront() {
|
||||
}
|
||||
|
||||
public void setContentPane(Container content) {
|
||||
}
|
||||
|
||||
public void centerInParent() {
|
||||
}
|
||||
|
||||
public void toBack() {
|
||||
}
|
||||
|
||||
public JRootPane getRootPane() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove(Component root) {
|
||||
}
|
||||
|
||||
public Container getContentPane() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
}
|
||||
|
||||
public void repaint() {
|
||||
}
|
||||
|
||||
public Window getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public JDialog getWindow() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void pack() {
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSize(int width, int height) {
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
}
|
||||
|
||||
public boolean isResizable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setResizable(boolean resizable) {
|
||||
}
|
||||
|
||||
public Point getLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setLocation(Point p) {
|
||||
}
|
||||
|
||||
public void setLocation(int x, int y) {
|
||||
}
|
||||
|
||||
public boolean isModal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
}
|
||||
|
||||
public IdeFocusManager getFocusManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public FocusTrackback getFocusTrackback() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.ui.impl;
|
||||
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.FocusTrackback;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
class HeadlessDialog implements AbstractDialog {
|
||||
public void setUndecorated(boolean undecorated) {
|
||||
}
|
||||
|
||||
public void addMouseListener(MouseListener listener) {
|
||||
}
|
||||
|
||||
public void addMouseMotionListener(MouseMotionListener listener) {
|
||||
}
|
||||
|
||||
public void addKeyListener(KeyListener listener) {
|
||||
}
|
||||
|
||||
public void setModal(boolean b) {
|
||||
}
|
||||
|
||||
public void toFront() {
|
||||
}
|
||||
|
||||
public void setContentPane(Container content) {
|
||||
}
|
||||
|
||||
public void centerInParent() {
|
||||
}
|
||||
|
||||
public void toBack() {
|
||||
}
|
||||
|
||||
public JRootPane getRootPane() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove(Component root) {
|
||||
}
|
||||
|
||||
public Container getContentPane() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
}
|
||||
|
||||
public void repaint() {
|
||||
}
|
||||
|
||||
public Window getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public JDialog getWindow() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void pack() {
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSize(int width, int height) {
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
}
|
||||
|
||||
public boolean isResizable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setResizable(boolean resizable) {
|
||||
}
|
||||
|
||||
public Point getLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setLocation(Point p) {
|
||||
}
|
||||
|
||||
public void setLocation(int x, int y) {
|
||||
}
|
||||
|
||||
public boolean isModal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
}
|
||||
|
||||
public IdeFocusManager getFocusManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public FocusTrackback getFocusTrackback() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user