Changeset 29394 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java
- Timestamp:
- 2013-03-24T20:08:00+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java
r29384 r29394 7 7 import java.net.*; 8 8 import java.util.*; 9 import javax.swing.Action; 10 import javax.swing.Icon; 9 11 import javax.swing.JOptionPane; 10 12 import org.openstreetmap.josm.Main; … … 15 17 import org.openstreetmap.josm.gui.layer.ImageryLayer; 16 18 import static org.openstreetmap.josm.tools.I18n.tr; 19 import org.openstreetmap.josm.tools.ImageProvider; 17 20 import org.openstreetmap.josm.tools.Shortcut; 18 21 … … 24 27 */ 25 28 public class GetImageryOffsetAction extends JosmAction { 29 private Icon iconOffsetOk; 30 private Icon iconOffsetBad; 26 31 27 32 /** 28 33 * Initialize the action. Sets "Ctrl+Alt+I" shortcut: the only shortcut in this plugin. 34 * Also registers itself with {@link ImageryOffsetWatcher}. 29 35 */ 30 36 public GetImageryOffsetAction() { … … 32 38 Shortcut.registerShortcut("imageryoffset:get", tr("Imagery: {0}", tr("Get Imagery Offset...")), 33 39 KeyEvent.VK_I, Shortcut.ALT_CTRL), true); 40 iconOffsetOk = ImageProvider.get("getoffset"); 41 iconOffsetBad = ImageProvider.get("getoffsetnow"); // todo: create icon 42 ImageryOffsetWatcher.getInstance().register(this); 34 43 } 35 44 … … 84 93 85 94 /** 95 * Update action icon based on an offset state. 96 */ 97 public void offsetStateChanged( boolean isOffsetGood ) { 98 putValue(Action.SMALL_ICON, isOffsetGood ? iconOffsetOk : iconOffsetBad); 99 } 100 101 /** 102 * Remove offset listener. 103 */ 104 @Override 105 public void destroy() { 106 ImageryOffsetWatcher.getInstance().unregister(this); 107 super.destroy(); 108 } 109 110 /** 86 111 * A task that downloads offsets for a given position and imagery layer, 87 112 * then parses resulting XML and calls 88 113 * {@link #showOffsetDialog(java.util.List)} on success. 89 114 */ 90 class DownloadOffsetsTask extends SimpleOffsetQueryTask { 115 private class DownloadOffsetsTask extends SimpleOffsetQueryTask { 91 116 private ImageryLayer layer; 92 117 private List<ImageryOffsetBase> offsets;
Note:
See TracChangeset
for help on using the changeset viewer.
