Changeset 5645 in josm for trunk/src/org
- Timestamp:
- 2012-12-29T07:27:52+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r5642 r5645 8 8 import java.awt.Component; 9 9 import java.awt.Cursor; 10 import java.awt.Dialog;11 import java.awt.Dimension;12 10 import java.awt.FlowLayout; 13 11 import java.awt.Font; … … 21 19 import java.awt.event.FocusAdapter; 22 20 import java.awt.event.FocusEvent; 21 import java.awt.event.InputEvent; 23 22 import java.awt.event.KeyEvent; 24 23 import java.awt.event.MouseAdapter; 25 24 import java.awt.event.MouseEvent; 26 25 import java.awt.image.BufferedImage; 26 import java.security.KeyStore; 27 27 import java.util.ArrayList; 28 28 import java.util.Arrays; … … 37 37 import java.util.Map; 38 38 import java.util.Vector; 39 import javax.swing.AbstractAction; 39 40 import javax.swing.Action; 40 41 import javax.swing.Box; … … 42 43 import javax.swing.ImageIcon; 43 44 import javax.swing.JComponent; 44 import javax.swing.JDialog;45 45 import javax.swing.JLabel; 46 46 import javax.swing.JList; 47 47 import javax.swing.JOptionPane; 48 48 import javax.swing.JPanel; 49 import javax.swing.KeyStroke; 49 50 import javax.swing.table.DefaultTableModel; 50 51 import javax.swing.text.JTextComponent; … … 66 67 import org.openstreetmap.josm.tools.GBC; 67 68 import org.openstreetmap.josm.tools.Shortcut; 68 import org.openstreetmap.josm.tools.WindowGeometry;69 69 70 70 /** … … 75 75 private final Map<String, Map<String, Integer>> valueCount; 76 76 77 // Selection that we are editing by using both dialogs 78 Collection<OsmPrimitive> sel; 79 77 80 private String changedKey; 78 79 80 81 private String objKey; 81 82 … … 86 87 }; 87 88 88 Collection<OsmPrimitive> sel; 89 90 private String lastAddKey = null; 91 private String lastAddValue = null; 92 93 public static final int DEFAULT_LRU_TAGS_NUMBER = 5; 94 public static final int MAX_LRU_TAGS_NUMBER = 9; 95 96 // LRU cache for recently added tags (http://java-planet.blogspot.com/2005/08/how-to-set-up-simple-lru-cache-using.html) 97 private final Map<Tag, Void> recentTags = new LinkedHashMap<Tag, Void>(MAX_LRU_TAGS_NUMBER+1, 1.1f, true) { 98 @Override 99 protected boolean removeEldestEntry(Map.Entry<Tag, Void> eldest) { 100 return size() > MAX_LRU_TAGS_NUMBER; 101 } 102 }; 89 private String lastAddKey = null; 90 private String lastAddValue = null; 91 92 public static final int DEFAULT_LRU_TAGS_NUMBER = 5; 93 public static final int MAX_LRU_TAGS_NUMBER = 9; 94 95 // LRU cache for recently added tags (http://java-planet.blogspot.com/2005/08/how-to-set-up-simple-lru-cache-using.html) 96 private final Map<Tag, Void> recentTags = new LinkedHashMap<Tag, Void>(MAX_LRU_TAGS_NUMBER+1, 1.1f, true) { 97 @Override 98 protected boolean removeEldestEntry(Map.Entry<Tag, Void> eldest) { 99 return size() > MAX_LRU_TAGS_NUMBER; 100 } 101 }; 103 102 104 103 TagEditHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { … … 139 138 public void editProperty(final int row) { 140 139 changedKey = null; 141 Collection<OsmPrimitive>sel = Main.main.getCurrentDataSet().getSelected();140 sel = Main.main.getCurrentDataSet().getSelected(); 142 141 if (sel.isEmpty()) return; 143 142 … … 472 471 recentTagsToShow = MAX_LRU_TAGS_NUMBER; 473 472 } 473 474 // Add tag on Shift-Enter 475 mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 476 KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK), "addAndContinue"); 477 mainPanel.getActionMap().put("addAndContinue", new AbstractAction() { 478 @Override 479 public void actionPerformed(ActionEvent e) { 480 performTagAdding(); 481 } 482 }); 483 474 484 suggestRecentlyAddedTags(mainPanel, recentTagsToShow, focus); 475 485
Note:
See TracChangeset
for help on using the changeset viewer.