- Timestamp:
- 2016-05-16T14:59:34+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r10212 r10228 274 274 public void run() { 275 275 if (items.size() == 1 && tr("No data found in this area.").equals(items.iterator().next())) { 276 new Notification(items.iterator().next() .toString()).setIcon(JOptionPane.WARNING_MESSAGE).show();276 new Notification(items.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 277 277 } else { 278 278 JOptionPane.showMessageDialog(Main.parent, "<html>" -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r10181 r10228 896 896 897 897 /** 898 * if one of the ends of {@code way} is given {@code 899 * then set 898 * if one of the ends of {@code way} is given {@code node}, 899 * then set currentBaseNode = node and previousNode = adjacent node of way 900 900 * @param way way to continue 901 901 * @param node starting node … … 1692 1692 } 1693 1693 1694 private void nextSnapMode() {1695 if (snapOn) {1696 // turn off snapping if we are in fixed mode or no actile snapping line exist1697 if (fixed || !active) {1698 snapOn = false;1699 unsetFixedMode();1700 } else {1701 setFixedMode();1702 }1703 } else {1704 snapOn = true;1705 unsetFixedMode();1706 }1707 checkBox.setState(snapOn);1708 customBaseHeading = -1;1709 }1710 1711 1694 private void enableSnapping() { 1712 1695 snapOn = true; … … 1729 1712 } 1730 1713 1731 public 1714 public void unsetFixedMode() { 1732 1715 fixed = false; 1733 1716 absoluteFix = false; … … 1736 1719 } 1737 1720 1738 public 1721 public boolean isActive() { 1739 1722 return active; 1740 1723 } 1741 1724 1742 public 1725 public boolean isSnapOn() { 1743 1726 return snapOn; 1744 1727 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r10179 r10228 50 50 protected static final String ASSOCIATED_STREET = "associatedStreet"; 51 51 52 protected class AddressError extends TestError { 53 54 public AddressError(int code, OsmPrimitive p, String message) { 55 this(code, Collections.singleton(p), message); 56 } 57 58 public AddressError(int code, Collection<OsmPrimitive> collection, String message) { 59 this(code, collection, message, null, null); 60 } 61 62 public AddressError(int code, Collection<OsmPrimitive> collection, String message, String description, String englishDescription) { 63 this(code, Severity.WARNING, collection, message, description, englishDescription); 64 } 65 66 public AddressError(int code, Severity severity, Collection<OsmPrimitive> collection, String message, String description, 67 String englishDescription) { 68 super(Addresses.this, severity, message, description, englishDescription, code, collection); 52 protected static class AddressError extends TestError { 53 54 public AddressError(Addresses tester, int code, OsmPrimitive p, String message) { 55 this(tester, code, Collections.singleton(p), message); 56 } 57 58 public AddressError(Addresses tester, int code, Collection<OsmPrimitive> collection, String message) { 59 this(tester, code, collection, message, null, null); 60 } 61 62 public AddressError(Addresses tester, int code, Collection<OsmPrimitive> collection, String message, 63 String description, String englishDescription) { 64 this(tester, code, Severity.WARNING, collection, message, description, englishDescription); 65 } 66 67 public AddressError(Addresses tester, int code, Severity severity, Collection<OsmPrimitive> collection, String message, 68 String description, String englishDescription) { 69 super(tester, severity, message, description, englishDescription, code, collection); 69 70 } 70 71 } … … 101 102 List<OsmPrimitive> errorList = new ArrayList<OsmPrimitive>(list); 102 103 errorList.add(0, p); 103 errors.add(new AddressError( MULTIPLE_STREET_RELATIONS, level, errorList,104 errors.add(new AddressError(this, MULTIPLE_STREET_RELATIONS, level, errorList, 104 105 tr("Multiple associatedStreet relations"), null, null)); 105 106 } … … 122 123 } 123 124 // No street found 124 errors.add(new AddressError( HOUSE_NUMBER_WITHOUT_STREET, p, tr("House number without street")));125 errors.add(new AddressError(this, HOUSE_NUMBER_WITHOUT_STREET, p, tr("House number without street"))); 125 126 } 126 127 } … … 186 187 List<OsmPrimitive> list = entry.getValue(); 187 188 if (list.size() > 1) { 188 errors.add(new AddressError( DUPLICATE_HOUSE_NUMBER, list,189 errors.add(new AddressError(this, DUPLICATE_HOUSE_NUMBER, list, 189 190 tr("Duplicate house numbers"), tr(englishDescription, entry.getKey()), englishDescription)); 190 191 } … … 192 193 // Report wrong street names 193 194 if (!wrongStreetNames.isEmpty()) { 194 errors.add(new AddressError( MULTIPLE_STREET_NAMES, wrongStreetNames,195 errors.add(new AddressError(this, MULTIPLE_STREET_NAMES, wrongStreetNames, 195 196 tr("Multiple street names in relation"))); 196 197 } … … 248 249 List<OsmPrimitive> errorList = new ArrayList<OsmPrimitive>(street); 249 250 errorList.add(0, house); 250 errors.add(new AddressError( HOUSE_NUMBER_TOO_FAR, errorList,251 errors.add(new AddressError(this, HOUSE_NUMBER_TOO_FAR, errorList, 251 252 tr("House number too far from street"))); 252 253 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r10204 r10228 75 75 } 76 76 77 protected class WrongRoundaboutHighway extends TestError {77 protected static class WrongRoundaboutHighway extends TestError { 78 78 79 79 public final String correctValue; 80 80 81 public WrongRoundaboutHighway( Way w, String key) {82 super( Highways.this, Severity.WARNING,81 public WrongRoundaboutHighway(Highways tester, Way w, String key) { 82 super(tester, Severity.WARNING, 83 83 tr("Incorrect roundabout (highway: {0} instead of {1})", w.get("highway"), key), 84 84 WRONG_ROUNDABOUT_HIGHWAY, w); … … 146 146 // Error when the highway tags do not match 147 147 if (!w.get("highway").equals(s)) { 148 errors.add(new WrongRoundaboutHighway( w, s));148 errors.add(new WrongRoundaboutHighway(this, w, s)); 149 149 } 150 150 break; -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r9895 r10228 70 70 if (!isPowerAllowed(n) && IN_DOWNLOADED_AREA.evaluate(n)) { 71 71 if (!w.isFirstLastNode(n) || !isPowerStation(n)) { 72 potentialErrors.add(new PowerLineError( n, w));72 potentialErrors.add(new PowerLineError(this, n, w)); 73 73 erroneous = true; 74 74 } … … 209 209 private final Way line; 210 210 211 public PowerLineError( Node n, Way line) {212 super( PowerLines.this, Severity.WARNING,211 public PowerLineError(PowerLines tester, Node n, Way line) { 212 super(tester, Severity.WARNING, 213 213 tr("Missing power tower/pole within power line"), POWER_LINES, n); 214 214 this.line = line; -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r10173 r10228 824 824 } 825 825 826 private int getMaximumAvailableWidth() {827 int maxWidth = getSize().width;828 for (int i = 0; i < getMenuCount(); i++) {829 JMenu menu = getMenu(i);830 if (menu != null) {831 maxWidth -= menu.getPreferredSize().width;832 }833 }834 return maxWidth;835 }836 837 826 /** 838 827 * Search main menu for items with {@code textToFind} in title. -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10212 r10228 93 93 * @author imi 94 94 */ 95 public class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener {95 public final class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener { 96 96 97 97 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Main.pref.get("statusbar.decimal-format", "0.0")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r10212 r10228 719 719 @Override 720 720 public int compare(Relation o1, Relation o2) { 721 int comp = Boolean. valueOf(o1.isDisabledAndHidden()).compareTo(o2.isDisabledAndHidden());721 int comp = Boolean.compare(o1.isDisabledAndHidden(), o2.isDisabledAndHidden()); 722 722 return comp != 0 ? comp : DefaultNameFormatter.getInstance().getRelationComparator().compare(o1, o2); 723 723 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
r10074 r10228 60 60 protected void realRun() throws SAXException, IOException, OsmTransferException { 61 61 precacheTask = layer.downloadAreaToCache(progressMonitor, points, 0, 0); 62 while (!precacheTask.isFinished() && !progressMonitor.isCanceled()) {63 synchronized (this){64 try{62 synchronized (this) { 63 try { 64 while (!precacheTask.isFinished() && !progressMonitor.isCanceled()) { 65 65 wait(200); 66 } catch (InterruptedException ex) {67 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while precaching WMS");68 66 } 67 } catch (InterruptedException ex) { 68 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while precaching WMS"); 69 69 } 70 70 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java
r10137 r10228 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn;6 5 7 import java.awt.Component;8 6 import java.awt.GridBagConstraints; 9 7 import java.awt.GridBagLayout; 10 8 import java.awt.Insets; 11 9 import java.awt.Rectangle; 12 import java.awt.event.ActionEvent;13 import java.awt.event.ActionListener;14 10 import java.awt.event.MouseAdapter; 15 11 import java.awt.event.MouseEvent; 16 import java.util.HashSet;17 12 import java.util.List; 18 import java.util.Set;19 13 20 import javax.swing.JCheckBox;21 14 import javax.swing.JLabel; 22 import javax.swing.JOptionPane;23 15 import javax.swing.SwingConstants; 24 16 import javax.swing.SwingUtilities; … … 29 21 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 30 22 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 31 import org.openstreetmap.josm.plugins.PluginHandler;32 23 import org.openstreetmap.josm.plugins.PluginInformation; 33 24 import org.openstreetmap.josm.tools.OpenBrowser; 34 import org.openstreetmap.josm.tools.Utils;35 25 36 26 /** … … 56 46 } 57 47 58 protected String formatPluginRemoteVersion(PluginInformation pi) {48 protected static String formatPluginRemoteVersion(PluginInformation pi) { 59 49 StringBuilder sb = new StringBuilder(); 60 50 if (pi.version == null || pi.version.trim().isEmpty()) { … … 69 59 } 70 60 71 protected String formatPluginLocalVersion(PluginInformation pi) {61 protected static String formatPluginLocalVersion(PluginInformation pi) { 72 62 if (pi == null) 73 63 return tr("unknown"); … … 77 67 } 78 68 79 protected String formatCheckboxTooltipText(PluginInformation pi) {69 protected static String formatCheckboxTooltipText(PluginInformation pi) { 80 70 if (pi == null) 81 71 return ""; … … 108 98 109 99 /** 110 * A plugin checkbox.111 */112 private class JPluginCheckBox extends JCheckBox {113 protected final transient PluginInformation pi;114 115 JPluginCheckBox(final PluginInformation pi, boolean selected) {116 this.pi = pi;117 setSelected(selected);118 setToolTipText(formatCheckboxTooltipText(pi));119 addActionListener(new PluginCbActionListener(this));120 }121 }122 123 /**124 * Listener called when the user selects/unselects a plugin checkbox.125 */126 private class PluginCbActionListener implements ActionListener {127 private final JPluginCheckBox cb;128 129 PluginCbActionListener(JPluginCheckBox cb) {130 this.cb = cb;131 }132 133 protected void selectRequiredPlugins(PluginInformation info) {134 if (info != null && info.requires != null) {135 for (String s : info.getRequiredPlugins()) {136 if (!model.isSelectedPlugin(s)) {137 model.setPluginSelected(s, true);138 selectRequiredPlugins(model.getPluginInformation(s));139 }140 }141 }142 }143 144 @Override145 public void actionPerformed(ActionEvent e) {146 // Select/unselect corresponding plugin in the model147 model.setPluginSelected(cb.pi.getName(), cb.isSelected());148 // Does the newly selected plugin require other plugins ?149 if (cb.isSelected() && cb.pi.requires != null) {150 // Select required plugins151 selectRequiredPlugins(cb.pi);152 // Alert user if plugin requirements are not met153 PluginHandler.checkRequiredPluginsPreconditions(PluginListPanel.this, model.getAvailablePlugins(), cb.pi, false);154 } else if (!cb.isSelected()) {155 // If the plugin has been unselected, was it required by other plugins still selected ?156 Set<String> otherPlugins = new HashSet<>();157 for (PluginInformation pi : model.getAvailablePlugins()) {158 if (!pi.equals(cb.pi) && pi.requires != null && model.isSelectedPlugin(pi.getName())) {159 for (String s : pi.getRequiredPlugins()) {160 if (s.equals(cb.pi.getName())) {161 otherPlugins.add(pi.getName());162 break;163 }164 }165 }166 }167 if (!otherPlugins.isEmpty()) {168 alertPluginStillRequired(PluginListPanel.this, cb.pi.getName(), otherPlugins);169 }170 }171 }172 }173 174 /**175 * Alerts the user if an unselected plugin is still required by another plugins176 *177 * @param parent The parent Component used to display error popup178 * @param plugin the plugin179 * @param otherPlugins the other plugins180 */181 private static void alertPluginStillRequired(Component parent, String plugin, Set<String> otherPlugins) {182 StringBuilder sb = new StringBuilder("<html>")183 .append(trn("Plugin {0} is still required by this plugin:",184 "Plugin {0} is still required by these {1} plugins:",185 otherPlugins.size(),186 plugin,187 otherPlugins.size()))188 .append(Utils.joinAsHtmlUnorderedList(otherPlugins))189 .append("</html>");190 JOptionPane.showMessageDialog(191 parent,192 sb.toString(),193 tr("Warning"),194 JOptionPane.WARNING_MESSAGE195 );196 }197 198 /**199 100 * Refreshes the list. 200 101 */ … … 221 122 String localversion = formatPluginLocalVersion(model.getPluginInformation(pi.getName())); 222 123 223 final JPluginCheckBox cbPlugin = new JPluginCheckBox(pi, selected);124 final PluginCheckBox cbPlugin = new PluginCheckBox(pi, selected, this, model); 224 125 String pluginText = tr("{0}: Version {1} (local: {2})", pi.getName(), remoteversion, localversion); 225 126 if (pi.requires != null && !pi.requires.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionItemPriority.java
r10137 r10228 117 117 return ui; 118 118 119 int sel = Boolean. valueOf(selected).compareTo(other.selected);119 int sel = Boolean.compare(selected, other.selected); 120 120 if (sel != 0) 121 121 return sel; 122 122 123 int ds = Boolean. valueOf(inDataSet).compareTo(other.inDataSet);123 int ds = Boolean.compare(inDataSet, other.inDataSet); 124 124 if (ds != 0) 125 125 return ds; 126 126 127 int std = Boolean. valueOf(inStandard).compareTo(other.inStandard);127 int std = Boolean.compare(inStandard, other.inStandard); 128 128 if (std != 0) 129 129 return std; -
trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
r8929 r10228 67 67 case "n": 68 68 case "north": 69 return Math.toRadians(0);69 return 0; // 0 degree => 0 radian 70 70 case "ne": 71 71 case "northeast": … … 79 79 case "s": 80 80 case "south": 81 return Math. toRadians(180);81 return Math.PI; // 180 degree 82 82 case "sw": 83 83 case "southwest": -
trunk/src/org/openstreetmap/josm/io/AllFormatsImporter.java
r8510 r10228 41 41 } 42 42 // remove last comma 43 return ext.substring(0, ext.length()-1) .toString();43 return ext.substring(0, ext.length()-1); 44 44 } 45 45 }
Note:
See TracChangeset
for help on using the changeset viewer.