Changeset 7693 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2014-11-02T01:19:59+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r7692 r7693 12 12 13 13 import javax.swing.Action; 14 import javax.swing.ImageIcon;15 14 import javax.swing.JComboBox; 16 15 import javax.swing.JOptionPane; … … 29 28 import org.openstreetmap.josm.tools.GBC; 30 29 import org.openstreetmap.josm.tools.ImageProvider; 31 import org.openstreetmap.josm.tools.ImageProvider.ImageCallback; 30 import org.openstreetmap.josm.tools.ImageProvider.ImageResourceCallback; 31 import org.openstreetmap.josm.tools.ImageResource; 32 32 33 33 /** … … 52 52 // change toolbar icon from if specified 53 53 try { 54 if (info.getIcon() != null) {55 new ImageProvider(info.getIcon()).setOptional(true).56 setMaxSize(ImageProvider.ImageSizes.SMALLICON).getInBackground(new ImageCallback() {54 String icon = info.getIcon(); 55 if (icon != null) { 56 new ImageProvider(icon).setOptional(true).getInBackground(new ImageResourceCallback() { 57 57 @Override 58 public void finished(final Image Iconresult) {58 public void finished(final ImageResource result) { 59 59 if (result != null) { 60 60 GuiHelper.runInEDT(new Runnable() { 61 61 @Override 62 62 public void run() { 63 putValue(Action.SMALL_ICON, result); 64 } 65 }); 66 } 67 } 68 }); 69 new ImageProvider(info.getIcon()).setOptional(true). 70 setMaxSize(ImageProvider.ImageSizes.LARGEICON).getInBackground(new ImageCallback() { 71 @Override 72 public void finished(final ImageIcon result) { 73 if (result != null) { 74 GuiHelper.runInEDT(new Runnable() { 75 @Override 76 public void run() { 77 putValue(Action.LARGE_ICON_KEY, result); 63 result.getImageIcon(AddImageryLayerAction.this); 78 64 } 79 65 }); -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r7534 r7693 72 72 * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null 73 73 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 74 */ 74 * @deprecated do not pass Icon, pass ImageProvider instead 75 */ 76 @Deprecated 75 77 public JosmAction(String name, Icon icon, String tooltip, Shortcut shortcut, boolean registerInToolbar, String toolbarId, boolean installAdapters) { 76 78 super(name, icon); … … 93 95 94 96 /** 97 * Constructs a {@code JosmAction}. 98 * 99 * @param name the action's text as displayed on the menu (if it is added to a menu) 100 * @param icon the icon to use 101 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 102 * that html is not supported for menu actions on some platforms. 103 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 104 * do want a shortcut, remember you can always register it with group=none, so you 105 * won't be assigned a shortcut unless the user configures one. If you pass null here, 106 * the user CANNOT configure a shortcut for your action. 107 * @param registerInToolbar register this action for the toolbar preferences? 108 * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null 109 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 110 * TODO: do not pass Icon, pass ImageProvider instead 111 */ 112 public JosmAction(String name, ImageProvider icon, String tooltip, Shortcut shortcut, boolean registerInToolbar, String toolbarId, boolean installAdapters) { 113 super(name); 114 if(icon != null) 115 icon.getResource().getImageIcon(this); 116 setHelpId(); 117 sc = shortcut; 118 if (sc != null) { 119 Main.registerActionShortcut(this, sc); 120 } 121 setTooltip(tooltip); 122 if (getValue("toolbar") == null) { 123 putValue("toolbar", toolbarId); 124 } 125 if (registerInToolbar && Main.toolbar != null) { 126 Main.toolbar.register(this); 127 } 128 if (installAdapters) { 129 installAdapters(); 130 } 131 } 132 133 /** 95 134 * The new super for all actions. 96 135 * … … 110 149 */ 111 150 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar, String toolbarId, boolean installAdapters) { 112 this(name, iconName == null ? null : ImageProvider.get(iconName), tooltip, shortcut, registerInToolbar,151 this(name, iconName == null ? null : new ImageProvider(iconName), tooltip, shortcut, registerInToolbar, 113 152 toolbarId == null ? iconName : toolbarId, installAdapters); 114 153 } -
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r7081 r7693 9 9 import java.awt.event.KeyEvent; 10 10 11 import javax.swing.Icon;12 11 import javax.swing.JLabel; 13 12 import javax.swing.JOptionPane; … … 24 23 import org.openstreetmap.josm.gui.widgets.JosmTextField; 25 24 import org.openstreetmap.josm.tools.GBC; 25 import org.openstreetmap.josm.tools.ImageProvider; 26 26 import org.openstreetmap.josm.tools.OsmUrlToBounds; 27 27 import org.openstreetmap.josm.tools.Shortcut; … … 37 37 */ 38 38 public JumpToAction() { 39 super(tr("Jump To Position"), (I con) null, tr("Opens a dialog that allows to jump to a specific location"),39 super(tr("Jump To Position"), (ImageProvider) null, tr("Opens a dialog that allows to jump to a specific location"), 40 40 Shortcut.registerShortcut("tools:jumpto", tr("Tool: {0}", tr("Jump To Position")), 41 41 KeyEvent.VK_J, Shortcut.CTRL), true, "action/jumpto", true);
Note:
See TracChangeset
for help on using the changeset viewer.