Changeset 19101 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
- Timestamp:
- 2024-06-11T23:53:20+02:00 (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r19080 r19101 59 59 import javax.swing.KeyStroke; 60 60 import javax.swing.ListSelectionModel; 61 import javax.swing.SwingConstants; 61 62 import javax.swing.UIManager; 62 63 import javax.swing.event.CellEditorListener; … … 112 113 */ 113 114 public abstract class SourceEditor extends JPanel { 115 private static final String DELETE = "delete"; 116 private static final String DIALOGS = "dialogs"; 114 117 115 118 /** the type of source entry **/ … … 219 222 RemoveActiveSourcesAction removeActiveSourcesAction = new RemoveActiveSourcesAction(); 220 223 tblActiveSources.getSelectionModel().addListSelectionListener(removeActiveSourcesAction); 221 tblActiveSources.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");222 tblActiveSources.getActionMap().put( "delete", removeActiveSourcesAction);224 tblActiveSources.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DELETE); 225 tblActiveSources.getActionMap().put(DELETE, removeActiveSourcesAction); 223 226 224 227 MoveUpDownAction moveUp = null; … … 297 300 gbc.insets = new Insets(0, 0, 0, 6); 298 301 299 JToolBar sideButtonTB = new JToolBar( JToolBar.VERTICAL);302 JToolBar sideButtonTB = new JToolBar(SwingConstants.VERTICAL); 300 303 sideButtonTB.setFloatable(false); 301 304 sideButtonTB.setBorderPainted(false); … … 363 366 RemoveIconPathAction removeIconPathAction = new RemoveIconPathAction(); 364 367 tblIconPaths.getSelectionModel().addListSelectionListener(removeIconPathAction); 365 tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");366 tblIconPaths.getActionMap().put( "delete", removeIconPathAction);368 tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DELETE); 369 tblIconPaths.getActionMap().put(DELETE, removeIconPathAction); 367 370 368 371 gbc.gridx = 0; … … 721 724 data = IntStream.range(0, data.size()) 722 725 .filter(i -> !idxs.contains(i)) 723 .mapToObj( i -> data.get(i))726 .mapToObj(data::get) 724 727 .collect(Collectors.toList()); 725 728 fireTableDataChanged(); … … 909 912 putValue(NAME, tr("New")); 910 913 putValue(SHORT_DESCRIPTION, getStr(I18nString.NEW_SOURCE_ENTRY_TOOLTIP)); 911 new ImageProvider( "dialogs", "add").getResource().attachImageIcon(this);914 new ImageProvider(DIALOGS, "add").getResource().attachImageIcon(this); 912 915 } 913 916 … … 939 942 putValue(NAME, tr("Remove")); 940 943 putValue(SHORT_DESCRIPTION, getStr(I18nString.REMOVE_SOURCE_TOOLTIP)); 941 new ImageProvider( "dialogs", "delete").getResource().attachImageIcon(this);944 new ImageProvider(DIALOGS, DELETE).getResource().attachImageIcon(this); 942 945 updateEnabledState(); 943 946 } … … 962 965 putValue(NAME, tr("Edit")); 963 966 putValue(SHORT_DESCRIPTION, getStr(I18nString.EDIT_SOURCE_TOOLTIP)); 964 new ImageProvider( "dialogs", "edit").getResource().attachImageIcon(this);967 new ImageProvider(DIALOGS, "edit").getResource().attachImageIcon(this); 965 968 updateEnabledState(); 966 969 } … … 1008 1011 MoveUpDownAction(boolean isDown) { 1009 1012 increment = isDown ? 1 : -1; 1010 new ImageProvider( "dialogs", isDown ? "down" : "up").getResource().attachImageIcon(this, true);1013 new ImageProvider(DIALOGS, isDown ? "down" : "up").getResource().attachImageIcon(this, true); 1011 1014 putValue(SHORT_DESCRIPTION, isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up.")); 1012 1015 updateEnabledState(); … … 1110 1113 putValue(NAME, tr("Reload")); 1111 1114 putValue(SHORT_DESCRIPTION, tr(getStr(I18nString.RELOAD_ALL_AVAILABLE), url)); 1112 new ImageProvider( "dialogs", "refresh").getResource().attachImageIcon(this);1115 new ImageProvider(DIALOGS, "refresh").getResource().attachImageIcon(this); 1113 1116 this.url = url; 1114 1117 this.sourceProviders = sourceProviders; … … 1252 1255 putValue(NAME, tr("New")); 1253 1256 putValue(SHORT_DESCRIPTION, tr("Add a new icon path")); 1254 new ImageProvider( "dialogs", "add").getResource().attachImageIcon(this);1257 new ImageProvider(DIALOGS, "add").getResource().attachImageIcon(this); 1255 1258 } 1256 1259 … … 1266 1269 putValue(NAME, tr("Remove")); 1267 1270 putValue(SHORT_DESCRIPTION, tr("Remove the selected icon paths")); 1268 new ImageProvider( "dialogs", "delete").getResource().attachImageIcon(this);1271 new ImageProvider(DIALOGS, DELETE).getResource().attachImageIcon(this); 1269 1272 updateEnabledState(); 1270 1273 } … … 1289 1292 putValue(NAME, tr("Edit")); 1290 1293 putValue(SHORT_DESCRIPTION, tr("Edit the selected icon path")); 1291 new ImageProvider( "dialogs", "edit").getResource().attachImageIcon(this);1294 new ImageProvider(DIALOGS, "edit").getResource().attachImageIcon(this); 1292 1295 updateEnabledState(); 1293 1296 } … … 1608 1611 public void setInitialValue(String initialValue) { 1609 1612 this.value = initialValue; 1610 if (initialValue == null) { 1611 this.tfFileName.setText(""); 1612 } else { 1613 this.tfFileName.setText(initialValue); 1614 } 1613 this.tfFileName.setText(Objects.requireNonNullElse(initialValue, "")); 1615 1614 } 1616 1615
Note:
See TracChangeset
for help on using the changeset viewer.
