From 79a12d2d7136c3df48e4f1d5b033b043bbb79fca Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 5 Jun 2015 17:26:56 +0300 Subject: [PATCH] java compiler target level editor: speedsearch and scrolling to added items --- .../compiler/options/TargetOptionsComponent.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/java/compiler/impl/src/com/intellij/compiler/options/TargetOptionsComponent.java b/java/compiler/impl/src/com/intellij/compiler/options/TargetOptionsComponent.java index b7a7d6fcb5f5..3e5e30ee5ac0 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/TargetOptionsComponent.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/TargetOptionsComponent.java @@ -71,6 +71,8 @@ public class TargetOptionsComponent extends JPanel { targetLevelColumn.setMinWidth(width); targetLevelColumn.setMaxWidth(width); + new TableSpeedSearch(myTable); + add(new JLabel("Project bytecode version (leave blank for JDK default): "), constraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE)); add(myCbProjectTargetLevel, constraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NONE)); @@ -126,6 +128,11 @@ public class TargetOptionsComponent extends JPanel { final List elements = chooser.getChosenElements(); if (!elements.isEmpty()) { model.addItems(elements); + int i = model.getModuleRow(elements.get(0)); + if (i != -1) { + TableUtil.selectRows(myTable, new int[]{i}); + TableUtil.scrollSelectionToVisible(myTable); + } } } @@ -234,6 +241,15 @@ public class TargetOptionsComponent extends JPanel { fireTableDataChanged(); } + public int getModuleRow(Module module) { + for (int i = 0; i < myItems.size(); i++) { + if (myItems.get(i).module.equals(module)) { + return i; + } + } + return -1; + } + private static final class Item { final Module module; String targetLevel = "";