Skip to content

Commit c800314

Browse files
author
taylor.smock
committed
Fix #22307: Add popup menu for notes (patch by Woazboat)
The popup menu has the following actions: * Comment * Open in Browser * Close * Reopen git-svn-id: https://josm.openstreetmap.de/svn/trunk@18540 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent 0f1bb9b commit c800314

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javax.swing.JList;
2828
import javax.swing.JOptionPane;
2929
import javax.swing.JPanel;
30+
import javax.swing.JPopupMenu;
3031
import javax.swing.JScrollPane;
3132
import javax.swing.ListCellRenderer;
3233
import javax.swing.ListSelectionModel;
@@ -54,6 +55,7 @@
5455
import org.openstreetmap.josm.gui.widgets.DisableShortcutsOnFocusGainedTextField;
5556
import org.openstreetmap.josm.gui.widgets.FilterField;
5657
import org.openstreetmap.josm.gui.widgets.JosmTextField;
58+
import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
5759
import org.openstreetmap.josm.spi.preferences.Config;
5860
import org.openstreetmap.josm.tools.ImageProvider;
5961
import org.openstreetmap.josm.tools.OpenBrowser;
@@ -134,6 +136,13 @@ public void mouseClicked(MouseEvent e) {
134136
new SideButton(openInBrowserAction, false),
135137
new SideButton(uploadAction, false)));
136138
updateButtonStates();
139+
140+
JPopupMenu notesPopupMenu = new JPopupMenu();
141+
notesPopupMenu.add(addCommentAction);
142+
notesPopupMenu.add(openInBrowserAction);
143+
notesPopupMenu.add(closeAction);
144+
notesPopupMenu.add(reopenAction);
145+
displayList.addMouseListener(new PopupMenuLauncher(notesPopupMenu));
137146
}
138147

139148
private void updateButtonStates() {
@@ -489,6 +498,7 @@ public void actionPerformed(ActionEvent e) {
489498

490499
class OpenInBrowserAction extends AbstractAction {
491500
OpenInBrowserAction() {
501+
super(tr("Open in browser"));
492502
putValue(SHORT_DESCRIPTION, tr("Open the note in an external browser"));
493503
new ImageProvider("help", "internet").getResource().attachImageIcon(this, true);
494504
}

0 commit comments

Comments
 (0)