mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-58308 SQL console: IAE at com.intellij.ui.SwingActionWrapper.<init>()
This commit is contained in:
@@ -41,7 +41,7 @@ public abstract class SwingActionWrapper<T extends JComponent> implements Action
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Object getKeyForActionMap(JComponent component, KeyStroke keyStroke) {
|
||||
public static Object getKeyForActionMap(JComponent component, KeyStroke keyStroke) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
final InputMap inputMap = component.getInputMap(i);
|
||||
if (inputMap == null) continue;
|
||||
|
||||
@@ -196,21 +196,20 @@ public class TableUtil {
|
||||
}
|
||||
|
||||
public static void configureAllowedCellSelection(final JTable table, final Condition<Point> cellCondition) {
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("ENTER"));
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("TAB"));
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("shift TAB"));
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("RIGHT"));
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("LEFT"));
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("UP"));
|
||||
new MyFocusAction(table, cellCondition, KeyStroke.getKeyStroke("DOWN"));
|
||||
for (String keyStroke : new String[]{"ENTER","TAB","shift TAB","RIGHT","LEFT","UP","DOWN"}) {
|
||||
final Object key = SwingActionWrapper.getKeyForActionMap(table, KeyStroke.getKeyStroke(keyStroke));
|
||||
if (key != null) {
|
||||
new MyFocusAction(table, cellCondition, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyFocusAction extends SwingActionWrapper<JTable> {
|
||||
|
||||
private final Condition<Point> myCellCondition;
|
||||
|
||||
public MyFocusAction(JTable table, Condition<Point> cellCondition, KeyStroke keyStroke) {
|
||||
super(table, keyStroke);
|
||||
public MyFocusAction(JTable table, Condition<Point> cellCondition, Object key) {
|
||||
super(table, key);
|
||||
myCellCondition = cellCondition;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user