diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java
index 35befb6b916f..f4689e8134e4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java
@@ -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) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java
new file mode 100644
index 000000000000..c2eed8e02958
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java
@@ -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();
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
index cb7c1f760e2c..10b9cf1baeff 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
@@ -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 DialogWrapper. 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 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);
myProject = project != null ? new WeakReference(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);
myProject = project != null ? new WeakReference(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() {
- }
- }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java
new file mode 100644
index 000000000000..6f690739b700
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java
@@ -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() {
+ }
+}