ABCExplorer - copy whole row

This commit is contained in:
Jindra Petřík
2023-09-30 12:25:08 +02:00
parent 29fa4cfe31
commit 4fc5861db2
3 changed files with 15 additions and 1 deletions

View File

@@ -333,6 +333,11 @@ public class ABCExplorerDialog extends AppDialog {
return null;
}
Object selection = tree.getLastSelectedPathComponent();
if (selection != null) {
JMenuItem copyRowMenuItem = new JMenuItem(translate("copy.row"), View.getIcon("copy16"));
copyRowMenuItem.addActionListener(this::copyRowActionPerformed);
menu.add(copyRowMenuItem);
}
if (selection instanceof ValueWithIndex) {
ValueWithIndex vwi = (ValueWithIndex) selection;
@@ -384,6 +389,13 @@ public class ABCExplorerDialog extends AppDialog {
return menu;
}
private void copyRowActionPerformed(ActionEvent e) {
Object selection = getCurrentTree().getLastSelectedPathComponent();
if (selection != null) {
copyToClipboard(selection.toString());
}
}
private void copyTitleActionPerformed(ActionEvent e) {
Object selection = getCurrentTree().getLastSelectedPathComponent();
if (selection instanceof SimpleValue) {
@@ -589,7 +601,7 @@ public class ABCExplorerDialog extends AppDialog {
}
@Override
public String toString() {
public String toString() {
return title + (!value.isEmpty() ? ": " + value : "");
}