Changeset 2255 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2009-10-07T21:25:15+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 4 edited
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); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r2252 r2255 118 118 */ 119 119 public ConflictDialog() { 120 super(tr("Conflict"), "conflict", tr(" Mergingconflicts."),120 super(tr("Conflict"), "conflict", tr("Resolve conflicts."), 121 121 Shortcut.registerShortcut("subwindow:conflict", tr("Toggle: {0}", tr("Conflict")), KeyEvent.VK_C, Shortcut.GROUP_LAYER), 100); 122 122 … … 144 144 return; 145 145 int row = selectedRows[0]; 146 Conflict c = conflicts.get(row); 146 Conflict<?> c = conflicts.get(row); 147 147 OsmPrimitive my = c.getMy(); 148 148 OsmPrimitive their = c.getTheir(); … … 262 262 } 263 263 264 @Override 265 public String helpTopic() { 266 return "Dialogs/ConflictListDialog"; 267 } 268 264 269 /** 265 270 * The {@see ListModel} for conflicts … … 328 333 putValue(SHORT_DESCRIPTION, tr("Open a merge dialog of all selected items in the list above.")); 329 334 putValue(SMALL_ICON, ImageProvider.get("dialogs", "conflict")); 335 putValue("help", "Dialogs/ConflictListDialog#ResolveAction"); 330 336 } 331 337 … … 347 353 putValue(SHORT_DESCRIPTION, tr("Set the selected elements on the map to the selected items in the list above.")); 348 354 putValue(SMALL_ICON, ImageProvider.get("dialogs", "select")); 355 putValue("help", "Dialogs/ConflictListDialog#SelectAction"); 349 356 } 350 357 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r2252 r2255 12 12 import java.awt.event.ActionEvent; 13 13 import java.awt.event.ActionListener; 14 import java.awt.event.ComponentAdapter;15 import java.awt.event.ComponentEvent;16 14 import java.awt.event.MouseAdapter; 17 15 import java.awt.event.MouseEvent; 18 16 import java.awt.event.WindowAdapter; 19 17 import java.awt.event.WindowEvent; 20 import java.util.logging.Logger;21 18 22 19 import javax.swing.AbstractAction; 23 20 import javax.swing.BorderFactory; 24 import javax.swing.Box;25 21 import javax.swing.ImageIcon; 26 22 import javax.swing.JButton; … … 34 30 import org.openstreetmap.josm.actions.JosmAction; 35 31 import org.openstreetmap.josm.gui.dialogs.DialogsPanel.Action; 32 import org.openstreetmap.josm.gui.help.HelpBuilder; 36 33 import org.openstreetmap.josm.gui.help.Helpful; 37 34 import org.openstreetmap.josm.tools.GBC; … … 348 345 * 349 346 */ 350 private class DetachedDialog extends JDialog 347 private class DetachedDialog extends JDialog{ 351 348 public DetachedDialog() { 352 349 super(JOptionPane.getFrameForComponent(Main.parent)); … … 362 359 } 363 360 }); 361 addMouseListener( 362 new MouseAdapter() { 363 @Override 364 public void mouseEntered(MouseEvent e) { 365 super.mouseEntered(e); 366 System.out.println("requesting focus ..."); 367 requestFocusInWindow(); 368 } 369 } 370 ); 371 364 372 String bounds = Main.pref.get(preferencePrefix+".bounds",null); 365 373 if (bounds != null) { … … 373 381 } 374 382 setTitle(titleBar.getTitle()); 383 HelpBuilder.setHelpContext(getRootPane(), helpTopic()); 375 384 } 376 385
Note:
See TracChangeset
for help on using the changeset viewer.