Skip to content

Commit

Permalink
Add Auto Open Search Option
Browse files Browse the repository at this point in the history
This re-implements the original BCV search functionality. Instead of opening all at once, you need to type "enter" for each file you want to open. It maintains the focus in the search box for this effect.
  • Loading branch information
Konloch committed Dec 9, 2023
1 parent d96aa2b commit 4f65ffd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
public class ResourceListPane extends TranslatedVisibleComponent implements FileDrop.Listener
{
public final JPopupMenu rightClickMenu = new JPopupMenu();
public final JCheckBox autoOpen = new TranslatedJCheckBox("Auto open", TranslatedComponents.EXACT_PATH);
public final JCheckBox exact = new TranslatedJCheckBox("Exact path", TranslatedComponents.EXACT_PATH);
public final JCheckBox caseSensitive = new TranslatedJCheckBox("Match case", TranslatedComponents.MATCH_CASE);
public final JButton open = new JButton(IconResources.add);
Expand Down Expand Up @@ -125,6 +126,7 @@ public ResourceListPane()
JPanel btns = new JPanel(new FlowLayout());
btns.add(exact);
btns.add(caseSensitive);
btns.add(autoOpen);
exactPanel.add(btns, BorderLayout.WEST);

buttonPanel.add(open, BorderLayout.EAST);
Expand Down Expand Up @@ -533,5 +535,4 @@ public void focusLost(final FocusEvent arg0)
}
});
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ public void keyPressed(final KeyEvent ke)
resourceListPane.tree.setSelectionPath(pathOpen);
resourceListPane.tree.makeVisible(pathOpen);
resourceListPane.tree.scrollPathToVisible(pathOpen);

if(resourceListPane.autoOpen.isSelected())
{
resourceListPane.openPath(pathOpen);
resourceListPane.quickSearch.requestFocusInWindow();
}

iteratePast++;
success = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public enum TranslatedComponents
MATCH_CASE,
EXACT_PATH,
PRINT_LINE_NUMBERS,
AUTO_OPEN,
;

private final TranslatedComponentReference componentReference;
Expand Down

0 comments on commit 4f65ffd

Please sign in to comment.