Changeset 5958 in josm for trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
- Timestamp:
- 2013-05-13T03:10:05+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r5622 r5958 6 6 import java.awt.Component; 7 7 import java.awt.Dimension; 8 import java.awt.Point; 8 9 import java.awt.Rectangle; 9 10 import java.awt.event.ActionEvent; 10 11 import java.awt.event.ItemEvent; 11 12 import java.awt.event.ItemListener; 12 import java.awt.event.MouseAdapter;13 13 import java.awt.event.MouseEvent; 14 14 import java.util.Observable; … … 30 30 import org.openstreetmap.josm.actions.AbstractInfoAction; 31 31 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; 32 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 32 33 import org.openstreetmap.josm.tools.ImageProvider; 33 34 … … 85 86 } 86 87 87 protected void showPopupMenu(MouseEvent evt) { 88 HistoryBrowserModel.VersionTableModel model = getVersionTableModel(); 89 int row = rowAtPoint(evt.getPoint()); 90 if (row > -1 && !model.isLatest(row)) { 91 HistoryOsmPrimitive primitive = model.getPrimitive(row); 92 popupMenu.prepare(primitive); 93 popupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); 94 } 95 } 96 97 class MouseListener extends MouseAdapter { 88 class MouseListener extends PopupMenuLauncher { 89 public MouseListener() { 90 super(popupMenu); 91 } 98 92 @Override 99 93 public void mousePressed(MouseEvent e) { 100 if (!showPopup(e) && e.getButton() == MouseEvent.BUTTON1) { 94 super.mousePressed(e); 95 if (!e.isPopupTrigger() && e.getButton() == MouseEvent.BUTTON1) { 101 96 int row = rowAtPoint(e.getPoint()); 102 97 int col = columnAtPoint(e.getPoint()); … … 108 103 } 109 104 @Override 110 public void mouseReleased(MouseEvent e) { 111 showPopup(e); 112 } 113 private boolean showPopup(MouseEvent e) { 114 if (e.isPopupTrigger()) { 115 showPopupMenu(e); 116 return true; 105 protected int checkTableSelection(JTable table, Point p) { 106 HistoryBrowserModel.VersionTableModel model = getVersionTableModel(); 107 int row = rowAtPoint(p); 108 if (row > -1 && !model.isLatest(row)) { 109 popupMenu.prepare(model.getPrimitive(row)); 117 110 } 118 return false;111 return row; 119 112 } 120 113 }
Note:
See TracChangeset
for help on using the changeset viewer.