Changeset 16267 in josm
- Timestamp:
- 2020-04-12T11:14:42+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMerger.java
r14214 r16267 41 41 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTable; 42 42 import org.openstreetmap.josm.tools.ImageProvider; 43 import org.openstreetmap.josm.tools.ImageResource;44 43 45 44 /** … … 421 420 abstract static class CopyAction extends AbstractAction implements ListSelectionListener { 422 421 423 protected CopyAction(String iconName, String actionName, String shortDescription) { 424 ImageResource icon = new ImageProvider("dialogs/conflict", iconName).getResource(); 425 if (icon == null) { 426 putValue(Action.NAME, actionName); 427 } else { 428 icon.attachImageIcon(this, true); 429 } 422 protected CopyAction(String iconName, String shortDescription) { 423 new ImageProvider("dialogs/conflict", iconName).getResource().attachImageIcon(this, true); 430 424 putValue(Action.SHORT_DESCRIPTION, shortDescription); 431 425 setEnabled(false); … … 440 434 441 435 CopyStartLeftAction() { 442 super(/* ICON(dialogs/conflict/)*/ "copystartleft", tr("> top"),436 super(/* ICON(dialogs/conflict/)*/ "copystartleft", 443 437 tr("Copy my selected nodes to the start of the merged node list")); 444 438 } … … 462 456 463 457 CopyEndLeftAction() { 464 super(/* ICON(dialogs/conflict/)*/ "copyendleft", tr("> bottom"),458 super(/* ICON(dialogs/conflict/)*/ "copyendleft", 465 459 tr("Copy my selected elements to the end of the list of merged elements.")); 466 460 } … … 484 478 485 479 CopyBeforeCurrentLeftAction() { 486 super(/* ICON(dialogs/conflict/)*/ "copybeforecurrentleft", tr("> before"),480 super(/* ICON(dialogs/conflict/)*/ "copybeforecurrentleft", 487 481 tr("Copy my selected elements before the first selected element in the list of merged elements.")); 488 482 } … … 514 508 515 509 CopyAfterCurrentLeftAction() { 516 super(/* ICON(dialogs/conflict/)*/ "copyaftercurrentleft", tr("> after"),510 super(/* ICON(dialogs/conflict/)*/ "copyaftercurrentleft", 517 511 tr("Copy my selected elements after the first selected element in the list of merged elements.")); 518 512 } … … 540 534 541 535 CopyStartRightAction() { 542 super(/* ICON(dialogs/conflict/)*/ "copystartright", tr("< top"),536 super(/* ICON(dialogs/conflict/)*/ "copystartright", 543 537 tr("Copy their selected element to the start of the list of merged elements.")); 544 538 } … … 558 552 559 553 CopyEndRightAction() { 560 super(/* ICON(dialogs/conflict/)*/ "copyendright", tr("< bottom"),554 super(/* ICON(dialogs/conflict/)*/ "copyendright", 561 555 tr("Copy their selected elements to the end of the list of merged elements.")); 562 556 } … … 576 570 577 571 CopyBeforeCurrentRightAction() { 578 super(/* ICON(dialogs/conflict/)*/ "copybeforecurrentright", tr("< before"),572 super(/* ICON(dialogs/conflict/)*/ "copybeforecurrentright", 579 573 tr("Copy their selected elements before the first selected element in the list of merged elements.")); 580 574 } … … 602 596 603 597 CopyAfterCurrentRightAction() { 604 super(/* ICON(dialogs/conflict/)*/ "copyaftercurrentright", tr("< after"),598 super(/* ICON(dialogs/conflict/)*/ "copyaftercurrentright", 605 599 tr("Copy their selected element after the first selected element in the list of merged elements")); 606 600 } … … 684 678 685 679 MoveUpMergedAction() { 686 ImageResource icon = new ImageProvider("dialogs/conflict", "moveup").getResource(); 687 if (icon == null) { 688 putValue(Action.NAME, tr("Up")); 689 } else { 690 icon.attachImageIcon(this, true); 691 } 680 new ImageProvider("dialogs/conflict", "moveup").getResource().attachImageIcon(this, true); 692 681 putValue(Action.SHORT_DESCRIPTION, tr("Move up the selected entries by one position.")); 693 682 setEnabled(false); … … 717 706 718 707 MoveDownMergedAction() { 719 ImageResource icon = new ImageProvider("dialogs/conflict", "movedown").getResource(); 720 if (icon == null) { 721 putValue(Action.NAME, tr("Down")); 722 } else { 723 icon.attachImageIcon(this, true); 724 } 708 new ImageProvider("dialogs/conflict", "movedown").getResource().attachImageIcon(this, true); 725 709 putValue(Action.SHORT_DESCRIPTION, tr("Move down the selected entries by one position.")); 726 710 setEnabled(false); … … 750 734 751 735 RemoveMergedAction() { 752 ImageResource icon = new ImageProvider("dialogs/conflict", "remove").getResource(); 753 if (icon == null) { 754 putValue(Action.NAME, tr("Remove")); 755 } else { 756 icon.attachImageIcon(this, true); 757 } 736 new ImageProvider("dialogs/conflict", "remove").getResource().attachImageIcon(this, true); 758 737 putValue(Action.SHORT_DESCRIPTION, tr("Remove the selected entries from the list of merged elements.")); 759 738 setEnabled(false); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r15586 r16267 32 32 import org.openstreetmap.josm.tools.GBC; 33 33 import org.openstreetmap.josm.tools.ImageProvider; 34 import org.openstreetmap.josm.tools.ImageResource;35 34 36 35 /** … … 180 179 class KeepMineAction extends AbstractAction implements ListSelectionListener { 181 180 KeepMineAction() { 182 ImageResource icon = new ImageProvider("dialogs/conflict", "tagkeepmine").getResource(); 183 if (icon != null) { 184 icon.attachImageIcon(this, true); 185 putValue(Action.NAME, ""); 186 } else { 187 putValue(Action.NAME, ">"); 188 } 181 new ImageProvider("dialogs/conflict", "tagkeepmine").getResource().attachImageIcon(this, true); 189 182 putValue(Action.SHORT_DESCRIPTION, tr("Keep the selected key/value pairs from the local dataset")); 190 183 setEnabled(false); … … 212 205 class KeepTheirAction extends AbstractAction implements ListSelectionListener { 213 206 KeepTheirAction() { 214 ImageResource icon = new ImageProvider("dialogs/conflict", "tagkeeptheir").getResource(); 215 if (icon != null) { 216 icon.attachImageIcon(this, true); 217 putValue(Action.NAME, ""); 218 } else { 219 putValue(Action.NAME, ">"); 220 } 207 new ImageProvider("dialogs/conflict", "tagkeeptheir").getResource().attachImageIcon(this, true); 221 208 putValue(Action.SHORT_DESCRIPTION, tr("Keep the selected key/value pairs from the server dataset")); 222 209 setEnabled(false); … … 241 228 * Synchronizes scrollbar adjustments between a set of 242 229 * {@link Adjustable}s. Whenever the adjustment of one of 243 * the registerd Adjustables is updated the adjustment of 230 * the registered Adjustables is updated the adjustment of 244 231 * the other registered Adjustables is adjusted too. 245 232 * … … 310 297 311 298 UndecideAction() { 312 ImageResource icon = new ImageProvider("dialogs/conflict", "tagundecide").getResource(); 313 if (icon != null) { 314 icon.attachImageIcon(this, true); 315 putValue(Action.NAME, ""); 316 } else { 317 putValue(Action.NAME, tr("Undecide")); 318 } 299 new ImageProvider("dialogs/conflict", "tagundecide").getResource().attachImageIcon(this, true); 319 300 putValue(SHORT_DESCRIPTION, tr("Mark the selected tags as undecided")); 320 301 setEnabled(false); -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r14470 r16267 55 55 import org.openstreetmap.josm.tools.GBC; 56 56 import org.openstreetmap.josm.tools.ImageProvider; 57 import org.openstreetmap.josm.tools.ImageResource;58 57 import org.openstreetmap.josm.tools.InputMapUtils; 59 58 import org.openstreetmap.josm.tools.Logging; … … 364 363 putValue(NAME, tr("Cancel")); 365 364 putValue(SHORT_DESCRIPTION, tr("Close this dialog and resume editing in JOSM")); 366 ImageResource resource = new ImageProvider("cancel").setOptional(true).getResource(); 367 if (resource != null) { 368 resource.attachImageIcon(this, true); 369 } 365 new ImageProvider("cancel").getResource().attachImageIcon(this, true); 370 366 InputMapUtils.addEscapeAction(getRootPane(), this); 371 367 } … … 401 397 putValue(NAME, tr("Exit now!")); 402 398 putValue(SHORT_DESCRIPTION, tr("Exit JOSM without saving. Unsaved changes are lost.")); 403 attachImageIcon(new ImageProvider("exit"));399 new ImageProvider("exit").getResource().attachImageIcon(this, true); 404 400 break; 405 401 case RESTART: 406 402 putValue(NAME, tr("Restart now!")); 407 403 putValue(SHORT_DESCRIPTION, tr("Restart JOSM without saving. Unsaved changes are lost.")); 408 attachImageIcon(new ImageProvider("restart"));404 new ImageProvider("restart").getResource().attachImageIcon(this, true); 409 405 break; 410 406 case DELETE: 411 407 putValue(NAME, tr("Delete now!")); 412 408 putValue(SHORT_DESCRIPTION, tr("Delete layers without saving. Unsaved changes are lost.")); 413 attachImageIcon(new ImageProvider("dialogs", "delete")); 414 break; 415 } 416 } 417 418 private void attachImageIcon(ImageProvider provider) { 419 ImageResource resource = provider.setOptional(true).getResource(); 420 if (resource != null) { 421 resource.attachImageIcon(this, true); 409 new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this, true); 410 break; 422 411 } 423 412 }
Note:
See TracChangeset
for help on using the changeset viewer.