Changeset 2723 in josm for trunk/src/org
- Timestamp:
- 2010-01-01T14:17:49+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r2658 r2723 12 12 import java.awt.GridBagLayout; 13 13 import java.awt.GridLayout; 14 import java.awt.Point; 14 15 import java.awt.event.ActionEvent; 15 16 import java.awt.event.ActionListener; … … 41 42 import javax.swing.JOptionPane; 42 43 import javax.swing.JPanel; 44 import javax.swing.JPopupMenu; 43 45 import javax.swing.JScrollPane; 44 46 import javax.swing.JTable; … … 75 77 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 76 78 import org.openstreetmap.josm.gui.widgets.AutoCompleteComboBox; 79 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 77 80 import org.openstreetmap.josm.tools.GBC; 78 81 import org.openstreetmap.josm.tools.ImageProvider; … … 472 475 membershipData.setColumnIdentifiers(new String[]{tr("Member Of"),tr("Role")}); 473 476 membershipTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 477 membershipTable.addMouseListener(new PopupMenuLauncher() { 478 @Override 479 public void launch(MouseEvent evt) { 480 Point p = evt.getPoint(); 481 int row = membershipTable.rowAtPoint(p); 482 if (row > -1) { 483 JPopupMenu menu = new JPopupMenu(); 484 Relation relation = (Relation)membershipData.getValueAt(row, 0); 485 menu.add(new SelectRelationAction(relation, true)); 486 menu.add(new SelectRelationAction(relation, false)); 487 menu.show(membershipTable, p.x, p.y-3); 488 } 489 } 490 }); 474 491 475 492 membershipTable.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer() { … … 535 552 presets.setSize(scrollPane.getSize()); 536 553 537 JPanel buttonPanel = new JPanel(new GridLayout(1,3));554 JPanel buttonPanel = getButtonPanel(3); 538 555 539 556 // -- add action and shortcut … … 904 921 } 905 922 } 923 924 class SelectRelationAction extends AbstractAction { 925 boolean selectionmode; 926 Relation relation; 927 public SelectRelationAction(Relation r, boolean select) { 928 selectionmode = select; 929 relation = r; 930 if(select) { 931 putValue(NAME, tr("Select relation")); 932 putValue(SHORT_DESCRIPTION, tr("Select relation in main selection.")); 933 } else { 934 putValue(NAME, tr("Select in relation list")); 935 putValue(SHORT_DESCRIPTION, tr("Select relation in relation list.")); 936 } 937 } 938 939 public void actionPerformed(ActionEvent e) { 940 if(selectionmode) 941 Main.map.mapView.getEditLayer().data.setSelected(relation); 942 else 943 Main.map.relationListDialog.selectRelation(relation); 944 } 945 } 906 946 }
Note:
See TracChangeset
for help on using the changeset viewer.