mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
request focus from edt only
This commit is contained in:
@@ -48,6 +48,7 @@ import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -159,6 +160,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
final JPanel descriptions;
|
||||
final Project project;
|
||||
final Map<String, ToolWindow> twShortcuts;
|
||||
final Alarm myAlarm;
|
||||
|
||||
@SuppressWarnings({"ManualArrayToCollectionCopy"})
|
||||
SwitcherPanel(Project project) {
|
||||
@@ -378,7 +380,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
if (comp == null) {
|
||||
comp = ideFrame.getContentPane();
|
||||
}
|
||||
|
||||
myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, myPopup);
|
||||
myPopup.showInCenterOf(comp);
|
||||
}
|
||||
|
||||
@@ -466,17 +468,12 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
}
|
||||
final int selectedIndex = jList.getSelectedIndex();
|
||||
final IdeFocusManager focusManager = IdeFocusManager.getInstance(project);
|
||||
new Thread() { //TODO[kb]: think how to do it better. Need to remove all hacks & work correctly with activateEditorComponentImpl method
|
||||
myAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
sleep(300);
|
||||
}
|
||||
catch (InterruptedException e) {//
|
||||
}
|
||||
focusManager.requestFocus(SwitcherPanel.this, true);
|
||||
}
|
||||
}.start();
|
||||
}, 300);
|
||||
if (jList.getModel().getSize() == 1) {
|
||||
goLeft();
|
||||
((DefaultListModel)jList.getModel()).removeElementAt(selectedIndex);
|
||||
|
||||
Reference in New Issue
Block a user