Changeset 6792 in josm
- Timestamp:
- 2014-01-31T02:44:56+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 51 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
r5450 r6792 43 43 } 44 44 45 /** 46 * Constructs a new {@code AbstractMergeAction}. 47 */ 45 48 public AbstractMergeAction() { 46 49 super(); … … 74 77 return null; 75 78 76 Layer targetLayer = (Layer) layerList.getSelectedItem(); 77 return targetLayer; 79 return (Layer) layerList.getSelectedItem(); 78 80 } 79 81 -
trunk/src/org/openstreetmap/josm/actions/ActionParameter.java
r5170 r6792 42 42 return value; 43 43 } 44 45 44 } 46 45 … … 58 57 @Override 59 58 public SearchSetting readFromString(String s) { 60 SearchSetting result = SearchSetting.readFromString(s); 61 return result; 59 return SearchSetting.readFromString(s); 62 60 } 63 61 … … 68 66 return value.writeToString(); 69 67 } 70 71 68 } 72 69 } -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r6765 r6792 74 74 return update ? tr("Update multipolygon") : tr("Create multipolygon"); 75 75 } 76 77 private class CreateUpdateMultipolygonTask implements Runnable {76 77 private static class CreateUpdateMultipolygonTask implements Runnable { 78 78 private final Collection<Way> selectedWays; 79 79 private final Relation multipolygonRelation; -
trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java
r6327 r6792 26 26 private static final List<WeakReference<Component>> visibilityToggleListeners = new ArrayList<WeakReference<Component>>(); 27 27 28 private static ExpertToggleAction INSTANCE = new ExpertToggleAction();28 private static final ExpertToggleAction INSTANCE = new ExpertToggleAction(); 29 29 30 30 private synchronized static void fireExpertModeChanged(boolean isExpert) { … … 133 133 } 134 134 135 @Override 135 136 protected void notifySelectedState() { 136 137 super.notifySelectedState(); -
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r6340 r6792 27 27 import org.openstreetmap.josm.gui.ExtendedDialog; 28 28 import org.openstreetmap.josm.gui.layer.ImageryLayer; 29 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 30 import org.openstreetmap.josm.gui.widgets.JosmTextField; 29 31 import org.openstreetmap.josm.tools.GBC; 30 32 import org.openstreetmap.josm.tools.ImageProvider; 31 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;32 import org.openstreetmap.josm.gui.widgets.JosmTextField;33 33 34 34 public class ImageryAdjustAction extends MapMode implements MouseListener, MouseMotionListener, AWTEventListener{ … … 42 42 private MapMode oldMapMode; 43 43 44 /** 45 * Constructs a new {@code ImageryAdjustAction} for the given layer. 46 * @param layer The imagery layer 47 */ 44 48 public ImageryAdjustAction(ImageryLayer layer) { 45 49 super(tr("New offset"), "adjustimg", … … 50 54 } 51 55 52 @Override public void enterMode() { 56 @Override 57 public void enterMode() { 53 58 super.enterMode(); 54 59 if (layer == null) … … 63 68 offsetDialog.setVisible(true); 64 69 } 65 70 66 71 protected void addListeners() { 67 72 Main.map.mapView.addMouseListener(this); … … 70 75 Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK); 71 76 } catch (SecurityException ex) { 72 } 73 } 74 75 @Override public void exitMode() { 77 Main.error(ex); 78 } 79 } 80 81 @Override 82 public void exitMode() { 76 83 super.exitMode(); 77 84 if (offsetDialog != null) { … … 82 89 removeListeners(); 83 90 } 84 91 85 92 protected void removeListeners() { 86 93 try { 87 94 Toolkit.getDefaultToolkit().removeAWTEventListener(this); 88 95 } catch (SecurityException ex) { 96 Main.error(ex); 89 97 } 90 98 if (Main.isDisplayingMapView()) { … … 119 127 } 120 128 121 @Override public void mousePressed(MouseEvent e) { 129 @Override 130 public void mousePressed(MouseEvent e) { 122 131 if (e.getButton() != MouseEvent.BUTTON1) 123 132 return; … … 130 139 } 131 140 132 @Override public void mouseDragged(MouseEvent e) { 141 @Override 142 public void mouseDragged(MouseEvent e) { 133 143 if (layer == null || prevEastNorth == null) return; 134 144 EastNorth eastNorth = … … 144 154 } 145 155 146 @Override public void mouseReleased(MouseEvent e) { 156 @Override 157 public void mouseReleased(MouseEvent e) { 147 158 Main.map.mapView.repaint(); 148 159 Main.map.mapView.resetCursor(this); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r6546 r6792 272 272 Toolkit.getDefaultToolkit().removeAWTEventListener(this); 273 273 } catch (SecurityException ex) { 274 Main.warn(ex); 274 275 } 275 276 -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r6380 r6792 136 136 private final Cursor cursorCreateNodes; 137 137 138 private class ReferenceSegment {138 private static class ReferenceSegment { 139 139 public final EastNorth en; 140 140 public final EastNorth p1; -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r6367 r6792 252 252 boolean oldAlt = alt, oldShift = shift, oldCtrl = ctrl; 253 253 updateKeyModifiers(e); 254 boolean changed = (oldAlt != alt || oldShift != shift || oldCtrl != ctrl); 255 return changed; 254 return (oldAlt != alt || oldShift != shift || oldCtrl != ctrl); 256 255 } 257 256 -
trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
r6336 r6792 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.actions.relation; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.awt.event.ActionEvent; … … 8 10 import org.openstreetmap.josm.tools.ImageProvider; 9 11 10 import static org.openstreetmap.josm.tools.I18n.tr;11 12 13 12 /** 14 13 * Action that delete relations … … 16 15 */ 17 16 public class DeleteRelationsAction extends AbstractRelationAction { 18 class AbortException extends Exception {}17 static class AbortException extends Exception {} 19 18 20 19 /** -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r6674 r6792 77 77 addMatchFactory(new CoreUnaryMatchFactory()); 78 78 } 79 80 79 } 81 80 … … 289 288 */ 290 289 public static class Always extends Match { 291 public static Always INSTANCE = new Always(); 290 /** The unique instance/ */ 291 public static final Always INSTANCE = new Always(); 292 292 @Override public boolean match(OsmPrimitive osm) { 293 293 return true; -
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r6699 r6792 72 72 * Data fix to remove spaces at begin or end of tags 73 73 */ 74 public class FixDataSpace implements FixData {74 public static class FixDataSpace implements FixData { 75 75 @Override 76 76 public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) { … … 105 105 * Data fix to cleanup wrong spelled keys 106 106 */ 107 public class FixDataKey implements FixData {107 public static class FixDataKey implements FixData { 108 108 /** key of wrong data */ 109 109 String oldKey; … … 136 136 * Data fix to cleanup wrong spelled tags 137 137 */ 138 public class FixDataTag implements FixData {138 public static class FixDataTag implements FixData { 139 139 /** key of wrong data */ 140 140 String oldKey; -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r6780 r6792 1033 1033 * def otherwise 1034 1034 */ 1035 @SuppressWarnings("unchecked") 1035 1036 synchronized public <T extends Setting> T getSetting(String key, T def, Class<T> klass) { 1036 1037 CheckParameterUtil.ensureParameterNotNull(key); … … 1045 1046 Setting prop = settingsMap.get(key); 1046 1047 if (klass.isInstance(prop)) { 1047 @SuppressWarnings("unchecked") 1048 T prop_cast = (T) prop; 1049 return prop_cast; 1048 return (T) prop; 1050 1049 } else { 1051 1050 return def; … … 1075 1074 * If not a single entry could be found, <code>def</code> is returned. 1076 1075 */ 1076 @SuppressWarnings({ "unchecked", "rawtypes" }) 1077 1077 synchronized public Collection<Collection<String>> getArray(String key, Collection<Collection<String>> def) { 1078 1078 ListListSetting val = getSetting(key, ListListSetting.create(def), ListListSetting.class); 1079 @SuppressWarnings({ "unchecked", "rawtypes" }) 1080 Collection<Collection<String>> val_cast = (Collection) val.getValue(); 1081 return val_cast; 1079 return (Collection) val.getValue(); 1082 1080 } 1083 1081 -
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r6362 r6792 8 8 9 9 public final class OsmUtils { 10 10 11 11 private OsmUtils() { 12 12 // Hide default constructor for utils classes 13 13 } 14 14 15 static List<String> TRUE_VALUES = new ArrayList<String>(Arrays15 static final List<String> TRUE_VALUES = new ArrayList<String>(Arrays 16 16 .asList(new String[] { "true", "yes", "1", "on" })); 17 static List<String> FALSE_VALUES = new ArrayList<String>(Arrays17 static final List<String> FALSE_VALUES = new ArrayList<String>(Arrays 18 18 .asList(new String[] { "false", "no", "0", "off" })); 19 static List<String> REVERSE_VALUES = new ArrayList<String>(Arrays19 static final List<String> REVERSE_VALUES = new ArrayList<String>(Arrays 20 20 .asList(new String[] { "reverse", "-1" })); 21 21 -
trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java
r6724 r6792 67 67 private void testForError(Way w, Node wayNode, OsmPrimitive p) { 68 68 if (wayNode.isOutsideDownloadArea()) { 69 return; 69 70 } else if (Utils.exists(wayNode.getReferrers(), Predicates.hasTag("route", "ferry"))) { 71 return; 70 72 } else if (isArea(p)) { 71 73 addError(w, wayNode, p); -
trunk/src/org/openstreetmap/josm/gui/MapScaler.java
r6084 r6792 1 1 // License: GPL. See LICENSE file for details. 2 3 2 package org.openstreetmap.josm.gui; 4 3 … … 19 18 private final NavigatableComponent mv; 20 19 21 private static int PADDING_RIGHT = 100;20 private static final int PADDING_RIGHT = 100; 22 21 23 22 public MapScaler(NavigatableComponent mv) { … … 27 26 } 28 27 29 @Override public void paint(Graphics g) { 28 @Override 29 public void paint(Graphics g) { 30 30 String text = mv.getDist100PixelText(); 31 31 Rectangle2D bound = g.getFontMetrics().getStringBounds(text, g); … … 41 41 } 42 42 43 static public Color getColor() 44 { 43 static public Color getColor() { 45 44 return Main.pref.getColor(marktr("scale"), Color.white); 46 45 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r6267 r6792 35 35 */ 36 36 public class PropertiesMerger extends JPanel implements Observer, IConflictResolver { 37 private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000");37 private static final DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000"); 38 38 39 39 private JLabel lblMyCoordinates; -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueResolutionDecision.java
r6316 r6792 249 249 throw new IllegalStateException(tr("Not decided yet.")); 250 250 String key = tags.getKeys().iterator().next(); 251 String value = getChosenValue(); 252 ChangePropertyCommand cmd = new ChangePropertyCommand(primitive, key,value); 253 return cmd; 251 return new ChangePropertyCommand(primitive, key, getChosenValue()); 254 252 } 255 253 … … 267 265 throw new IllegalStateException(tr("Not decided yet.")); 268 266 String key = tags.getKeys().iterator().next(); 269 String value = getChosenValue(); 270 ChangePropertyCommand cmd = new ChangePropertyCommand(primitives, key,value); 271 return cmd; 272 } 273 274 /** 275 * Replies a tag representing the current resolution. Null, if this resolution is not resolved 276 * yet. 277 * 278 * @return a tag representing the current resolution. Null, if this resolution is not resolved 279 * yet 267 return new ChangePropertyCommand(primitives, key, getChosenValue()); 268 } 269 270 /** 271 * Replies a tag representing the current resolution. Null, if this resolution is not resolved yet. 272 * 273 * @return a tag representing the current resolution. Null, if this resolution is not resolved yet 280 274 */ 281 275 public Tag getResolution() { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r6316 r6792 89 89 if (canEdit) { 90 90 Constructor<RelationEditor> con = e.getConstructor(Relation.class, Collection.class); 91 RelationEditor editor = con.newInstance(layer, r, selectedMembers); 92 return editor; 91 return con.newInstance(layer, r, selectedMembers); 93 92 } 94 93 } catch (Exception ex) { 95 // plod on94 Main.warn(ex); 96 95 } 97 96 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationNodeMap.java
r6296 r6792 277 277 Set<Integer> adj = nw.nodes.get(n); 278 278 if (adj == null || adj.isEmpty()) return null; 279 Integer j = adj.iterator().next(); 280 return j; 279 return adj.iterator().next(); 281 280 } 282 281 -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r6743 r6792 525 525 OsmDataLayer editLayer = Main.main.getEditLayer(); 526 526 if (editLayer == null) return null; 527 OsmPrimitive p = editLayer.data.getPrimitiveById(latest.getId(), latest.getType()); 528 return p; 527 return editLayer.data.getPrimitiveById(latest.getId(), latest.getType()); 529 528 } 530 529 -
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r6666 r6792 223 223 OsmDataLayer editLayer = Main.main.getEditLayer(); 224 224 if (editLayer == null) return null; 225 OsmPrimitive p = editLayer.data.getPrimitiveById(primitiveId); 226 return p; 225 return editLayer.data.getPrimitiveById(primitiveId); 227 226 } 228 227 -
trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java
r6207 r6792 21 21 public class RelationMemberListViewer extends HistoryViewerPanel { 22 22 23 protected class MemberModelChanged implements TableModelListener {23 protected static class MemberModelChanged implements TableModelListener { 24 24 private final JTable table; 25 25 … … 35 35 } 36 36 37 @Override 37 38 protected JTable buildReferenceTable() { 38 39 JTable table = new JTable( … … 47 48 } 48 49 50 @Override 49 51 protected JTable buildCurrentTable() { 50 52 JTable table = new JTable( -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r6751 r6792 156 156 157 157 private Set<Tile> tileRequestsOutstanding = new HashSet<Tile>(); 158 158 159 159 @Override 160 160 public synchronized void tileLoadingFinished(Tile tile, boolean success) { … … 180 180 } 181 181 182 private class TmsTileClearController implements TileClearController, CancelListener {182 private static class TmsTileClearController implements TileClearController, CancelListener { 183 183 184 184 private final ProgressMonitor monitor; … … 797 797 if (x < 0 || x >= max || y < 0 || y >= max) 798 798 return null; 799 Tile tile = tileCache.getTile(tileSource, x, y, zoom); 800 return tile; 799 return tileCache.getTile(tileSource, x, y, zoom); 801 800 } 802 801 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r6643 r6792 90 90 long delta; 91 91 92 /** 93 * Constructs a new {@code CorrelateGpxWithImages} action. 94 * @param layer The image layer 95 */ 92 96 public CorrelateGpxWithImages(GeoImageLayer layer) { 93 97 super(tr("Correlate to GPX"), ImageProvider.get("dialogs/geoimage/gpx2img")); … … 1015 1019 firstGPXDate = dateParser.parse(curDateWpStr).getTime()/1000; 1016 1020 break outer; 1017 } catch(Exception e) {} 1021 } catch(Exception e) { 1022 Main.warn(e); 1023 } 1018 1024 } 1019 1025 } … … 1170 1176 return null; 1171 1177 } 1172 1178 1173 1179 private int matchPoints(List<ImageEntry> images, WayPoint prevWp, long prevWpTime, 1174 1180 WayPoint curWp, long curWpTime, long offset) { … … 1236 1242 } 1237 1243 1238 if (curImg.tmp.getPos() == null ) {1244 if (curImg.tmp.getPos() == null && prevWp != null) { 1239 1245 // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable 1240 1246 double timeDiff = (double)(imgTime - prevWpTime) / interval; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r6783 r6792 568 568 } 569 569 } catch (MetadataException ex) { 570 Main.debug(ex.getMessage()); 570 571 } 571 572 … … 584 585 e.setElevation(ele); 585 586 } catch (MetadataException ex) { 587 Main.debug(ex.getMessage()); 586 588 } 587 589 … … 603 605 } 604 606 } catch (Exception ex) { // (CompoundException and other exceptions, e.g. #5271) 605 // Do nothing607 Main.debug(ex.getMessage()); 606 608 } 607 609 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r6313 r6792 51 51 private String osdText = null; 52 52 53 private static int DRAG_BUTTON = Main.pref.getBoolean("geoimage.agpifo-style-drag-and-zoom", false) ? 1 : 3;54 private static int ZOOM_BUTTON = DRAG_BUTTON == 1 ? 3 : 1;53 private static final int DRAG_BUTTON = Main.pref.getBoolean("geoimage.agpifo-style-drag-and-zoom", false) ? 1 : 3; 54 private static final int ZOOM_BUTTON = DRAG_BUTTON == 1 ? 3 : 1; 55 55 56 56 /** The thread that reads the images. */ -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
r6313 r6792 40 40 for (int i = 0; i < data.size(); i++) { 41 41 if (stop) return; 42 43 System.err.print("fetching image "+i);44 42 45 43 data.get(i).thumbnail = loadThumb(data.get(i)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r6390 r6792 392 392 } 393 393 } 394 T res = mc.getCascade("default").get(key, def, c); 395 return res; 394 return mc.getCascade("default").get(key, def, c); 396 395 } 397 396 -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java
r6767 r6792 213 213 214 214 class MapTableModel extends AbstractTableModel { 215 @SuppressWarnings("unchecked") 215 216 private List<List<String>> data() { 216 217 if (entryIdx == null) return Collections.emptyList(); 217 @SuppressWarnings("unchecked") 218 List<List<String>> result = Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx)); 219 return result; 218 return Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx)); 220 219 } 221 220 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r6295 r6792 26 26 import org.openstreetmap.josm.data.projection.Projection; 27 27 import org.openstreetmap.josm.data.projection.Projections; 28 import org.openstreetmap.josm.gui.widgets.JosmTextField; 28 29 import org.openstreetmap.josm.tools.GBC; 29 import org.openstreetmap.josm.gui.widgets.JosmTextField;30 30 31 31 /** … … 43 43 } 44 44 45 private class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener {45 private static class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener { 46 46 47 47 public JosmTextField filter; -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
r6295 r6792 33 33 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 34 34 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 35 import org.openstreetmap.josm.gui.widgets.JosmTextField; 35 36 import org.openstreetmap.josm.tools.GBC; 36 37 import org.openstreetmap.josm.tools.ImageProvider; 37 38 import org.openstreetmap.josm.tools.Utils; 38 import org.openstreetmap.josm.gui.widgets.JosmTextField;39 39 40 40 public class CustomProjectionChoice extends AbstractProjectionChoice implements SubPrefsOptions { … … 189 189 s.append("<b>+bounds=</b>minlon,minlat,maxlon,maxlat - <i>"+tr("Projection bounds (in degrees)")+"</i><br>"); 190 190 191 HtmlPanel info = new HtmlPanel(s.toString()); 192 return info; 191 return new HtmlPanel(s.toString()); 193 192 } 194 193 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertCC9ZonesProjectionChoice.java
r6295 r6792 11 11 import javax.swing.JPanel; 12 12 13 import org.openstreetmap.josm.Main; 13 14 import org.openstreetmap.josm.tools.GBC; 14 15 import org.openstreetmap.josm.tools.ImageProvider; … … 76 77 if(zoneval >= 0 && zoneval <= 8) 77 78 return Collections.singleton(String.valueOf(zoneval+1)); 78 } catch(NumberFormatException ex) {} 79 } catch(NumberFormatException ex) { 80 Main.warn(ex); 81 } 79 82 } 80 83 return null; … … 90 93 try { 91 94 return Integer.parseInt(zone) - 1; 92 } catch(NumberFormatException e) {} 95 } catch(NumberFormatException e) { 96 Main.warn(e); 97 } 93 98 return defaultIndex; 94 99 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertProjectionChoice.java
r6246 r6792 11 11 import javax.swing.JPanel; 12 12 13 import org.openstreetmap.josm.Main; 13 14 import org.openstreetmap.josm.tools.GBC; 14 15 import org.openstreetmap.josm.tools.ImageProvider; … … 70 71 if(zoneval >= 1 && zoneval <= 4) 71 72 return Collections.singleton(zonestring); 72 } catch(NumberFormatException e) {} 73 } catch(NumberFormatException e) { 74 Main.warn(e); 75 } 73 76 } 74 77 return null; … … 84 87 try { 85 88 return Integer.parseInt(zone) - 1; 86 } catch(NumberFormatException e) {} 89 } catch(NumberFormatException e) { 90 Main.warn(e); 91 } 87 92 return defaultIndex; 88 93 } 89 90 94 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMFranceDOMProjectionChoice.java
r6246 r6792 6 6 import java.util.Collection; 7 7 import java.util.Collections; 8 9 import org.openstreetmap.josm.Main; 8 10 9 11 public class UTMFranceDOMProjectionChoice extends ListProjectionChoice { … … 39 41 try { 40 42 return Integer.parseInt(zone) - 1; 41 } catch(NumberFormatException e) {} 43 } catch(NumberFormatException e) { 44 Main.warn(e); 45 } 42 46 return defaultIndex; 43 47 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
r6316 r6792 16 16 import javax.swing.JRadioButton; 17 17 18 import org.openstreetmap.josm.Main; 18 19 import org.openstreetmap.josm.tools.GBC; 19 20 20 21 public class UTMProjectionChoice extends ListProjectionChoice { 21 22 22 public enum Hemisphere { North, South } 23 /** Earth emispheres **/ 24 public enum Hemisphere { 25 /** North emisphere */ 26 North, 27 /** South emisphere */ 28 South 29 } 23 30 24 31 private static final Hemisphere DEFAULT_HEMISPHERE = Hemisphere.North; … … 129 136 if(zoneval > 0 && zoneval <= 60) 130 137 return Arrays.asList(zonestring, hemisphere.toString()); 131 } catch(NumberFormatException e) {} 138 } catch(NumberFormatException e) { 139 Main.warn(e); 140 } 132 141 } 133 142 return null; … … 158 167 try { 159 168 return Integer.parseInt(zone) - 1; 160 } catch(NumberFormatException e) {} 169 } catch(NumberFormatException e) { 170 Main.warn(e); 171 } 161 172 return defaultIndex; 162 173 } -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r6643 r6792 116 116 filterField.setText(substring); 117 117 } 118 118 119 119 private static class ScListModel extends AbstractTableModel { 120 120 private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")}; … … 374 374 } 375 375 model.fireTableDataChanged(); 376 } 377 catch (PatternSyntaxException ex) { } 378 catch (ClassCastException ex2) { /* eliminate warning */ } 376 } catch (PatternSyntaxException ex) { 377 Main.warn(ex); 378 } catch (ClassCastException ex2) { 379 Main.warn(ex2); 380 } 379 381 } 380 382 … … 386 388 public void removeUpdate(DocumentEvent arg0) { filter(); } 387 389 } 388 389 390 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r6316 r6792 238 238 public TagModel get(int idx) { 239 239 if (idx >= tags.size()) return null; 240 TagModel tagModel =tags.get(idx);241 return tagModel;242 } 243 244 @Overridepublic boolean isCellEditable(int row, int col) {240 return tags.get(idx); 241 } 242 243 @Override 244 public boolean isCellEditable(int row, int col) { 245 245 // all cells are editable 246 246 return true; … … 484 484 return null; 485 485 486 String newkey = tag.getName(); 487 String newvalue = tag.getValue(); 488 489 ChangePropertyCommand command = new ChangePropertyCommand(primitives,newkey, newvalue); 490 return command; 486 return new ChangePropertyCommand(primitives, tag.getName(), tag.getValue()); 491 487 } 492 488 -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r6772 r6792 70 70 public final class TaggingPresetItems { 71 71 private TaggingPresetItems() { } 72 72 73 73 private static int auto_increment_selected = 0; 74 74 public static final String DIFFERENT = tr("<different>"); … … 79 79 private static final Map<String,EnumSet<TaggingPresetType>> typeCache = 80 80 new LinkedHashMap<String, EnumSet<TaggingPresetType>>(16, 1.1f, true); 81 81 82 82 /** 83 83 * Last value of each key used in presets, used for prefilling corresponding fields … … 279 279 } 280 280 } 281 281 282 282 public static class Usage { 283 283 TreeSet<String> values; … … 310 310 */ 311 311 public String text; 312 312 313 313 /** 314 314 * The context used for translating {@link #text} 315 315 */ 316 316 public String text_context; 317 317 318 318 /** 319 319 * The localized version of {@link #text} … … 342 342 + (locale_text != null ? "locale_text=" + locale_text : ""); 343 343 } 344 344 345 345 @Override 346 346 public String toString() { … … 365 365 */ 366 366 public String href; 367 367 368 368 /** 369 369 * The localized version of {@link #href} … … 421 421 } 422 422 } 423 423 424 424 public static class Roles extends TaggingPresetItem { 425 425 … … 526 526 } 527 527 } 528 528 529 529 @Override 530 530 public String toString() { … … 566 566 } 567 567 } 568 568 569 569 public static class Text extends KeyedItem { 570 570 … … 670 670 clearbutton.setFocusable(false); 671 671 bg.add(clearbutton); 672 // and its visible counterpart. - this mechanism allows us to 673 // have *no* button selected after the X is clicked, instead 672 // and its visible counterpart. - this mechanism allows us to 673 // have *no* button selected after the X is clicked, instead 674 674 // of the X remaining selected 675 675 JButton releasebutton = new JButton("X"); … … 703 703 } 704 704 } 705 705 706 706 @Override 707 707 public void addCommands(List<Tag> changedTags) { … … 713 713 return; 714 714 } 715 715 716 716 v = Tag.removeWhiteSpaces(v); 717 717 … … 748 748 */ 749 749 public static class CheckGroup extends TaggingPresetItem { 750 750 751 751 /** 752 752 * Number of columns (positive integer) 753 753 */ 754 754 public String columns; 755 755 756 756 /** 757 757 * List of checkboxes … … 764 764 int rows = (int) Math.ceil(checks.size()/cols.doubleValue()); 765 765 JPanel panel = new JPanel(new GridLayout(rows, cols)); 766 766 767 767 for (Check check : checks) { 768 768 check.addToPanel(panel, sel); 769 769 } 770 770 771 771 p.add(panel, GBC.eol()); 772 772 return false; … … 990 990 991 991 String[] value_array = null; 992 992 993 993 if (values_from != null) { 994 994 String[] class_method = values_from.split("#"); … … 998 998 // Check method is public static String[] methodName() 999 999 int mod = method.getModifiers(); 1000 if (Modifier.isPublic(mod) && Modifier.isStatic(mod) 1000 if (Modifier.isPublic(mod) && Modifier.isStatic(mod) 1001 1001 && method.getReturnType().equals(String[].class) && method.getParameterTypes().length == 0) { 1002 1002 value_array = (String[]) method.invoke(null); … … 1011 1011 } 1012 1012 } 1013 1013 1014 1014 if (value_array == null) { 1015 1015 value_array = splitEscaped(delChar, values); … … 1106 1106 } 1107 1107 1108 private static ListCellRenderer RENDERER = new ListCellRenderer() {1108 private static final ListCellRenderer RENDERER = new ListCellRenderer() { 1109 1109 1110 1110 JLabel lbl = new JLabel(); … … 1368 1368 return result; 1369 1369 } 1370 1370 1371 1371 static String fixPresetString(String s) { 1372 1372 return s == null ? s : s.replaceAll("'","''"); 1373 1373 } 1374 1374 1375 1375 /** 1376 1376 * allow escaped comma in comma separated list: … … 1406 1406 } 1407 1407 1408 1408 1409 1409 static Usage determineTextUsage(Collection<OsmPrimitive> sel, String key) { 1410 1410 Usage returnValue = new Usage(); -
trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
r6172 r6792 39 39 protected JTextComponent component = null; 40 40 protected UndoAction undoAction = null; 41 41 42 42 protected final PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { 43 43 @Override public void propertyChange(PropertyChangeEvent evt) { … … 48 48 } 49 49 }; 50 50 51 51 /** 52 52 * Creates a new {@link TextContextualPopupMenu}. … … 74 74 return this; 75 75 } 76 76 77 77 private void addMenuEntries() { 78 78 if (component.isEditable()) { … … 89 89 addMenuEntry(component, tr("Select All"), DefaultEditorKit.selectAllAction, null); 90 90 } 91 91 92 92 /** 93 93 * Detaches this contextual menu from its text component. … … 107 107 return this; 108 108 } 109 109 110 110 /** 111 111 * Creates a new {@link TextContextualPopupMenu} and enables it for the given text component. 112 112 * @param component The component that will display the menu and handle its actions. 113 * @return The {@link PopupMenuLauncher} responsible of displaying the popup menu. 113 * @return The {@link PopupMenuLauncher} responsible of displaying the popup menu. 114 114 * Call {@link #disableMenuFor} with this object if you want to disable the menu later. 115 115 * @see #disableMenuFor(JTextComponent, PopupMenuLauncher) … … 122 122 123 123 /** 124 * Disables the {@link TextContextualPopupMenu} attached to the given popup menu launcher and text component. 124 * Disables the {@link TextContextualPopupMenu} attached to the given popup menu launcher and text component. 125 125 * @param component The component that currently displays the menu and handles its actions. 126 126 * @param launcher The {@link PopupMenuLauncher} obtained via {@link #enableMenuFor}. … … 156 156 } 157 157 } 158 159 protected class UndoAction extends AbstractAction implements UndoableEditListener {160 158 159 protected static class UndoAction extends AbstractAction implements UndoableEditListener { 160 161 161 private final UndoManager undoManager = new UndoManager(); 162 162 163 163 public UndoAction() { 164 164 super(tr("Undo")); -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r6643 r6792 63 63 * <a href="http://www.boutell.com/newfaq/misc/urllength.html">WWW FAQ</a>. 64 64 */ 65 static privateint MAX_IDS_PER_REQUEST = 200;65 private static final int MAX_IDS_PER_REQUEST = 200; 66 66 67 67 private Set<Long> nodes; -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r6642 r6792 172 172 host = (new URL(serverUrl)).getHost(); 173 173 } catch (MalformedURLException e) { 174 Main.warn(e); 174 175 } 175 176 return host; -
trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java
r6552 r6792 63 63 return null; 64 64 monitor.indeterminateSubTask(tr("Downloading changesets ...")); 65 List<Changeset> changesets = OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true)); 66 return changesets; 65 return OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true)); 67 66 } catch(OsmTransferException e) { 68 67 throw e; … … 182 181 monitor.setCustomText(tr("Downloading content for changeset {0} ...", id)); 183 182 OsmChangesetContentParser parser = new OsmChangesetContentParser(in); 184 ChangesetDataSet ds = parser.parse(monitor.createSubTaskMonitor(1, true)); 185 return ds; 183 return parser.parse(monitor.createSubTaskMonitor(1, true)); 186 184 } catch(OsmDataParsingException e) { 187 185 throw new OsmTransferException(e); -
trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java
r5874 r6792 69 69 progressMonitor.indeterminateSubTask(tr("Downloading history...")); 70 70 final OsmHistoryReader reader = new OsmHistoryReader(in); 71 HistoryDataSet data = reader.parse(progressMonitor.createSubTaskMonitor(1, true)); 72 return data; 71 return reader.parse(progressMonitor.createSubTaskMonitor(1, true)); 73 72 } catch(OsmTransferException e) { 74 73 throw e; -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r6362 r6792 132 132 if (in == null) 133 133 return null; 134 final DataSet data = OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); 135 return data; 134 return OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); 136 135 } catch(OsmTransferException e) { 137 136 if (cancel) return null; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r6643 r6792 105 105 private static void addRequestHandlerClass(String command, 106 106 Class<? extends RequestHandler> handler, boolean silent) { 107 if(command.charAt(0) == '/') 108 { 107 if(command.charAt(0) == '/') { 109 108 command = command.substring(1); 110 109 } … … 246 245 sendError(out); 247 246 } catch (IOException e1) { 247 Main.warn(e1); 248 248 } 249 249 } finally { … … 363 363 out.write("\r\n"); 364 364 } 365 365 366 366 public static String getHandlersInfoAsJSON() { 367 367 StringBuilder r = new StringBuilder(); 368 368 boolean first = true; 369 369 r.append("["); 370 370 371 371 for (Entry<String, Class<? extends RequestHandler>> p : handlers.entrySet()) { 372 372 if (first) { … … 424 424 } 425 425 } 426 426 427 427 r.append("], \"examples\" : ["); 428 428 String[] examples = handler.getUsageExamples(cmd.substring(1)); … … 444 444 w.close(); 445 445 } catch (IOException ex) { 446 Main.warn(ex); 446 447 } 447 448 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r6674 r6792 19 19 import org.openstreetmap.josm.data.osm.BBox; 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 import org.openstreetmap.josm.data.osm.Node;22 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 22 import org.openstreetmap.josm.data.osm.Relation; 24 23 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 25 import org.openstreetmap.josm.data.osm.Way;26 24 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 27 25 import org.openstreetmap.josm.gui.util.GuiHelper; … … 35 33 */ 36 34 public class LoadAndZoomHandler extends RequestHandler { 37 35 38 36 /** 39 37 * The remote control command name used to load data and zoom. … … 53 51 54 52 // Optional argument 'select' 55 private final HashSet<SimplePrimitiveId> toSelect = new HashSet<SimplePrimitiveId>();53 private final Set<SimplePrimitiveId> toSelect = new HashSet<SimplePrimitiveId>(); 56 54 57 55 @Override … … 84 82 return getUsageExamples(myCommand); 85 83 } 86 84 87 85 @Override 88 86 public String[] getUsageExamples(String cmd) { … … 163 161 @Override 164 162 public void run() { 165 HashSet<OsmPrimitive> newSel = new HashSet<OsmPrimitive>();163 Set<OsmPrimitive> newSel = new HashSet<OsmPrimitive>(); 166 164 DataSet ds = Main.main.getCurrentDataSet(); 167 165 if(ds == null) // e.g. download failed … … 249 247 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")"); 250 248 } 251 249 252 250 // Current API 0.6 check: "The latitudes must be between -90 and 90" 253 251 if (!LatLon.isValidLat(minlat) || !LatLon.isValidLat(maxlat)) { -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java
r6070 r6792 8 8 import java.util.Map; 9 9 10 import org.w3c.dom.Element;11 import org.w3c.dom.Node;12 import org.w3c.dom.NodeList;13 14 10 import org.openstreetmap.josm.data.Preferences; 15 11 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 20 16 import org.openstreetmap.josm.io.IllegalDataException; 21 17 import org.openstreetmap.josm.io.session.SessionReader.ImportSupport; 18 import org.w3c.dom.Element; 19 import org.w3c.dom.Node; 20 import org.w3c.dom.NodeList; 22 21 23 22 /** … … 45 44 ImageryPreferenceEntry prefEntry = Preferences.deserializeStruct(attributes, ImageryPreferenceEntry.class); 46 45 ImageryInfo i = new ImageryInfo(prefEntry); 47 final ImageryLayer layer = ImageryLayer.create(i); 48 return layer; 46 return ImageryLayer.create(i); 49 47 } 50 51 48 } -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r6747 r6792 185 185 ZipEntry entry = zipFile.getEntry(inZipPath); 186 186 if (entry != null) { 187 InputStream is = zipFile.getInputStream(entry); 188 return is; 187 return zipFile.getInputStream(entry); 189 188 } 190 189 } … … 311 310 LatLon centerLL = new LatLon(Double.parseDouble(centerEl.getAttribute("lat")), Double.parseDouble(centerEl.getAttribute("lon"))); 312 311 center = Projections.project(centerLL); 313 } catch (NumberFormatException ex) {} 312 } catch (NumberFormatException ex) { 313 Main.warn(ex); 314 } 314 315 } 315 316 if (center != null) { … … 329 330 double scale = meterPerPixel / meterPerEasting; // unit: easting per pixel 330 331 viewport = new ViewportData(center, scale); 331 } catch (NumberFormatException ex) {} 332 } catch (NumberFormatException ex) { 333 Main.warn(ex); 334 } 332 335 } 333 336 } … … 344 347 active = -1; 345 348 } 346 349 347 350 MultiMap<Integer, Integer> deps = new MultiMap<Integer, Integer>(); 348 351 Map<Integer, Element> elems = new HashMap<Integer, Element>(); … … 362 365 try { 363 366 idx = Integer.parseInt(e.getAttribute("index")); 364 } catch (NumberFormatException ex) {} 367 } catch (NumberFormatException ex) { 368 Main.warn(ex); 369 } 365 370 if (idx == null) { 366 371 error(tr("unexpected format of attribute ''index'' for element ''layer''")); … … 591 596 592 597 private void loadSession(InputStream josIS, URI sessionFileURI, boolean zip, ProgressMonitor progressMonitor) throws IOException, IllegalDataException { 593 598 594 599 this.sessionFileURI = sessionFileURI; 595 600 this.zip = zip; 596 601 597 602 try { 598 603 DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r6643 r6792 322 322 if (className == null) 323 323 return null; 324 try{ 325 Class<?> realClass = Class.forName(className, true, classLoader); 326 return realClass; 324 try { 325 return Class.forName(className, true, classLoader); 327 326 } catch (ClassNotFoundException e) { 328 327 throw new PluginException(name, e); … … 381 380 File pluginFile = new File(s, pluginName + ".jar"); 382 381 if (pluginFile.exists()) { 383 PluginInformation info = new PluginInformation(pluginFile); 384 return info; 382 return new PluginInformation(pluginFile); 385 383 } 386 384 } -
trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java
r6084 r6792 47 47 } 48 48 49 @SuppressWarnings("unchecked") 49 50 @Override 50 51 public T next() { … … 53 54 current = null; 54 55 // we are save because predicate only accepts objects of type T 55 @SuppressWarnings("unchecked") T res = (T) old; 56 return res; 56 return (T) old; 57 57 } 58 58 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6772 r6792 294 294 return null; 295 295 } 296 296 297 297 /** 298 298 * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe. … … 307 307 return null; 308 308 } 309 309 310 310 /** 311 311 * Simple file copy function that will overwrite the target file.<br/> … … 386 386 } 387 387 } 388 388 389 389 /** 390 390 * Converts the given file to its URL. … … 457 457 try { 458 458 if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) { 459 String text = (String) t.getTransferData(DataFlavor.stringFlavor); 460 return text; 459 return (String) t.getTransferData(DataFlavor.stringFlavor); 461 460 } 462 461 } catch (UnsupportedFlavorException ex) { … … 780 779 /** 781 780 * Runs an external command and returns the standard output. 782 * 781 * 783 782 * The program is expected to execute fast. 784 * 783 * 785 784 * @param command the command with arguments 786 785 * @return the output … … 945 944 return result; 946 945 } 947 946 948 947 /** 949 948 * Adds the given item at the end of a new copy of given array.
Note:
See TracChangeset
for help on using the changeset viewer.