Changeset 10217 in josm for trunk/src/org
- Timestamp:
- 2016-05-15T16:37:33+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r10212 r10217 278 278 } 279 279 return; 280 281 280 case "osm-server.url": 282 281 String newUrl = null; … … 290 289 } 291 290 break; 292 293 291 case "oauth.access-token.key": 294 292 accessTokenKeyChanged = true; 295 293 break; 296 297 294 case "oauth.access-token.secret": 298 295 accessTokenSecretChanged = true; 299 296 break; 297 default: // Do nothing 300 298 } 301 299 -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r10212 r10217 255 255 int c; 256 256 while ((c = g.getopt()) != -1) { 257 Option opt = null;257 Option opt; 258 258 switch (c) { 259 259 case 'h': … … 266 266 opt = Option.values()[g.getLongind()]; 267 267 break; 268 default: 269 opt = null; 268 270 } 269 271 if (opt != null) { -
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r10152 r10217 92 92 nc.zoomTo(new EastNorth(center.east(), newcenter.north())); 93 93 break; 94 default: // Do nothing 94 95 } 95 96 } -
trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java
r9078 r10217 167 167 deltaX *= -1; 168 168 break; 169 default: // Do nothing 169 170 } 170 171 -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java
r10152 r10217 265 265 } 266 266 break; 267 default: 268 throw new IllegalStateException(Integer.toString(directionX)); 267 269 } 268 270 … … 288 290 } 289 291 break; 292 default: 293 throw new IllegalStateException(Integer.toString(directionY)); 290 294 } 291 295 -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r10179 r10217 325 325 } 326 326 327 /** 328 * Returns conflict resolution. 329 * @return conflict resolution 330 */ 327 331 public TagCollection getResolution() { 328 332 return allPrimitivesResolver.getModel().getResolution(); … … 351 355 352 356 static final class StatisticsInfo { 353 publicint numTags;354 publicfinal Map<OsmPrimitiveType, Integer> sourceInfo;355 publicfinal Map<OsmPrimitiveType, Integer> targetInfo;357 int numTags; 358 final Map<OsmPrimitiveType, Integer> sourceInfo; 359 final Map<OsmPrimitiveType, Integer> targetInfo; 356 360 357 361 StatisticsInfo() { … … 385 389 } 386 390 387 publicvoid reset() {391 void reset() { 388 392 data.clear(); 389 393 } 390 394 391 publicvoid append(StatisticsInfo info) {395 void append(StatisticsInfo info) { 392 396 data.add(info); 393 397 fireTableDataChanged(); … … 396 400 397 401 static final class StatisticsInfoRenderer extends JLabel implements TableCellRenderer { 398 pr otectedvoid reset() {402 private void reset() { 399 403 setIcon(null); 400 404 setText(""); … … 402 406 } 403 407 404 pr otectedvoid renderNumTags(StatisticsInfo info) {408 private void renderNumTags(StatisticsInfo info) { 405 409 if (info == null) return; 406 410 setText(trn("{0} tag", "{0} tags", info.numTags, info.numTags)); 407 411 } 408 412 409 pr otectedvoid renderStatistics(Map<OsmPrimitiveType, Integer> stat) {413 private void renderStatistics(Map<OsmPrimitiveType, Integer> stat) { 410 414 if (stat == null) return; 411 415 if (stat.isEmpty()) return; … … 422 426 continue; 423 427 } 424 String msg = "";428 String msg; 425 429 switch(type) { 426 430 case NODE: msg = trn("{0} node", "{0} nodes", numPrimitives, numPrimitives); break; 427 431 case WAY: msg = trn("{0} way", "{0} ways", numPrimitives, numPrimitives); break; 428 432 case RELATION: msg = trn("{0} relation", "{0} relations", numPrimitives, numPrimitives); break; 433 default: throw new AssertionError(); 429 434 } 430 435 if (text.length() > 0) { … … 436 441 } 437 442 438 pr otectedvoid renderFrom(StatisticsInfo info) {443 private void renderFrom(StatisticsInfo info) { 439 444 renderStatistics(info.sourceInfo); 440 445 } 441 446 442 pr otectedvoid renderTo(StatisticsInfo info) {447 private void renderTo(StatisticsInfo info) { 443 448 renderStatistics(info.targetInfo); 444 449 } … … 461 466 case 1: renderFrom(info); break; 462 467 case 2: renderTo(info); break; 468 default: // Do nothing 463 469 } 464 470 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java
r9192 r10217 132 132 refresh(); 133 133 break; 134 default: // Do nothing 134 135 } 135 136 fireTableDataChanged(); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java
r9078 r10217 181 181 decision.sumAllNumeric(); 182 182 break; 183 default: // Do nothing 183 184 } 184 185 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java
r9348 r10217 315 315 updateFilters(); 316 316 break; 317 default: // Do nothing 317 318 } 318 319 if (column != 0) { … … 346 347 case in_selection: /* filter mode: in selection */ 347 348 return trc("filter", "F"); 348 } 349 default: 350 Main.warn("Unknown filter mode: " + f.mode); 351 } 352 break; 353 default: // Do nothing 349 354 } 350 355 return null; … … 406 411 } 407 412 413 /** 414 * Returns the list of filters. 415 * @return the list of filters 416 */ 408 417 public List<Filter> getFilters() { 409 418 return filters; -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r9376 r10217 512 512 case WAY: numWays++; break; 513 513 case RELATION: numRelations++; break; 514 default: throw new AssertionError(); 514 515 } 515 516 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java
r8510 r10217 60 60 case 5: /* closed at */ renderDate(cs.getClosedAt()); break; 61 61 case 6: /* discussions */ renderDiscussions(cs); break; 62 default: // Do nothing 62 63 } 63 64 return this; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDiscussionTableCellRenderer.java
r8510 r10217 38 38 reset(comp, false); 39 39 renderColors(comp, isSelected); 40 break; 41 default: // Do nothing 40 42 } 41 43 return comp; -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r10132 r10217 1090 1090 switch (PROPERTY_REFRESH_RECENT.get()) { 1091 1091 case REFRESH: cacheRecentTags(); // break missing intentionally 1092 case STATUS: suggestRecentlyAddedTags(); 1092 case STATUS: suggestRecentlyAddedTags(); break; 1093 default: // Do nothing 1093 1094 } 1094 1095 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r10113 r10217 820 820 memberTableModel.removeMembersReferringTo(toCheck); 821 821 break; 822 default: // Do nothing 822 823 } 823 824 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java
r9223 r10217 157 157 158 158 /* special icons */ 159 Image arrow = null;159 Image arrow; 160 160 switch (value.direction) { 161 161 case FORWARD: … … 165 165 arrow = arrowUp; 166 166 break; 167 default: 168 arrow = null; 167 169 } 168 170 if (value.direction == Direction.ROUNDABOUT_LEFT) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java
r10001 r10217 266 266 refNodes = wayRef.getNodes(); 267 267 break; 268 default: // Do nothing 268 269 } 269 270 -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r10212 r10217 582 582 } 583 583 break; 584 default: // Do nothing 584 585 } 585 586 setToolTipText(lineWrapDescription(sr.description)); -
trunk/src/org/openstreetmap/josm/gui/history/TagTableCellRenderer.java
r9450 r10217 67 67 setBackgroundReadable(key, model, isSelected, true); 68 68 break; 69 default: // Do nothing 69 70 } 70 71 -
trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java
r9917 r10217 38 38 39 39 public abstract class AbstractUploadTask extends PleaseWaitRunnable { 40 41 /** 42 * Constructs a new {@code AbstractUploadTask}. 43 * @param title message for the user 44 * @param ignoreException If true, exception will be silently ignored. If false then 45 * exception will be handled by showing a dialog. When this runnable is executed using executor framework 46 * then use false unless you read result of task (because exception will get lost if you don't) 47 */ 40 48 public AbstractUploadTask(String title, boolean ignoreException) { 41 49 super(title, ignoreException); 42 50 } 43 51 52 /** 53 * Constructs a new {@code AbstractUploadTask}. 54 * @param title message for the user 55 * @param progressMonitor progress monitor 56 * @param ignoreException If true, exception will be silently ignored. If false then 57 * exception will be handled by showing a dialog. When this runnable is executed using executor framework 58 * then use false unless you read result of task (because exception will get lost if you don't) 59 */ 44 60 public AbstractUploadTask(String title, ProgressMonitor progressMonitor, boolean ignoreException) { 45 61 super(title, progressMonitor, ignoreException); 46 62 } 47 63 64 /** 65 * Constructs a new {@code AbstractUploadTask}. 66 * @param title message for the user 67 */ 48 68 public AbstractUploadTask(String title) { 49 69 super(title); … … 93 113 protected void handleUploadConflictForKnownConflict(final OsmPrimitiveType primitiveType, final long id, String serverVersion, 94 114 String myVersion) { 95 String lbl = "";115 String lbl; 96 116 switch(primitiveType) { 97 117 case NODE: lbl = tr("Synchronize node {0} only", id); break; 98 118 case WAY: lbl = tr("Synchronize way {0} only", id); break; 99 119 case RELATION: lbl = tr("Synchronize relation {0} only", id); break; 120 default: throw new AssertionError(); 100 121 } 101 122 ButtonSpec[] spec = new ButtonSpec[] { -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
r9514 r10217 48 48 */ 49 49 public class ChangesetManagementPanel extends JPanel implements ListDataListener { 50 publicstatic final String SELECTED_CHANGESET_PROP = ChangesetManagementPanel.class.getName() + ".selectedChangeset";51 publicstatic final String CLOSE_CHANGESET_AFTER_UPLOAD = ChangesetManagementPanel.class.getName() + ".closeChangesetAfterUpload";50 static final String SELECTED_CHANGESET_PROP = ChangesetManagementPanel.class.getName() + ".selectedChangeset"; 51 static final String CLOSE_CHANGESET_AFTER_UPLOAD = ChangesetManagementPanel.class.getName() + ".closeChangesetAfterUpload"; 52 52 53 53 private JRadioButton rbUseNew; … … 56 56 private JCheckBox cbCloseAfterUpload; 57 57 private OpenChangesetComboBoxModel model; 58 private final transient ChangesetCommentModel changesetCommentModel; 58 59 /** 60 * Constructs a new {@code ChangesetManagementPanel}. 61 * 62 * @param changesetCommentModel the changeset comment model. Must not be null. 63 * @throws IllegalArgumentException if {@code changesetCommentModel} is null 64 */ 65 public ChangesetManagementPanel(ChangesetCommentModel changesetCommentModel) { 66 CheckParameterUtil.ensureParameterNotNull(changesetCommentModel, "changesetCommentModel"); 67 build(); 68 refreshGUI(); 69 } 59 70 60 71 /** … … 159 170 } 160 171 161 /**162 * Creates a new panel163 *164 * @param changesetCommentModel the changeset comment model. Must not be null.165 * @throws IllegalArgumentException if {@code changesetCommentModel} is null166 */167 public ChangesetManagementPanel(ChangesetCommentModel changesetCommentModel) {168 CheckParameterUtil.ensureParameterNotNull(changesetCommentModel, "changesetCommentModel");169 this.changesetCommentModel = changesetCommentModel;170 build();171 refreshGUI();172 }173 174 172 protected void refreshGUI() { 175 173 rbExisting.setEnabled(model.getSize() > 0); 176 if (model.getSize() == 0) { 177 if (!rbUseNew.isSelected()) { 178 rbUseNew.setSelected(true); 179 } 174 if (model.getSize() == 0 && !rbUseNew.isSelected()) { 175 rbUseNew.setSelected(true); 180 176 } 181 177 cbOpenChangesets.setEnabled(model.getSize() > 0 && rbExisting.isSelected()); … … 235 231 236 232 /** 237 * Listens to changes in the selected changeset and fires property 238 * change events. 239 * 233 * Listens to changes in the selected changeset and fires property change events. 240 234 */ 241 235 class ChangesetListItemStateListener implements ItemListener { … … 251 245 252 246 /** 253 * Listens to changes in "close after upload" flag and fires 254 * property change events. 255 * 247 * Listens to changes in "close after upload" flag and fires property change events. 256 248 */ 257 249 class CloseAfterUploadItemStateListener implements ItemListener { … … 269 261 Main.pref.put("upload.changeset.close", false); 270 262 break; 263 default: // Do nothing 271 264 } 272 265 } … … 275 268 /** 276 269 * Listens to changes in the two radio buttons rbUseNew and rbUseExisting. 277 *278 270 */ 279 271 class RadioButtonHandler implements ItemListener { -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersModel.java
r9751 r10217 116 116 info.setDoSaveToFile(values[1]); 117 117 break; 118 default: // Do nothing 118 119 } 119 120 fireTableDataChanged(); -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r10179 r10217 255 255 public UploadStrategySpecification getUploadStrategySpecification() { 256 256 UploadStrategy strategy = getUploadStrategy(); 257 int chunkSize = getChunkSize();258 257 UploadStrategySpecification spec = new UploadStrategySpecification(); 259 258 if (strategy != null) { 260 259 switch(strategy) { 260 case CHUNKED_DATASET_STRATEGY: 261 spec.setStrategy(strategy).setChunkSize(getChunkSize()); 262 break; 261 263 case INDIVIDUAL_OBJECTS_STRATEGY: 262 264 case SINGLE_REQUEST_STRATEGY: 265 default: 263 266 spec.setStrategy(strategy); 264 break;265 case CHUNKED_DATASET_STRATEGY:266 spec.setStrategy(strategy).setChunkSize(chunkSize);267 267 break; 268 268 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r10212 r10217 358 358 } 359 359 break; 360 default: // Do nothing 360 361 } 361 362 if (!noDraw && (maxLineLength == -1 || dist <= maxLineLength)) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java
r9371 r10217 120 120 public static BoxTextElement create(Environment env, BoxProvider boxProvider, Rectangle box) { 121 121 initDefaultParameters(); 122 Cascade c = env.mc.getCascade(env.layer);123 122 124 123 TextLabel text = TextLabel.create(env, DEFAULT_TEXT_COLOR, false); … … 129 128 if (text.labelCompositionStrategy.compose(env.osm) == null) return null; 130 129 131 HorizontalTextAlignment hAlign = HorizontalTextAlignment.RIGHT; 132 Keyword hAlignKW = c.get(TEXT_ANCHOR_HORIZONTAL, Keyword.RIGHT, Keyword.class); 133 switch (hAlignKW.val) { 130 Cascade c = env.mc.getCascade(env.layer); 131 132 HorizontalTextAlignment hAlign; 133 switch (c.get(TEXT_ANCHOR_HORIZONTAL, Keyword.RIGHT, Keyword.class).val) { 134 134 case "left": 135 135 hAlign = HorizontalTextAlignment.LEFT; … … 137 137 case "center": 138 138 hAlign = HorizontalTextAlignment.CENTER; 139 }140 VerticalTextAlignment vAlign = VerticalTextAlignment.BOTTOM;141 Keyword vAlignKW = c.get(TEXT_ANCHOR_VERTICAL, Keyword.BOTTOM, Keyword.class);142 switch (vAlignKW.val) {143 case "bottom":144 vAlign = VerticalTextAlignment.BOTTOM;145 break;139 break; 140 case "right": 141 default: 142 hAlign = HorizontalTextAlignment.RIGHT; 143 } 144 VerticalTextAlignment vAlign; 145 switch (c.get(TEXT_ANCHOR_VERTICAL, Keyword.BOTTOM, Keyword.class).val) { 146 146 case "above": 147 147 vAlign = VerticalTextAlignment.ABOVE; … … 155 155 case "below": 156 156 vAlign = VerticalTextAlignment.BELOW; 157 break; 158 case "bottom": 159 default: 160 vAlign = VerticalTextAlignment.BOTTOM; 157 161 } 158 162 -
trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java
r10183 r10217 55 55 private String apiUrl; 56 56 57 /** 58 * Constructs a new {@code AdvancedOAuthPropertiesPanel}. 59 */ 60 public AdvancedOAuthPropertiesPanel() { 61 build(); 62 } 63 57 64 protected final void build() { 58 65 setLayout(new GridBagLayout()); … … 111 118 SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenURL); 112 119 113 114 120 // -- authorise URL 115 121 gc.gridy = 5; … … 123 129 SelectAllOnFocusGainedDecorator.decorate(tfAuthoriseURL); 124 130 125 126 131 // -- OSM login URL 127 132 gc.gridy = 6; … … 134 139 add(tfOsmLoginURL, gc); 135 140 SelectAllOnFocusGainedDecorator.decorate(tfOsmLoginURL); 136 137 141 138 142 // -- OSM logout URL … … 250 254 251 255 /** 252 * Constructs a new {@code AdvancedOAuthPropertiesPanel}.253 */254 public AdvancedOAuthPropertiesPanel() {255 build();256 }257 258 /**259 256 * Initializes the panel from the values in the preferences <code>preferences</code>. 260 257 * … … 308 305 setChildComponentsEnabled(true); 309 306 break; 307 default: // Do nothing 310 308 } 311 309 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r10043 r10217 357 357 colorDynamic.setEnabled(false); 358 358 } else { 359 switch(Main.pref.getInteger("draw.rawgps.colors", layerName, 0)) { 359 int colorType = Main.pref.getInteger("draw.rawgps.colors", layerName, 0); 360 switch (colorType) { 360 361 case 0: colorTypeNone.setSelected(true); break; 361 362 case 1: colorTypeVelocity.setSelected(true); break; … … 363 364 case 3: colorTypeDirection.setSelected(true); break; 364 365 case 4: colorTypeTime.setSelected(true); break; 366 default: Main.warn("Unknown color type: " + colorType); 365 367 } 366 368 int ccts = Main.pref.getInteger("draw.rawgps.colorTracksTune", layerName, 45); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r10212 r10217 144 144 String oldUrl = OsmApi.getOsmApi().getServerUrl(); 145 145 String hmiUrl = getStrippedApiUrl(); 146 if (cbUseDefaultServerUrl.isSelected()) { 147 Main.pref.put("osm-server.url", null); 148 } else if (OsmApi.DEFAULT_API_URL.equals(hmiUrl)) { 146 if (cbUseDefaultServerUrl.isSelected() || OsmApi.DEFAULT_API_URL.equals(hmiUrl)) { 149 147 Main.pref.put("osm-server.url", null); 150 148 } else { … … 300 298 propagator.propagate(); 301 299 break; 300 default: // Do nothing 302 301 } 303 302 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r9816 r10217 80 80 } 81 81 82 /** 83 * Adds property change listener. 84 * @param listener property change listener to add 85 */ 82 86 public void addPropertyChangeListener(PropertyChangeListener listener) { 83 87 propChangeSupport.addPropertyChangeListener(listener); … … 102 106 } 103 107 108 /** 109 * Removes property change listener. 110 * @param listener property change listener to remove 111 */ 104 112 public void removePropertyChangeListener(PropertyChangeListener listener) { 105 113 propChangeSupport.removePropertyChangeListener(listener); … … 146 154 case 1: 147 155 String v = (String) value; 148 if (tag.getValueCount() > 1 && !v.isEmpty()) { 149 updateTagValue(tag, v); 150 } else if (tag.getValueCount() <= 1) { 156 if ((tag.getValueCount() > 1 && !v.isEmpty()) || tag.getValueCount() <= 1) { 151 157 updateTagValue(tag, v); 152 158 } 159 break; 160 default: // Do nothing 153 161 } 154 162 } … … 653 661 } 654 662 655 publicvoid apply() {663 void apply() { 656 664 rowSelectionModel.setValueIsAdjusting(true); 657 665 colSelectionModel.setValueIsAdjusting(true); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r10082 r10217 210 210 deleteTags(); 211 211 break; 212 default: // Do nothing 212 213 } 213 214 214 215 if (isEditing()) { 215 CellEditor editor = getCellEditor();216 if ( editor != null) {217 editor.cancelCellEditing();216 CellEditor cEditor = getCellEditor(); 217 if (cEditor != null) { 218 cEditor.cancelCellEditing(); 218 219 } 219 220 } … … 260 261 @Override 261 262 public void actionPerformed(ActionEvent e) { 262 CellEditor editor = getCellEditor();263 if ( editor != null) {264 getCellEditor().stopCellEditing();263 CellEditor cEditor = getCellEditor(); 264 if (cEditor != null) { 265 cEditor.stopCellEditing(); 265 266 } 266 267 final int rowIdx = model.getRowCount()-1; … … 599 600 return; 600 601 else if (c instanceof Window) { 601 if (c == SwingUtilities.getRoot(TagTable.this)) { 602 if (!getCellEditor().stopCellEditing()) { 603 getCellEditor().cancelCellEditing(); 604 } 602 if (c == SwingUtilities.getRoot(TagTable.this) && !getCellEditor().stopCellEditing()) { 603 getCellEditor().cancelCellEditing(); 605 604 } 606 605 break; -
trunk/src/org/openstreetmap/josm/gui/util/AdjustmentSynchronizer.java
r10210 r10217 139 139 } 140 140 break; 141 default: // Do nothing 141 142 } 142 143 } -
trunk/src/org/openstreetmap/josm/gui/widgets/SearchTextResultListPanel.java
r9390 r10217 33 33 protected abstract void filterItems(); 34 34 35 /** 36 * Constructs a new {@code SearchTextResultListPanel}. 37 */ 35 38 public SearchTextResultListPanel() { 36 39 super(new BorderLayout()); … … 75 78 selectItem(lsResultModel.getSize()); 76 79 break; 80 default: // Do nothing 77 81 } 78 82 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r10216 r10217 311 311 */ 312 312 protected void fetchPrimitives(Set<Long> ids, OsmPrimitiveType type, ProgressMonitor progressMonitor) throws OsmTransferException { 313 String msg = "";313 String msg; 314 314 final String baseUrl = getBaseUrl(); 315 315 switch (type) { … … 317 317 case WAY: msg = tr("Fetching a package of ways from ''{0}''", baseUrl); break; 318 318 case RELATION: msg = tr("Fetching a package of relations from ''{0}''", baseUrl); break; 319 default: throw new AssertionError(); 319 320 } 320 321 progressMonitor.setTicksCount(ids.size()); -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r10216 r10217 39 39 40 40 private static volatile List<OsmServerWritePostprocessor> postprocessors; 41 42 /** 43 * Registers a post-processor. 44 * @param pp post-processor to register 45 */ 41 46 public static void registerPostprocessor(OsmServerWritePostprocessor pp) { 42 47 if (postprocessors == null) { … … 46 51 } 47 52 53 /** 54 * Unregisters a post-processor. 55 * @param pp post-processor to unregister 56 */ 48 57 public static void unregisterPostprocessor(OsmServerWritePostprocessor pp) { 49 58 if (postprocessors != null) { … … 61 70 private long uploadStartTime; 62 71 63 p ublicString timeLeft(int progress, int listSize) {72 protected String timeLeft(int progress, int listSize) { 64 73 long now = System.currentTimeMillis(); 65 74 long elapsed = now - uploadStartTime; … … 93 102 uploadStartTime = System.currentTimeMillis(); 94 103 for (OsmPrimitive osm : primitives) { 95 int progress = progressMonitor.getTicks(); 96 String timeLeftStr = timeLeft(progress, primitives.size()); 97 String msg = ""; 104 String msg; 98 105 switch(OsmPrimitiveType.from(osm)) { 99 106 case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break; 100 107 case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break; 101 108 case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break; 109 default: throw new AssertionError(); 102 110 } 111 int progress = progressMonitor.getTicks(); 103 112 progressMonitor.subTask( 104 113 tr(msg, … … 106 115 progress, 107 116 primitives.size(), 108 timeLeftStr, 109 osm.getName() == null ? osm.getId() : osm.getName(), 110 osm.getId())); 117 timeLeft(progress, primitives.size()), 118 osm.getName() == null ? osm.getId() : osm.getName(), osm.getId())); 111 119 makeApiRequest(osm, progressMonitor); 112 120 processed.add(osm); … … 134 142 progressMonitor.beginTask(tr("Starting to upload in one request ...")); 135 143 processed.addAll(api.uploadDiff(primitives, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false))); 136 } catch (OsmTransferException e) {137 throw e;138 144 } finally { 139 145 progressMonitor.finishTask(); … … 151 157 */ 152 158 protected void uploadChangesInChunks(Collection<? extends OsmPrimitive> primitives, ProgressMonitor progressMonitor, int chunkSize) 153 throws OsmTransferException , IllegalArgumentException{159 throws OsmTransferException { 154 160 if (chunkSize <= 0) 155 161 throw new IllegalArgumentException(tr("Value >0 expected for parameter ''{0}'', got {1}", "chunkSize", chunkSize)); … … 176 182 processed.addAll(api.uploadDiff(chunk, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false))); 177 183 } 178 } catch (OsmTransferException e) {179 throw e;180 184 } finally { 181 185 progressMonitor.finishTask(); … … 223 227 break; 224 228 } 225 } catch (OsmTransferException e) {226 throw e;227 229 } finally { 228 230 executePostprocessors(monitor); … … 242 244 } 243 245 246 /** 247 * Cancel operation. 248 */ 244 249 public void cancel() { 245 250 this.canceled = true; -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r10216 r10217 54 54 } 55 55 56 /** 57 * Constructs a {@code ImageryReader} from a given filename, URL or internal resource. 58 * 59 * @param source can be:<ul> 60 * <li>relative or absolute file name</li> 61 * <li>{@code file:///SOME/FILE} the same as above</li> 62 * <li>{@code http://...} a URL. It will be cached on disk.</li> 63 * <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li> 64 * <li>{@code josmdir://SOME/FILE} file inside josm user data directory (since r7058)</li> 65 * <li>{@code josmplugindir://SOME/FILE} file inside josm plugin directory (since r7834)</li></ul> 66 */ 56 67 public ImageryReader(String source) { 57 68 this.source = source; 58 69 } 59 70 71 /** 72 * Parses imagery source. 73 * @return list of imagery info 74 * @throws SAXException if any SAX error occurs 75 * @throws IOException if any I/O error occurs 76 */ 60 77 public List<ImageryInfo> parse() throws SAXException, IOException { 61 78 Parser parser = new Parser(); … … 328 345 } 329 346 break; 347 default: // Do nothing 330 348 } 331 349 } … … 456 474 projections = null; 457 475 break; 458 /* nothing to do for these or the unknown type:459 476 case NO_TILE: 460 477 case NO_TILESUM: 461 478 case METADATA: 462 479 case UNKNOWN: 463 break;464 */480 default: 481 // nothing to do for these or the unknown type 465 482 } 466 483 }
Note:
See TracChangeset
for help on using the changeset viewer.