Changeset 2255 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2009-10-07T21:25:15+02:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
-
UploadAction.java (modified) (6 diffs)
-
UploadSelectionAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r2253 r2255 35 35 import org.openstreetmap.josm.gui.DefaultNameFormatter; 36 36 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 37 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 37 38 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 39 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 38 40 import org.openstreetmap.josm.gui.help.HelpBrowser; 39 41 import org.openstreetmap.josm.gui.help.HelpBuilder; … … 230 232 */ 231 233 protected void handleUploadConflictForKnownConflict(final OsmPrimitiveType primitiveType, final long id, String serverVersion, String myVersion) { 232 JButton[] options = new JButton[] { 233 new JButton(tr("Synchronize {0} {1} only", tr(primitiveType.getAPIName()), id)), 234 new JButton(tr("Synchronize entire dataset")), 235 new JButton(tr("Cancel")), 236 new JButton(tr("Help")) 234 String lbl = ""; 235 switch(primitiveType) { 236 case NODE: lbl = tr("Synchronize node {0} only", id); break; 237 case WAY: lbl = tr("Synchronize way {0} only", id); break; 238 case RELATION: lbl = tr("Synchronize relation {0} only", id); break; 239 } 240 ButtonSpec[] spec = new ButtonSpec[] { 241 new ButtonSpec( 242 lbl, 243 ImageProvider.get("updatedata"), 244 null, 245 null 246 ), 247 new ButtonSpec( 248 tr("Synchronize entire dataset"), 249 ImageProvider.get("updatedata"), 250 null, 251 null 252 ), 253 new ButtonSpec( 254 tr("Cancel"), 255 ImageProvider.get("cancel"), 256 null, 257 null 258 ) 237 259 }; 238 options[0].setIcon(ImageProvider.get("updatedata"));239 options[1].setIcon(ImageProvider.get("updatedata"));240 options[2].setIcon(ImageProvider.get("cancel"));241 options[3].setIcon(ImageProvider.get("help"));242 260 String msg = tr("<html>Uploading <strong>failed</strong> because the server has a newer version of one<br>" 243 261 + "of your nodes, ways, or relations.<br>" … … 249 267 + "Click <strong>{6}</strong> to abort and continue editing.<br></html>", 250 268 tr(primitiveType.getAPIName()), id, serverVersion, myVersion, 251 options[0].getText(), options[1].getText(), options[2].getText()269 spec[0].text, spec[1].text, spec[2].text 252 270 ); 253 final JOptionPane pane = new JOptionPane( 271 int ret = HelpAwareOptionPane.showOptionDialog( 272 Main.parent, 254 273 msg, 274 tr("Conflicts detected"), 255 275 JOptionPane.ERROR_MESSAGE, 256 JOptionPane.DEFAULT_OPTION,257 276 null, 258 options, 259 options[0] 277 spec, 278 spec[0], 279 "Concepts/Conflict" 260 280 ); 261 final JDialog dialog = new JDialog( 262 JOptionPane.getFrameForComponent(Main.parent), 263 tr("Conflicts detected"), 264 true); 265 options[0].addActionListener( 266 new ActionListener() { 267 public void actionPerformed(ActionEvent e) { 268 dialog.setVisible(false); 269 synchronizePrimitive(primitiveType, id); 270 } 271 } 272 ); 273 options[1].addActionListener( 274 new ActionListener() { 275 public void actionPerformed(ActionEvent e) { 276 dialog.setVisible(false); 277 synchronizeDataSet(); 278 } 279 } 280 ); 281 options[2].addActionListener( 282 new ActionListener() { 283 public void actionPerformed(ActionEvent e) { 284 dialog.setVisible(false); 285 } 286 } 287 ); 288 options[3].addActionListener( 289 new ActionListener() { 290 public void actionPerformed(ActionEvent e) { 291 HelpBrowser b = new HelpBrowser(); 292 b.setUrlForHelpTopic("Help/Concepts/Conflict"); 293 b.setVisible(true); 294 } 295 } 296 ); 297 dialog.setContentPane(pane); 298 dialog.pack(); 299 HelpBuilder.setHelpContext(dialog.getRootPane(), "Concepts/Conflict"); 300 WindowGeometry.centerOnScreen(dialog.getSize()).applySafe(dialog); 301 dialog.setVisible(true); 281 switch(ret) { 282 case 0: synchronizePrimitive(primitiveType, id); break; 283 case 1: synchronizeDataSet(); break; 284 default: return; 285 } 302 286 } 303 287 … … 308 292 */ 309 293 protected void handleUploadConflictForUnknownConflict() { 310 JButton[] options = new JButton[] { 311 new JButton(tr("Synchronize entire dataset")), 312 new JButton(tr("Cancel")), 313 new JButton(tr("Help")) 294 ButtonSpec[] spec = new ButtonSpec[] { 295 new ButtonSpec( 296 tr("Synchronize entire dataset"), 297 ImageProvider.get("updatedata"), 298 null, 299 null 300 ), 301 new ButtonSpec( 302 tr("Cancel"), 303 ImageProvider.get("cancel"), 304 null, 305 null 306 ) 314 307 }; 315 Object defaultOption = options[0];316 308 String msg = tr("<html>Uploading <strong>failed</strong> because the server has a newer version of one<br>" 317 309 + "of your nodes, ways, or relations.<br>" … … 319 311 + "Click <strong>{0}</strong> to synchronize the entire local dataset with the server.<br>" 320 312 + "Click <strong>{1}</strong> to abort and continue editing.<br></html>", 321 options[0].getText(), options[1].getText()313 spec[0].text, spec[1].text 322 314 ); 323 final JOptionPane pane = new JOptionPane( 315 int ret = HelpAwareOptionPane.showOptionDialog( 316 Main.parent, 324 317 msg, 318 tr("Conflicts detected"), 325 319 JOptionPane.ERROR_MESSAGE, 326 JOptionPane.DEFAULT_OPTION,327 320 null, 328 options, 329 options[0] 321 spec, 322 spec[0], 323 "Concepts/Conflict" 330 324 ); 331 final JDialog dialog = new JDialog( 332 JOptionPane.getFrameForComponent(Main.parent), 333 tr("Conflicts detected"), 334 true); 335 336 options[0].addActionListener( 337 new ActionListener() { 338 public void actionPerformed(ActionEvent e) { 339 dialog.setVisible(false); 340 synchronizeDataSet(); 341 } 342 } 343 ); 344 options[1].addActionListener( 345 new ActionListener() { 346 public void actionPerformed(ActionEvent e) { 347 dialog.setVisible(false); 348 } 349 } 350 ); 351 options[2].addActionListener( 352 new ActionListener() { 353 public void actionPerformed(ActionEvent e) { 354 HelpBrowser b = new HelpBrowser(); 355 b.setUrlForHelpTopic("Help/Concepts/Conflict"); 356 b.setVisible(true); 357 } 358 } 359 ); 360 dialog.setContentPane(pane); 361 dialog.pack(); 362 HelpBuilder.setHelpContext(dialog.getRootPane(), "Concepts/Conflict"); 363 WindowGeometry.centerOnScreen(dialog.getSize()).applySafe(dialog); 364 dialog.setVisible(true); 325 if (ret == 0) { 326 synchronizeDataSet(); 327 } 365 328 } 366 329 … … 533 496 } catch (Exception sxe) { 534 497 if (uploadCancelled) { 535 System.out.println("Ignoring exception caught because upload is cancel led. Exception is: " + sxe.toString());498 System.out.println("Ignoring exception caught because upload is canceled. Exception is: " + sxe.toString()); 536 499 return; 537 500 } -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r2253 r2255 46 46 tr("Upload selection"), 47 47 "uploadselection", 48 tr("Upload all changes in the current currentselection to the OSM server."),48 tr("Upload all changes in the current selection to the OSM server."), 49 49 null, /* no shortcut */ 50 50 true);
Note:
See TracChangeset
for help on using the changeset viewer.
