Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r8507 r8510 211 211 RemoveActiveSourcesAction removeActiveSourcesAction = new RemoveActiveSourcesAction(); 212 212 tblActiveSources.getSelectionModel().addListSelectionListener(removeActiveSourcesAction); 213 tblActiveSources.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");213 tblActiveSources.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete"); 214 214 tblActiveSources.getActionMap().put("delete", removeActiveSourcesAction); 215 215 … … 327 327 add(bottomRightTB, gbc); 328 328 329 /*** 330 * Icon configuration 331 **/ 332 329 // Icon configuration 333 330 if (handleIcons) { 334 331 buildIcons(gbc); … … 353 350 RemoveIconPathAction removeIconPathAction = new RemoveIconPathAction(); 354 351 tblIconPaths.getSelectionModel().addListSelectionListener(removeIconPathAction); 355 tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");352 tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete"); 356 353 tblIconPaths.getActionMap().put("delete", removeIconPathAction); 357 354 … … 494 491 public void deleteSelected() { 495 492 Iterator<ExtendedSourceEntry> it = data.iterator(); 496 int i =0;497 while (it.hasNext()) {493 int i = 0; 494 while (it.hasNext()) { 498 495 it.next(); 499 496 if (selectionModel.isSelectedIndex(i)) { … … 507 504 public List<ExtendedSourceEntry> getSelected() { 508 505 List<ExtendedSourceEntry> ret = new ArrayList<>(); 509 for (int i=0; i<data.size();i++) {506 for (int i = 0; i < data.size(); i++) { 510 507 if (selectionModel.isSelectedIndex(i)) { 511 508 ret.add(data.get(i)); … … 586 583 public void removeSelected() { 587 584 Iterator<SourceEntry> it = data.iterator(); 588 int i =0;589 while (it.hasNext()) {585 int i = 0; 586 while (it.hasNext()) { 590 587 it.next(); 591 588 if (selectionModel.isSelectedIndex(i)) { … … 599 596 public void removeIdxs(Collection<Integer> idxs) { 600 597 List<SourceEntry> newData = new ArrayList<>(); 601 for (int i =0; i<data.size(); ++i) {598 for (int i = 0; i < data.size(); ++i) { 602 599 if (!idxs.contains(i)) { 603 600 newData.add(data.get(i)); … … 617 614 for (ExtendedSourceEntry info: sources) { 618 615 int pos = data.indexOf(info); 619 if (pos >= 0) {616 if (pos >= 0) { 620 617 selectionModel.addSelectionInterval(pos, pos); 621 618 } … … 725 722 try { 726 723 sourceUrl = new URL(url); 727 } catch (MalformedURLException e) {724 } catch (MalformedURLException e) { 728 725 File f = new File(url); 729 726 if (f.isFile()) { … … 788 785 updateOkButtonState(); 789 786 } 787 790 788 @Override 791 789 public void removeUpdate(DocumentEvent e) { 792 790 updateOkButtonState(); 793 791 } 792 794 793 @Override 795 794 public void changedUpdate(DocumentEvent e) { … … 958 957 class MoveUpDownAction extends AbstractAction implements ListSelectionListener, TableModelListener { 959 958 private final int increment; 959 960 960 public MoveUpDownAction(boolean isDown) { 961 961 increment = isDown ? 1 : -1; … … 1054 1054 private final String url; 1055 1055 private final transient List<SourceProvider> sourceProviders; 1056 1056 1057 public ReloadSourcesAction(String url, List<SourceProvider> sourceProviders) { 1057 1058 putValue(NAME, tr("Reload")); … … 1101 1102 @Override 1102 1103 public void setValueAt(Object aValue, int rowIndex, int columnIndex) { 1103 updatePath(rowIndex, (String) aValue);1104 updatePath(rowIndex, (String) aValue); 1104 1105 } 1105 1106 1106 1107 public void setIconPaths(Collection<String> paths) { 1107 1108 data.clear(); 1108 if (paths != null) {1109 if (paths != null) { 1109 1110 data.addAll(paths); 1110 1111 } … … 1138 1139 public void removeSelected() { 1139 1140 Iterator<String> it = data.iterator(); 1140 int i =0;1141 while (it.hasNext()) {1141 int i = 0; 1142 while (it.hasNext()) { 1142 1143 it.next(); 1143 1144 if (selectionModel.isSelectedIndex(i)) { … … 1181 1182 public void actionPerformed(ActionEvent e) { 1182 1183 iconPathsModel.addPath(""); 1183 tblIconPaths.editCellAt(iconPathsModel.getRowCount() -1, 0);1184 tblIconPaths.editCellAt(iconPathsModel.getRowCount() -1, 0); 1184 1185 } 1185 1186 } … … 1500 1501 public boolean isCellEditable(EventObject anEvent) { 1501 1502 if (anEvent instanceof MouseEvent) 1502 return ((MouseEvent) anEvent).getClickCount() >= 2;1503 return ((MouseEvent) anEvent).getClickCount() >= 2; 1503 1504 return true; 1504 1505 } … … 1532 1533 @Override 1533 1534 public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 1534 setInitialValue((String) value);1535 setInitialValue((String) value); 1535 1536 tfFileName.selectAll(); 1536 1537 return this;
Note:
See TracChangeset
for help on using the changeset viewer.