mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] clear the filter when "Delete" key is pressed
GitOrigin-RevId: 54c4ffb65fe9fbe5a4e18fafe52fbe97b565bad7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7ba74edcce
commit
85d8b9b1ac
@@ -12,6 +12,7 @@ a:com.intellij.util.ui.FilterComponent
|
||||
- initUi():javax.swing.JComponent
|
||||
- a:installChangeListener(java.lang.Runnable):V
|
||||
- pa:isValueSelected():Z
|
||||
- p:resetFilter():V
|
||||
- setEnabled(Z):V
|
||||
- setShowPopupAction(java.lang.Runnable):V
|
||||
- p:shouldDrawLabel():com.intellij.util.ui.FilterComponent$DrawLabelMode
|
||||
|
||||
@@ -192,6 +192,7 @@ vcs.log.editor.name=VCS Log Editor
|
||||
|
||||
# filters
|
||||
vcs.log.filter.all=All
|
||||
vcs.log.filter.clear=Clear
|
||||
vcs.log.filter.recent=Recent
|
||||
vcs.log.filter.structure.presentation.with.prefix=for {0}
|
||||
vcs.log.filter.root.presentation.with.prefix=in {0}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.HelpTooltip;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.ui.ClickListener;
|
||||
@@ -86,7 +88,7 @@ public abstract class FilterComponent extends JBPanel<FilterComponent> {
|
||||
myValueLabel.repaint();
|
||||
});
|
||||
showPopupMenuOnClick();
|
||||
showPopupMenuFromKeyboard();
|
||||
showPopupMenuFromKeyboardAndClearOnDelete();
|
||||
if (shouldIndicateHovering()) {
|
||||
Stream.of(this, myFilterActionButton, myNameLabel, myValueLabel)
|
||||
.filter(nonNull())
|
||||
@@ -103,6 +105,15 @@ public abstract class FilterComponent extends JBPanel<FilterComponent> {
|
||||
myFilterActionButton.setIcon(selected ? AllIcons.Actions.Close : AllIcons.General.ArrowDown);
|
||||
myFilterActionButton.setHoveredIcon(selected ? AllIcons.Actions.CloseHovered : AllIcons.General.ArrowDown);
|
||||
myFilterActionButton.setFocusable(selected);
|
||||
if (selected) {
|
||||
new HelpTooltip()
|
||||
.setTitle(VcsLogBundle.message("vcs.log.filter.clear"))
|
||||
.setShortcut(KeymapUtil.getKeyText(KeyEvent.VK_DELETE))
|
||||
.installOn(myFilterActionButton);
|
||||
}
|
||||
else {
|
||||
HelpTooltip.dispose(myFilterActionButton);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,7 +165,7 @@ public abstract class FilterComponent extends JBPanel<FilterComponent> {
|
||||
});
|
||||
}
|
||||
|
||||
private void showPopupMenuFromKeyboard() {
|
||||
private void showPopupMenuFromKeyboardAndClearOnDelete() {
|
||||
addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(@NotNull KeyEvent e) {
|
||||
@@ -162,6 +173,9 @@ public abstract class FilterComponent extends JBPanel<FilterComponent> {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
showPopup();
|
||||
}
|
||||
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
|
||||
resetFilter();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -223,7 +237,7 @@ public abstract class FilterComponent extends JBPanel<FilterComponent> {
|
||||
}
|
||||
}
|
||||
|
||||
private void resetFilter() {
|
||||
protected void resetFilter() {
|
||||
Runnable resetAction = createResetAction();
|
||||
if (resetAction != null) {
|
||||
resetAction.run();
|
||||
|
||||
Reference in New Issue
Block a user