Java Client: Support delete key for removing sites
This commit is contained in:
parent
e6f56d9da7
commit
ee02a54257
@ -527,6 +527,7 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener,
|
||||
|
||||
private static final String USE_SITE_ACTION = "useSite";
|
||||
private static final String CLEAR_SITE_ACTION = "clearSite";
|
||||
private static final String DELETE_SITE_ACTION = "deleteSite";
|
||||
|
||||
@Nonnull
|
||||
private final MPUser<?> user;
|
||||
@ -594,13 +595,17 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener,
|
||||
sitesModel = new CollectionListModel<MPQuery.Result<? extends MPSite<?>>>().selection( this::showSiteItem ),
|
||||
this::getSiteDescription ) ) );
|
||||
|
||||
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), USE_SITE_ACTION);
|
||||
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(copyLoginKeyStroke, USE_SITE_ACTION);
|
||||
final InputMap panelInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||
panelInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), USE_SITE_ACTION);
|
||||
panelInputMap.put(copyLoginKeyStroke, USE_SITE_ACTION);
|
||||
getActionMap().put(USE_SITE_ACTION, new SimpleAction(this::useSite));
|
||||
|
||||
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CLEAR_SITE_ACTION);
|
||||
panelInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CLEAR_SITE_ACTION);
|
||||
getActionMap().put(CLEAR_SITE_ACTION, new SimpleAction(e -> queryField.setText("")));
|
||||
|
||||
sitesList.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DELETE_SITE_ACTION);
|
||||
sitesList.getActionMap().put(DELETE_SITE_ACTION, deleteButton.getAction());
|
||||
|
||||
add( Components.strut() );
|
||||
|
||||
add( Components.label( strf(
|
||||
|
Loading…
Reference in New Issue
Block a user