Changeset 6246 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-09-22T18:36:07+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 49 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r6130 r6246 132 132 if(selectedWays.size() == 1) { 133 133 w = selectedWays.iterator().next(); 134 if (w.containsNode(n) == false)134 if (!w.containsNode(n)) 135 135 // warning 136 136 return; -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r6084 r6246 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.util.Arrays; 10 11 import java.util.Collection; 12 import java.util.Collections; 11 13 import java.util.HashSet; 12 14 import java.util.List; … … 38 40 public class AutoScaleAction extends JosmAction { 39 41 40 public static final String[] MODES = {42 public static final Collection<String> MODES = Collections.unmodifiableList(Arrays.asList( 41 43 marktr("data"), 42 44 marktr("layer"), … … 46 48 marktr("problem"), 47 49 marktr("previous"), 48 marktr("next") };50 marktr("next"))); 49 51 50 52 private final String mode; -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r6130 r6246 63 63 public static class JoinAreasResult { 64 64 65 public boolean mergeSuccessful;66 65 public boolean hasChanges; 67 public boolean hasRelationProblems;68 66 69 67 public List<Multipolygon> polygons; … … 539 537 540 538 result.hasChanges = true; 541 result.mergeSuccessful = true;542 539 result.polygons = polygons; 543 540 return result; -
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r6203 r6246 64 64 BorderLayout.NORTH); 65 65 66 class osmURLListener implements DocumentListener {66 class OsmURLListener implements DocumentListener { 67 67 @Override public void changedUpdate(DocumentEvent e) { parseURL(); } 68 68 @Override public void insertUpdate(DocumentEvent e) { parseURL(); } … … 70 70 } 71 71 72 class osmLonLatListener implements DocumentListener {72 class OsmLonLatListener implements DocumentListener { 73 73 @Override public void changedUpdate(DocumentEvent e) { updateUrl(false); } 74 74 @Override public void insertUpdate(DocumentEvent e) { updateUrl(false); } … … 76 76 } 77 77 78 osmLonLatListener x=new osmLonLatListener();78 OsmLonLatListener x = new OsmLonLatListener(); 79 79 lat.getDocument().addDocumentListener(x); 80 80 lon.getDocument().addDocumentListener(x); 81 81 zm.getDocument().addDocumentListener(x); 82 url.getDocument().addDocumentListener(new osmURLListener());82 url.getDocument().addDocumentListener(new OsmURLListener()); 83 83 84 84 JPanel p = new JPanel(new GridBagLayout()); -
trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java
r6239 r6246 28 28 import org.openstreetmap.josm.gui.widgets.JosmTextField; 29 29 30 public class Map _Rectifier_WMSmenuAction extends JosmAction {30 public class MapRectifierWMSmenuAction extends JosmAction { 31 31 /** 32 32 * Class that bundles all required information of a rectifier service … … 65 65 public ArrayList<RectifierService> services = new ArrayList<RectifierService>(); 66 66 67 public Map _Rectifier_WMSmenuAction() {67 public MapRectifierWMSmenuAction() { 68 68 super(tr("Rectified Image..."), 69 69 "OLmarker", -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r6244 r6246 161 161 boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false); 162 162 Layer active = Main.map.mapView.getActiveLayer(); 163 if (active != null && activeinstanceof GpxLayer && (merge || ((GpxLayer)active).data.fromServer))163 if (active instanceof GpxLayer && (merge || ((GpxLayer)active).data.fromServer)) 164 164 return (GpxLayer) active; 165 165 for (GpxLayer l : Main.map.mapView.getLayersOfType(GpxLayer.class)) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r6104 r6246 179 179 180 180 // update selection to reflect which way being modified 181 if (currentBaseNode != null && getCurrentDataSet() != null && getCurrentDataSet().getSelected().isEmpty() == false) {181 if (currentBaseNode != null && getCurrentDataSet() != null && !getCurrentDataSet().getSelected().isEmpty()) { 182 182 Way continueFrom = getWayForNode(currentBaseNode); 183 183 if (alt && continueFrom != null && (!currentBaseNode.isSelected() || continueFrom.isSelected())) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r6107 r6246 310 310 return; 311 311 312 if (sanityCheck() == false)312 if (!sanityCheck()) 313 313 return; 314 314 … … 586 586 } 587 587 588 private String getStringPref(String subKey) {589 return getStringPref(subKey, null);590 }591 592 588 @Override 593 589 public void preferenceChanged(PreferenceChangeEvent e) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r6215 r6246 312 312 // only show merge to node cursor if nearby node and that node is currently 313 313 // not being dragged 314 final boolean hasTarget = osm != null && osminstanceof Node && !osm.isSelected();314 final boolean hasTarget = osm instanceof Node && !osm.isSelected(); 315 315 c = hasTarget ? "merge_to_node" : "merge"; 316 316 break; -
trunk/src/org/openstreetmap/josm/command/RotateCommand.java
r6069 r6246 26 26 27 27 /** 28 * World position of the mouse when the user started the command.29 *30 */31 EastNorth startEN = null;32 33 /**34 28 * angle of rotation starting click to pivot 35 29 */ … … 49 43 50 44 pivot = getNodesCenter(); 51 52 // We remember the very first position of the mouse for this action.53 // Note that SelectAction will keep the same ScaleCommand when the user54 // releases the button and presses it again with the same modifiers.55 // The very first point of this operation is stored here.56 startEN = currentEN;57 58 45 startAngle = getAngle(currentEN); 59 46 rotationAngle = 0.0; -
trunk/src/org/openstreetmap/josm/data/Version.java
r6087 r6246 131 131 isLocalBuild = false; 132 132 value = properties.get("Is-Local-Build"); 133 if (value != null && value.trim(). toLowerCase().equals("true")) {133 if (value != null && value.trim().equalsIgnoreCase("true")) { 134 134 isLocalBuild = true; 135 135 } -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r6203 r6246 1 //License: GPLv2 or later 2 //Copyright 2007 by Raphael Mack and others 3 1 // License: GPL. For details, see LICENSE file. 4 2 package org.openstreetmap.josm.data.gpx; 5 3 -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r6215 r6246 398 398 @Override 399 399 public void setVisible(boolean visible) throws IllegalStateException{ 400 if (isNew() && visible == false)400 if (isNew() && !visible) 401 401 throw new IllegalStateException(tr("A primitive with ID = 0 cannot be invisible.")); 402 402 updateFlags(FLAG_VISIBLE, visible); -
trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java
r5909 r6246 50 50 51 51 @Override public boolean equals(Object o) { 52 return o != null && oinstanceof WaySegment52 return o instanceof WaySegment 53 53 && ((WaySegment) o).way == way 54 54 && ((WaySegment) o).lowerIndex == lowerIndex; -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6192 r6246 84 84 */ 85 85 @SuppressWarnings("unchecked") 86 p ublic staticClass<Test>[] allAvailableTests = new Class[] {86 private static final Class<Test>[] allAvailableTests = new Class[] { 87 87 DuplicateNode.class, // ID 1 .. 99 88 88 OverlappingWays.class, // ID 101 .. 199 -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r6098 r6246 27 27 import org.openstreetmap.josm.actions.AddImageryLayerAction; 28 28 import org.openstreetmap.josm.actions.JosmAction; 29 import org.openstreetmap.josm.actions.Map _Rectifier_WMSmenuAction;29 import org.openstreetmap.josm.actions.MapRectifierWMSmenuAction; 30 30 import org.openstreetmap.josm.data.coor.LatLon; 31 31 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 80 80 private JMenuItem singleOffset = new JMenuItem(offsetAction); 81 81 private JMenuItem offsetMenuItem = singleOffset; 82 private Map _Rectifier_WMSmenuAction rectaction = new Map_Rectifier_WMSmenuAction();82 private MapRectifierWMSmenuAction rectaction = new MapRectifierWMSmenuAction(); 83 83 84 84 public ImageryMenu(JMenu subMenu) { -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r6221 r6246 395 395 if ((!args.containsKey(Option.NO_MAXIMIZE) && maximized) || args.containsKey(Option.MAXIMIZE)) { 396 396 if (Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH)) { 397 // Main.debug("Main window maximized");398 397 Main.windowState = JFrame.MAXIMIZED_BOTH; 399 398 mainFrame.setExtendedState(Main.windowState); … … 401 400 Main.debug("Main window: maximizing not supported"); 402 401 } 403 } else { 404 // Main.debug("Main window not maximized"); 405 } 406 if(main.menu.fullscreenToggleAction != null) { 402 } 403 if (main.menu.fullscreenToggleAction != null) { 407 404 main.menu.fullscreenToggleAction.initial(); 408 405 } -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r6180 r6246 329 329 public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 11, ht("/Menu/Help")); 330 330 331 private final int defaultMenuPos = 11;331 private static final int defaultMenuPos = 11; 332 332 333 333 public final JosmAction moveUpAction = new MoveAction(MoveAction.Direction.UP); -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r6070 r6246 429 429 */ 430 430 sideToolBar.setComponentPopupMenu(new JPopupMenu() { 431 final int staticMenuEntryCount = 2;431 static final int staticMenuEntryCount = 2; 432 432 JCheckBoxMenuItem doNotHide = new JCheckBoxMenuItem(new AbstractAction(tr("Do not hide toolbar")) { 433 433 @Override -
trunk/src/org/openstreetmap/josm/gui/MenuScroller.java
r6084 r6246 1 1 /** 2 * @(#)MenuScroller.java 1.5.0 04/02/122 * MenuScroller.java 1.5.0 04/02/12 3 3 * License: use / modify without restrictions (see http://tips4java.wordpress.com/about/) 4 4 */ … … 438 438 */ 439 439 @Override 440 p ublicvoid finalize() throws Throwable {440 protected void finalize() throws Throwable { 441 441 dispose(); 442 442 } -
trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java
r6084 r6246 70 70 */ 71 71 private Component renderer(Component def, OsmPrimitive value) { 72 if ( def != null &&value != null && def instanceof JLabel) {72 if (value != null && def instanceof JLabel) { 73 73 ((JLabel)def).setText(getComponentText(value)); 74 74 ImageIcon icon = ImageProvider.get(value.getDisplayType()); … … 91 91 */ 92 92 private Component renderer(Component def, HistoryOsmPrimitive value) { 93 if ( def != null &&value != null && def instanceof JLabel) {93 if (value != null && def instanceof JLabel) { 94 94 ((JLabel)def).setText(value.getDisplayName(DefaultNameFormatter.getInstance())); 95 95 ((JLabel)def).setIcon(ImageProvider.get(value.getType())); -
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r6101 r6246 29 29 private PropertyChangeListener propertyChangeListener; 30 30 31 public SideButton(Action action) 32 { 31 public SideButton(Action action) { 33 32 super(action); 34 33 fixIcon(action); … … 36 35 } 37 36 38 public SideButton(Action action, boolean usename) 39 { 37 public SideButton(Action action, boolean usename) { 40 38 super(action); 41 39 if(!usename) { … … 46 44 } 47 45 48 public SideButton(Action action, String imagename) 49 { 46 public SideButton(Action action, String imagename) { 50 47 super(action); 51 48 setIcon(makeIcon(imagename)); … … 67 64 } 68 65 Icon i = getIcon(); 69 if (i != null && iinstanceof ImageIcon && i.getIconHeight() != iconHeight) {66 if (i instanceof ImageIcon && i.getIconHeight() != iconHeight) { 70 67 setIcon(getScaledImage(((ImageIcon) i).getImage())); 71 68 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r6203 r6246 17 17 import java.util.HashSet; 18 18 import java.util.List; 19 import java.util.Vector;20 19 import java.util.concurrent.CopyOnWriteArrayList; 21 20 … … 382 381 MapMarkerDot xmax_ymax = new MapMarkerDot(bbox.getMaxLat(), bbox.getMaxLon()); 383 382 384 Vector<MapMarker> marker = new Vector<MapMarker>(2);383 List<MapMarker> marker = new ArrayList<MapMarker>(2); 385 384 marker.add(xmin_ymin); 386 385 marker.add(xmax_ymax); -
trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
r6203 r6246 21 21 import java.beans.PropertyChangeEvent; 22 22 import java.beans.PropertyChangeListener; 23 import java.util.ArrayList; 23 24 import java.util.HashSet; 25 import java.util.List; 24 26 import java.util.Set; 25 import java.util.Vector;26 27 import java.util.regex.Matcher; 27 28 import java.util.regex.Pattern; … … 50 51 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator; 51 52 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 53 import org.openstreetmap.josm.gui.widgets.JosmTextField; 52 54 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 53 55 import org.openstreetmap.josm.tools.ImageProvider; 54 import org.openstreetmap.josm.gui.widgets.JosmTextField;55 56 56 57 /** … … 156 157 MapMarkerDot xmax_ymax = new MapMarkerDot(bbox.getMaxLat(), bbox.getMaxLon()); 157 158 158 Vector<MapMarker> marker = new Vector<MapMarker>(2);159 List<MapMarker> marker = new ArrayList<MapMarker>(2); 159 160 marker.add(xmin_ymin); 160 161 marker.add(xmax_ymax); -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r6172 r6246 20 20 protected List<ToggleDialog> allDialogs = new ArrayList<ToggleDialog>(); 21 21 protected MultiSplitPane mSpltPane = new MultiSplitPane(); 22 final protectedint DIVIDER_SIZE = 5;22 protected static final int DIVIDER_SIZE = 5; 23 23 24 24 /** -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r6172 r6246 236 236 public void actionPerformed(ActionEvent e) { 237 237 toggleButtonHook(); 238 if (getValue("toolbarbutton") != null &&getValue("toolbarbutton") instanceof JButton) {238 if (getValue("toolbarbutton") instanceof JButton) { 239 239 ((JButton) getValue("toolbarbutton")).setSelected(!isShowing); 240 240 } … … 255 255 showNotify(); 256 256 } 257 }258 259 @Override260 public void destroy() {261 super.destroy();262 257 } 263 258 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r6142 r6246 822 822 ++cnt; 823 823 } else if (cnt == 0) { 824 positionString += "," + String.valueOf(cur);824 positionString += "," + cur; 825 825 } else { 826 positionString += "-" + String.valueOf(last);827 positionString += "," + String.valueOf(cur);826 positionString += "-" + last; 827 positionString += "," + cur; 828 828 cnt = 0; 829 829 } … … 831 831 } 832 832 if (cnt >= 1) { 833 positionString += "-" + String.valueOf(last);833 positionString += "-" + last; 834 834 } 835 835 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r6113 r6246 38 38 import java.util.List; 39 39 import java.util.Map; 40 import java.util.Vector;41 40 42 41 import javax.swing.AbstractAction; … … 374 373 } 375 374 } 376 Collection<Command> commands =new Vector<Command>();375 Collection<Command> commands = new ArrayList<Command>(); 377 376 commands.add(new ChangePropertyCommand(sel, key, null)); 378 377 if (value.equals(tr("<different>"))) { 379 HashMap<String, Vector<OsmPrimitive>> map=new HashMap<String, Vector<OsmPrimitive>>();378 Map<String, ArrayList<OsmPrimitive>> map = new HashMap<String, ArrayList<OsmPrimitive>>(); 380 379 for (OsmPrimitive osm: sel) { 381 String val=osm.get(key); 382 if(val != null) 383 { 380 String val = osm.get(key); 381 if (val != null) { 384 382 if (map.containsKey(val)) { 385 383 map.get(val).add(osm); 386 384 } else { 387 Vector<OsmPrimitive> v = new Vector<OsmPrimitive>();385 ArrayList<OsmPrimitive> v = new ArrayList<OsmPrimitive>(); 388 386 v.add(osm); 389 387 map.put(val, v); … … 391 389 } 392 390 } 393 for (Map.Entry<String, Vector<OsmPrimitive>> e: map.entrySet()) {391 for (Map.Entry<String, ArrayList<OsmPrimitive>> e: map.entrySet()) { 394 392 commands.add(new ChangePropertyCommand(e.getValue(), newkey, e.getKey())); 395 393 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberRoleCellEditor.java
r6084 r6246 50 50 } 51 51 52 @Override53 public void cancelCellEditing() {54 super.cancelCellEditing();55 }56 57 @Override58 public boolean stopCellEditing() {59 return super.stopCellEditing();60 }61 62 52 /** Returns the edit field for this cell editor. */ 63 53 public AutoCompletingTextField getEditor() { -
trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java
r6222 r6246 65 65 private void diff() { 66 66 Diff diff = new Diff(reference, current); 67 Diff. change script = diff.diff_2(false);67 Diff.Change script = diff.diff_2(false); 68 68 twoColumnDiffFromScript(script, reference, current); 69 69 } … … 73 73 * This method expands this script into a full two column description. 74 74 */ 75 private void twoColumnDiffFromScript(Diff. change script, Object[] a, Object[] b) {75 private void twoColumnDiffFromScript(Diff.Change script, Object[] a, Object[] b) { 76 76 int ia = 0; 77 77 int ib = 0; -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r6143 r6246 122 122 123 123 protected GeorefImage[][] images; 124 protected final int serializeFormatVersion = 5;124 protected static final int serializeFormatVersion = 5; 125 125 protected boolean autoDownloadEnabled = true; 126 126 protected boolean autoResolutionEnabled = true; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r6223 r6246 37 37 import java.util.List; 38 38 import java.util.TimeZone; 39 import java.util.Vector;40 39 import java.util.zip.GZIPInputStream; 41 40 … … 116 115 117 116 ExtendedDialog syncDialog; 118 Vector<GpxDataWrapper> gpxLst = new Vector<GpxDataWrapper>();117 List<GpxDataWrapper> gpxLst = new ArrayList<GpxDataWrapper>(); 119 118 JPanel outerPanel; 120 119 JosmComboBox cbGpx; … … 292 291 293 292 String[] tmp = TimeZone.getAvailableIDs(); 294 Vector<String> vtTimezones = new Vector<String>(tmp.length);293 List<String> vtTimezones = new ArrayList<String>(tmp.length); 295 294 296 295 for (String tzStr : tmp) { … … 904 903 // This is called whenever one of the sliders is moved. 905 904 // It updates the labels and also calls the "match photos" code 906 class sliderListener implements ChangeListener {905 class SliderListener implements ChangeListener { 907 906 @Override 908 907 public void stateChanged(ChangeEvent e) { … … 970 969 971 970 // Call the sliderListener once manually so labels get adjusted 972 new sliderListener().stateChanged(null);971 new SliderListener().stateChanged(null); 973 972 // Listeners added here, otherwise it tries to match three times 974 973 // (when setting the default values) 975 sldTimezone.addChangeListener(new sliderListener());976 sldMinutes.addChangeListener(new sliderListener());977 sldSeconds.addChangeListener(new sliderListener());974 sldTimezone.addChangeListener(new SliderListener()); 975 sldMinutes.addChangeListener(new SliderListener()); 976 sldSeconds.addChangeListener(new SliderListener()); 978 977 979 978 // There is no way to cancel this dialog, all changes get applied -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java
r6085 r6246 31 31 AreaPrototype area = new AreaPrototype(); 32 32 IconPrototype icon = new IconPrototype(); 33 public void init() 34 { 33 public void init() { 35 34 conditions = null; 36 35 scaleMax = Double.POSITIVE_INFINITY; … … 50 49 } 51 50 52 Color convertColor(String colString) 53 { 51 Color convertColor(String colString) { 54 52 int i = colString.indexOf('#'); 55 53 Color ret; … … 80 78 81 79 private void startElementLine(String qName, Attributes atts, LinePrototype line) { 82 for (int count=0; count<atts.getLength(); count++) 83 { 84 if(atts.getQName(count).equals("width")) 85 { 80 for (int count=0; count<atts.getLength(); count++) { 81 if(atts.getQName(count).equals("width")) { 86 82 String val = atts.getValue(count); 87 83 if (! (val.startsWith("+") || val.startsWith("-") || val.endsWith("%"))) { 88 84 line.setWidth(Integer.parseInt(val)); 89 85 } 90 } 91 else if (atts.getQName(count).equals("colour")) { 86 } else if (atts.getQName(count).equals("colour")) { 92 87 line.color=convertColor(atts.getValue(count)); 93 88 } else if (atts.getQName(count).equals("realwidth")) { … … 122 117 private void startElementLinemod(String qName, Attributes atts, LinemodPrototype line) { 123 118 startElementLine(qName, atts, line); 124 for (int count=0; count<atts.getLength(); count++) 125 { 126 if(atts.getQName(count).equals("width")) 127 { 119 for (int count=0; count<atts.getLength(); count++) { 120 if (atts.getQName(count).equals("width")) { 128 121 String val = atts.getValue(count); 129 if(val.startsWith("+")) 130 { 122 if (val.startsWith("+")) { 131 123 line.setWidth(Integer.parseInt(val.substring(1))); 132 124 line.widthMode = LinemodPrototype.WidthMode.OFFSET; 133 } 134 else if(val.startsWith("-")) 135 { 125 } else if(val.startsWith("-")) { 136 126 line.setWidth(Integer.parseInt(val)); 137 127 line.widthMode = LinemodPrototype.WidthMode.OFFSET; 138 } 139 else if(val.endsWith("%")) 140 { 128 } else if(val.endsWith("%")) { 141 129 line.setWidth(Integer.parseInt(val.substring(0, val.length()-1))); 142 130 line.widthMode = LinemodPrototype.WidthMode.PERCENT; … … 151 139 152 140 @Override public void startElement(String uri,String name, String qName, Attributes atts) { 153 if (inDoc==true) 154 { 141 if (inDoc) { 155 142 if (qName.equals("rule")) { 156 143 inRule=true; 157 } else if (qName.equals("rules")) 158 { 144 } else if (qName.equals("rules")) { 159 145 if (style.name == null) { 160 146 style.name = atts.getValue("name"); … … 166 152 style.icon = atts.getValue("icon"); 167 153 } 168 } 169 else if (qName.equals("scale_max")) { 154 } else if (qName.equals("scale_max")) { 170 155 inScaleMax = true; 171 156 } else if (qName.equals("scale_min")) { 172 157 inScaleMin = true; 173 } else if (qName.equals("condition") && inRule) 174 { 158 } else if (qName.equals("condition") && inRule) { 175 159 inCondition=true; 176 160 XmlCondition c = rule.cond; 177 if(c.key != null) 178 { 161 if (c.key != null) { 179 162 if(rule.conditions == null) { 180 163 rule.conditions = new LinkedList<XmlCondition>(); … … 184 167 rule.conditions.add(c); 185 168 } 186 for (int count=0; count<atts.getLength(); count++) 187 { 188 if(atts.getQName(count).equals("k")) { 169 for (int count=0; count<atts.getLength(); count++) { 170 if (atts.getQName(count).equals("k")) { 189 171 c.key = atts.getValue(count); 190 } else if (atts.getQName(count).equals("v")) {172 } else if (atts.getQName(count).equals("v")) { 191 173 c.value = atts.getValue(count); 192 174 } else if(atts.getQName(count).equals("b")) { … … 199 181 error("The condition has no key!"); 200 182 } 201 } 202 else if (qName.equals("line")) 203 { 183 } else if (qName.equals("line")) { 204 184 hadLine = inLine = true; 205 185 startElementLine(qName, atts, rule.line); 206 } 207 else if (qName.equals("linemod")) 208 { 186 } else if (qName.equals("linemod")) { 209 187 hadLineMod = inLineMod = true; 210 188 startElementLinemod(qName, atts, rule.linemod); 211 } 212 else if (qName.equals("icon")) 213 { 189 } else if (qName.equals("icon")) { 214 190 inIcon = true; 215 for (int count=0; count<atts.getLength(); count++) 216 { 191 for (int count=0; count<atts.getLength(); count++) { 217 192 if (atts.getQName(count).equals("src")) { 218 193 IconReference icon = new IconReference(atts.getValue(count), style); … … 227 202 } 228 203 } 229 } 230 else if (qName.equals("area")) 231 { 204 } else if (qName.equals("area")) { 232 205 hadArea = inArea = true; 233 206 for (int count=0; count<atts.getLength(); count++) … … 251 224 @Override public void endElement(String uri,String name, String qName) 252 225 { 253 if (inRule && qName.equals("rule")) 254 { 255 if(hadLine) 226 if (inRule && qName.equals("rule")) { 227 if (hadLine) { 228 style.add(rule.cond, rule.conditions, 229 new LinePrototype(rule.line, new Range(rule.scaleMin, rule.scaleMax))); 230 } 231 if (hadLineMod) 256 232 { 257 233 style.add(rule.cond, rule.conditions, 258 new Line Prototype(rule.line, new Range(rule.scaleMin, rule.scaleMax)));259 } 260 if (hadLineMod)234 new LinemodPrototype(rule.linemod, new Range(rule.scaleMin, rule.scaleMax))); 235 } 236 if (hadIcon) 261 237 { 262 238 style.add(rule.cond, rule.conditions, 263 new LinemodPrototype(rule.linemod, new Range(rule.scaleMin, rule.scaleMax)));264 }265 if(hadIcon)266 {267 style.add(rule.cond, rule.conditions,268 239 new IconPrototype(rule.icon, new Range(rule.scaleMin, rule.scaleMax))); 269 240 } 270 if (hadArea)241 if (hadArea) 271 242 { 272 243 style.add(rule.cond, rule.conditions, … … 276 247 hadLine = hadLineMod = hadIcon = hadArea = false; 277 248 rule.init(); 278 } 279 else if (inCondition && qName.equals("condition")) { 249 } else if (inCondition && qName.equals("condition")) { 280 250 inCondition = false; 281 251 } else if (inLine && qName.equals("line")) { … … 294 264 } 295 265 296 @Override public void characters(char[] ch, int start, int length) 297 { 298 if (inScaleMax == true) { 266 @Override public void characters(char[] ch, int start, int length) { 267 if (inScaleMax) { 299 268 rule.scaleMax = Long.parseLong(new String(ch, start, length)); 300 } else if (inScaleMin == true) {269 } else if (inScaleMin) { 301 270 rule.scaleMin = Long.parseLong(new String(ch, start, length)); 302 271 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
r6085 r6246 332 332 +"</html>", null, "")) { 333 333 Main.pref.resetToDefault(); 334 try { Main.pref.save(); } catch (IOException ex) {} 334 try { 335 Main.pref.save(); 336 } catch (IOException e) { 337 Main.warn("IOException while saving preferences: "+e.getMessage()); 338 } 335 339 readPreferences(Main.pref); 336 340 applyFilter(); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r6084 r6246 63 63 } catch (Exception ex) { 64 64 // just ignore, Quaqua may not even be installed... 65 //System.out.println("Failed to load Quaqua: " + ex);66 65 } 67 66 -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r6148 r6246 86 86 static class MapPaintSourceEditor extends SourceEditor { 87 87 88 final privateString iconpref = "mappaint.icon.sources";88 private static final String iconpref = "mappaint.icon.sources"; 89 89 90 90 public MapPaintSourceEditor() { -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r6143 r6246 187 187 static class TaggingPresetSourceEditor extends SourceEditor { 188 188 189 final privateString iconpref = "taggingpreset.icon.sources";189 private static final String iconpref = "taggingpreset.icon.sources"; 190 190 191 191 public TaggingPresetSourceEditor() { -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r6231 r6246 50 50 List<String> data; 51 51 List<String> filteredData; 52 final String DEFAULT_CODE = "EPSG:3857";52 static final String DEFAULT_CODE = "EPSG:3857"; 53 53 String lastCode = DEFAULT_CODE; 54 54 ActionListener listener; -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertProjectionChoice.java
r5548 r6246 16 16 public class LambertProjectionChoice extends ListProjectionChoice { 17 17 18 p ublic staticString[] lambert4zones = {18 private static final String[] lambert4zones = { 19 19 tr("{0} ({1} to {2} degrees)", 1,"51.30","48.15"), 20 20 tr("{0} ({1} to {2} degrees)", 2,"48.15","45.45"), … … 23 23 }; 24 24 25 /** 26 * Constructs a new {@code LambertProjectionChoice}. 27 */ 25 28 public LambertProjectionChoice() { 26 29 super(tr("Lambert 4 Zones (France)"), "core:lambert", lambert4zones, tr("Lambert CC Zone")); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r6084 r6246 175 175 * Using the UTM transvers Mercator projection and specific geodesic settings. 176 176 */ 177 registerProjectionChoice(utm_france_dom = new UTM _France_DOM_ProjectionChoice()); // FR177 registerProjectionChoice(utm_france_dom = new UTMFranceDOMProjectionChoice()); // FR 178 178 179 179 /** -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMFranceDOMProjectionChoice.java
r6239 r6246 7 7 import java.util.Collections; 8 8 9 public class UTM _France_DOM_ProjectionChoice extends ListProjectionChoice {9 public class UTMFranceDOMProjectionChoice extends ListProjectionChoice { 10 10 11 11 private final static String FortMarigotName = tr("Guadeloupe Fort-Marigot 1949"); … … 23 23 private final static Integer[] utmEPSGs = { FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG, GuyaneEPSG }; 24 24 25 public UTM_France_DOM_ProjectionChoice() { 25 /** 26 * Constructs a new {@code UTMFranceDOMProjectionChoice}. 27 */ 28 public UTMFranceDOMProjectionChoice() { 26 29 super(tr("UTM France (DOM)"), "core:utmfrancedom", utmGeodesicsNames, tr("UTM Geodesic system")); 27 30 } -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreference.java
r6084 r6246 41 41 JPanel p = gui.createPreferenceTab(this); 42 42 43 PrefJPanel prefpanel = new PrefJPanel(new scListModel());43 PrefJPanel prefpanel = new PrefJPanel(new ScListModel()); 44 44 p.add(prefpanel, GBC.eol().fill(GBC.BOTH)); 45 45 if (defaultFilter!=null) prefpanel.filter(defaultFilter); … … 56 56 57 57 // Maybe move this to prefPanel? There's no need for it to be here. 58 private static class scListModel extends AbstractTableModel {58 private static class ScListModel extends AbstractTableModel { 59 59 private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")}; 60 60 private List<Shortcut> data; 61 61 62 public scListModel() {62 public ScListModel() { 63 63 data = Shortcut.listAll(); 64 64 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r6231 r6246 204 204 String cstring; 205 205 if(count > 0 && !required) { 206 cstring = "0,"+ String.valueOf(count);206 cstring = "0,"+count; 207 207 } else if(count > 0) { 208 208 cstring = String.valueOf(count); … … 1010 1010 } 1011 1011 1012 protected String getDisplayIfNull( String display) {1013 return display;1012 protected String getDisplayIfNull() { 1013 return null; 1014 1014 } 1015 1015 … … 1020 1020 String value = null; 1021 1021 if (display == null) { 1022 display = getDisplayIfNull( display);1022 display = getDisplayIfNull(); 1023 1023 } 1024 1024 … … 1208 1208 1209 1209 @Override 1210 protected String getDisplayIfNull( String display) {1210 protected String getDisplayIfNull() { 1211 1211 if (combo.isEditable()) 1212 1212 return combo.getEditor().getItem().toString(); 1213 1213 else 1214 return display; 1215 1214 return null; 1216 1215 } 1217 1216 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java
r6074 r6246 31 31 tr("Preset group {0}", getLocaleName()))); 32 32 putValue("toolbar", "tagginggroup_" + getRawName()); 33 }34 35 @Override36 public void setIcon(String iconName) {37 super.setIcon(iconName);38 33 } 39 34 -
trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java
r6009 r6246 17 17 private OsmDataLayer layer; 18 18 private StringBuilder out; 19 private final boolean skipEmptyNodes = true;19 private static final boolean skipEmptyNodes = true; 20 20 private boolean insertComma = false; 21 21 -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r6244 r6246 146 146 147 147 return FixEncoding(new ProgressInputStream(activeConnection, progressMonitor), encoding); 148 } catch(Exception e) { 149 if (e instanceof OsmTransferException) 150 throw (OsmTransferException)e; 151 else 152 throw new OsmTransferException(e); 148 } catch (OsmTransferException e) { 149 throw e; 150 } catch (Exception e) { 151 throw new OsmTransferException(e); 153 152 } 154 153 } finally { -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r6070 r6246 305 305 bytesToSkip -= nBytesRead; 306 306 } 307 if (bytesToSkip > 0) { 308 audioInputStream.skip(bytesToSkip); 307 while (bytesToSkip > 0) { 308 long skippedBytes = audioInputStream.skip(bytesToSkip); 309 bytesToSkip -= skippedBytes; 310 if (skippedBytes == 0) { 311 // Avoid inifinite loop 312 Main.warn("Unable to skip bytes from audio input stream"); 313 bytesToSkip = 0; 314 } 309 315 } 310 316 position = offset; -
trunk/src/org/openstreetmap/josm/tools/Diff.java
r6235 r6246 97 97 public Diff(Object[] a,Object[] b) { 98 98 Map<Object,Integer> h = new HashMap<Object,Integer>(a.length + b.length); 99 filevec = new file_data[] { new file_data(a,h),new file_data(b,h) };99 filevec = new FileData[] { new FileData(a,h),new FileData(b,h) }; 100 100 } 101 101 … … 123 123 search of the edit matrix. */ 124 124 private int fdiagoff, bdiagoff; 125 private final file_data[] filevec;125 private final FileData[] filevec; 126 126 private int cost; 127 127 /** Snakes bigger than this are considered "big". */ … … 358 358 filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]] = true; 359 359 } 360 } else 361 { 360 } else { 362 361 /* Find a point of correspondence in the middle of the files. */ 363 362 … … 378 377 compareseq (xoff, b, yoff, b - d); 379 378 /* This used to use f instead of b, 380 but that is incorrect!381 It is not necessarily the case that diagonal d382 has a snake from b to f. */379 but that is incorrect! 380 It is not necessarily the case that diagonal d 381 has a snake from b to f. */ 383 382 compareseq (b, xlim, b - d, ylim); 384 383 } … … 388 387 /** Discard lines from one file that have no matches in the other file. 389 388 */ 390 391 389 private void discard_confusing_lines() { 392 390 filevec[0].discard_confusing_lines(filevec[1]); … … 397 395 398 396 /** Adjust inserts/deletes of blank lines to join changes 399 as much as possible.397 as much as possible. 400 398 */ 401 402 399 private void shift_boundaries() { 403 400 if (inhibit) … … 409 406 public interface ScriptBuilder { 410 407 /** Scan the tables of which lines are inserted and deleted, 411 producing an edit script.412 @param changed0 true for lines in first file which do not match 2nd413 @param len0 number of lines in first file414 @param changed1 true for lines in 2nd file which do not match 1st415 @param len1 number of lines in 2nd file416 @return a linked list of changes - or null408 producing an edit script. 409 @param changed0 true for lines in first file which do not match 2nd 410 @param len0 number of lines in first file 411 @param changed1 true for lines in 2nd file which do not match 1st 412 @param len1 number of lines in 2nd file 413 @return a linked list of changes - or null 417 414 */ 418 public change build_script(415 public Change build_script( 419 416 boolean[] changed0,int len0, 420 417 boolean[] changed1,int len1 … … 427 424 static class ReverseScript implements ScriptBuilder { 428 425 @Override 429 public change build_script(426 public Change build_script( 430 427 final boolean[] changed0,int len0, 431 428 final boolean[] changed1,int len1) 432 429 { 433 change script = null;430 Change script = null; 434 431 int i0 = 0, i1 = 0; 435 432 while (i0 < len0 || i1 < len1) { … … 446 443 447 444 /* Record this change. */ 448 script = new change(line0, line1, i0 - line0, i1 - line1, script);445 script = new Change(line0, line1, i0 - line0, i1 - line1, script); 449 446 } 450 447 … … 459 456 static class ForwardScript implements ScriptBuilder { 460 457 /** Scan the tables of which lines are inserted and deleted, 461 producing an edit script in forward order. */458 producing an edit script in forward order. */ 462 459 @Override 463 public change build_script(460 public Change build_script( 464 461 final boolean[] changed0,int len0, 465 462 final boolean[] changed1,int len1) 466 463 { 467 change script = null;464 Change script = null; 468 465 int i0 = len0, i1 = len1; 469 466 … … 483 480 484 481 /* Record this change. */ 485 script = new change(i0, i1, line0 - i0, line1 - i1, script);482 script = new Change(i0, i1, line0 - i0, line1 - i1, script); 486 483 } 487 484 … … 499 496 reverseScript = new ReverseScript(); 500 497 501 /* Report the differences of two files. DEPTH is the current directory502 depth. */503 public final change diff_2(final boolean reverse) {498 /** Report the differences of two files. DEPTH is the current directory 499 depth. */ 500 public final Change diff_2(final boolean reverse) { 504 501 return diff(reverse ? reverseScript : forwardScript); 505 502 } … … 513 510 @return the head of a list of changes 514 511 */ 515 public change diff(final ScriptBuilder bld) {512 public Change diff(final ScriptBuilder bld) { 516 513 517 514 /* Some lines are obviously insertions or deletions … … 566 563 which the insertion was done; vice versa for INSERTED and LINE1. */ 567 564 568 public static class change {565 public static class Change { 569 566 /** Previous or next edit command. */ 570 public change link;567 public Change link; 571 568 /** # lines of file 1 changed here. */ 572 569 public final int inserted; … … 577 574 /** Line number of 1st inserted line. */ 578 575 public final int line1; 579 /** Change is ignorable. */580 public boolean ignore;581 576 582 577 /** Cons an additional entry onto the front of an edit script OLD. … … 587 582 If DELETED is 0 then LINE0 is the number of the line before 588 583 which the insertion was done; vice versa for INSERTED and LINE1. */ 589 public change(int line0, int line1, int deleted, int inserted, change old) {584 public Change(int line0, int line1, int deleted, int inserted, Change old) { 590 585 this.line0 = line0; 591 586 this.line1 = line1; … … 604 599 */ 605 600 606 class file_data {601 class FileData { 607 602 608 603 /** Allocate changed array for the results of comparison. */ 609 604 void clear() { 610 605 /* Allocate a flag for each line of each file, saying whether that line 611 is an insertion or deletion.612 Allocate an extra element, always zero, at each end of each vector.606 is an insertion or deletion. 607 Allocate an extra element, always zero, at each end of each vector. 613 608 */ 614 609 changed_flag = new boolean[buffered_lines + 2]; … … 616 611 617 612 /** Return equiv_count[I] as the number of lines in this file 618 that fall in equivalence class I.613 that fall in equivalence class I. 619 614 @return the array of equivalence class counts. 620 615 */ … … 640 635 @param f the other file 641 636 */ 642 void discard_confusing_lines( file_data f) {637 void discard_confusing_lines(FileData f) { 643 638 clear(); 644 639 /* Set up table of which lines are going to be discarded. */ … … 729 724 730 725 /* Now we have the length of a run of discardable lines 731 whose first and last are not provisional. */726 whose first and last are not provisional. */ 732 727 length = j - i; 733 728 734 729 /* If 1/4 of the lines in the run are provisional, 735 cancel discarding of all provisional lines in the run. */ 736 if (provisional * 4 > length) 737 { 730 cancel discarding of all provisional lines in the run. */ 731 if (provisional * 4 > length) { 738 732 while (j > i) 739 733 if (discards[--j] == 2) { 740 734 discards[j] = 0; 741 735 } 742 } 743 else 744 { 736 } else { 745 737 int consec; 746 738 int minimum = 1; … … 817 809 818 810 /** Actually discard the lines. 819 @param discards flags lines to be discarded811 @param discards flags lines to be discarded 820 812 */ 821 813 private void discard(final byte[] discards) { … … 833 825 } 834 826 835 file_data(int[] data) {827 FileData(int[] data) { 836 828 buffered_lines = data.length; 837 829 equivs = data; … … 840 832 } 841 833 842 file_data(Object[] data,Map<Object,Integer> h) {834 FileData(Object[] data,Map<Object,Integer> h) { 843 835 this(new int[data.length]); 844 836 // FIXME: diff 2.7 removes common prefix and common suffix … … 866 858 */ 867 859 868 void shift_boundaries( file_data f) {860 void shift_boundaries(FileData f) { 869 861 final boolean[] changed = changed_flag; 870 862 final boolean[] other_changed = f.changed_flag; … … 909 901 910 902 /* If the first changed line matches the following unchanged one, 911 and this run does not follow right after a previous run,912 and there are no lines deleted from the other file here,913 then classify the first changed line as unchanged914 and the following line as changed in its place. */903 and this run does not follow right after a previous run, 904 and there are no lines deleted from the other file here, 905 then classify the first changed line as unchanged 906 and the following line as changed in its place. */ 915 907 916 908 /* You might ask, how could this run follow right after another? 917 Only because the previous run was shifted here. */909 Only because the previous run was shifted here. */ 918 910 919 911 if (end != i_end … … 929 921 ++i; 930 922 /* Since one line-that-matches is now before this run 931 instead of after, we must advance in the other file932 to keep in synch. */923 instead of after, we must advance in the other file 924 to keep in synch. */ 933 925 ++j; 934 926 } else { … … 965 957 The results of comparison are stored here. */ 966 958 boolean[] changed_flag; 967 968 959 } 969 960 } -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r6230 r6246 181 181 182 182 for (int pos = 0; pos < ways.size(); pos ++) { 183 if ( changedWays[pos] == false) {183 if (!changedWays[pos]) { 184 184 continue; 185 185 } -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r6235 r6246 412 412 try { 413 413 return new ImageResource(ImageIO.read(new ByteArrayInputStream(bytes))); 414 } catch (IOException e) {} 414 } catch (IOException e) { 415 Main.warn("IOException while reading image: "+e.getMessage()); 416 } 415 417 } 416 418 } … … 522 524 try { 523 525 img = ImageIO.read(is.getFile().toURI().toURL()); 524 } catch (IOException e) {} 526 } catch (IOException e) { 527 Main.warn("IOException while reading HTTP image: "+e.getMessage()); 528 } 525 529 return img == null ? null : new ImageResource(img); 526 530 default: -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r6142 r6246 34 34 35 35 public static class TextAnalyzer { 36 int start = 0;37 boolean keyFound = false;38 36 boolean quotesStarted = false; 39 37 boolean esc = false; … … 42 40 String data; 43 41 int n; 44 boolean notFound;45 42 46 43 public TextAnalyzer(String text) {
Note:
See TracChangeset
for help on using the changeset viewer.