Changeset 5775 in josm for trunk/src/org
- Timestamp:
- 2013-03-13T21:52:18+01:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r5416 r5775 5 5 import static org.openstreetmap.josm.tools.I18n.marktr; 6 6 import static org.openstreetmap.josm.tools.I18n.tr; 7 import static org.openstreetmap.josm.tools.I18n.trn; 7 8 8 9 import java.awt.Color; … … 23 24 import javax.swing.AbstractAction; 24 25 import javax.swing.JList; 26 import javax.swing.JOptionPane; 25 27 import javax.swing.ListModel; 26 28 import javax.swing.ListSelectionModel; … … 43 45 import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor; 44 46 import org.openstreetmap.josm.data.osm.visitor.Visitor; 47 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 45 48 import org.openstreetmap.josm.gui.MapView; 46 49 import org.openstreetmap.josm.gui.NavigatableComponent; 47 50 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 48 51 import org.openstreetmap.josm.gui.SideButton; 52 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 49 53 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 50 54 import org.openstreetmap.josm.gui.util.GuiHelper; … … 407 411 } 408 412 } 409 413 414 /** 415 * Warns the user about the number of detected conflicts 416 * 417 * @param numNewConflicts the number of detected conflicts 418 * @since 5775 419 */ 420 public void warnNumNewConflicts(int numNewConflicts) { 421 if (numNewConflicts == 0) return; 422 423 String msg1 = trn( 424 "There was {0} conflict detected.", 425 "There were {0} conflicts detected.", 426 numNewConflicts, 427 numNewConflicts 428 ); 429 430 final StringBuffer sb = new StringBuffer(); 431 sb.append("<html>").append(msg1).append("</html>"); 432 if (numNewConflicts > 0) { 433 final ButtonSpec[] options = new ButtonSpec[] { 434 new ButtonSpec( 435 tr("OK"), 436 ImageProvider.get("ok"), 437 tr("Click to close this dialog and continue editing"), 438 null /* no specific help */ 439 ) 440 }; 441 GuiHelper.runInEDT(new Runnable() { 442 @Override 443 public void run() { 444 HelpAwareOptionPane.showOptionDialog( 445 Main.parent, 446 sb.toString(), 447 tr("Conflicts detected"), 448 JOptionPane.WARNING_MESSAGE, 449 null, /* no icon */ 450 options, 451 options[0], 452 ht("/Concepts/Conflict#WarningAboutDetectedConflicts") 453 ); 454 unfurlDialog(); 455 Main.map.repaint(); 456 } 457 }); 458 } 459 } 410 460 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r5758 r5775 74 74 import org.openstreetmap.josm.data.validation.TestError; 75 75 import org.openstreetmap.josm.gui.ExtendedDialog; 76 import org.openstreetmap.josm.gui.HelpAwareOptionPane;77 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;78 76 import org.openstreetmap.josm.gui.MapView; 79 77 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 81 79 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; 82 80 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 83 import org.openstreetmap.josm.gui.util.GuiHelper;84 81 import org.openstreetmap.josm.tools.DateUtils; 85 82 import org.openstreetmap.josm.tools.FilteredCollection; … … 410 407 Main.map.mapView.repaint(); 411 408 } 412 warnNumNewConflicts(numNewConflicts); 413 } 414 415 /** 416 * Warns the user about the number of detected conflicts 417 * 418 * @param numNewConflicts the number of detected conflicts 419 */ 420 protected void warnNumNewConflicts(int numNewConflicts) { 421 if (numNewConflicts == 0) return; 422 423 String msg1 = trn( 424 "There was {0} conflict detected.", 425 "There were {0} conflicts detected.", 426 numNewConflicts, 427 numNewConflicts 428 ); 429 430 final StringBuffer sb = new StringBuffer(); 431 sb.append("<html>").append(msg1).append("</html>"); 432 if (numNewConflicts > 0) { 433 final ButtonSpec[] options = new ButtonSpec[] { 434 new ButtonSpec( 435 tr("OK"), 436 ImageProvider.get("ok"), 437 tr("Click to close this dialog and continue editing"), 438 null /* no specific help */ 439 ) 440 }; 441 GuiHelper.runInEDT(new Runnable() { 442 @Override 443 public void run() { 444 HelpAwareOptionPane.showOptionDialog( 445 Main.parent, 446 sb.toString(), 447 tr("Conflicts detected"), 448 JOptionPane.WARNING_MESSAGE, 449 null, /* no icon */ 450 options, 451 options[0], 452 ht("/Concepts/Conflict#WarningAboutDetectedConflicts") 453 ); 454 Main.map.conflictDialog.unfurlDialog(); 455 Main.map.repaint(); 456 } 457 }); 458 } 459 } 460 409 Main.map.conflictDialog.warnNumNewConflicts(numNewConflicts); 410 } 461 411 462 412 @Override public boolean isMergable(final Layer other) {
Note:
See TracChangeset
for help on using the changeset viewer.