Changeset 6814 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2014-02-05T23:22:04+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r6380 r6814 32 32 * Aligns all selected nodes within a circle. (Useful for roundabouts) 33 33 * 34 * @since 146 35 * 34 36 * @author Matthew Newton 35 37 * @author Petr Dlouhý … … 48 50 } 49 51 50 p ublic double distance(EastNorth n, EastNorth m) {52 private static double distance(EastNorth n, EastNorth m) { 51 53 double easd, nord; 52 54 easd = n.east() - m.east(); … … 55 57 } 56 58 57 public class PolarCoor {59 public static class PolarCoor { 58 60 double radius; 59 61 double angle; … … 250 252 * @return true if all nodes in the given collection are referred by the same object, and no other one (see #8431) 251 253 */ 252 protected boolean allowRegularPolygon(Collection<Node> nodes) {254 protected static boolean allowRegularPolygon(Collection<Node> nodes) { 253 255 Set<OsmPrimitive> allReferrers = new HashSet<OsmPrimitive>(); 254 256 for (Node n : nodes) { -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r6672 r6814 38 38 * BTW: Someone might want to implement projection corrections for this... 39 39 * 40 * @since 996 41 * 40 42 * @author Henry Loenwind, based on much copy&Paste from other Actions. 41 43 * @author Sebastian Masch … … 47 49 */ 48 50 public CreateCircleAction() { 49 super(tr("Create Circle"), " createcircle", tr("Create a circle from three selected nodes."),51 super(tr("Create Circle"), "aligncircle", tr("Create a circle from three selected nodes."), 50 52 Shortcut.registerShortcut("tools:createcircle", tr("Tool: {0}", tr("Create Circle")), 51 KeyEvent.VK_O, Shortcut.SHIFT), true );53 KeyEvent.VK_O, Shortcut.SHIFT), true, "createcircle", true); 52 54 putValue("help", ht("/Action/CreateCircle")); 53 55 } … … 276 278 Main.map.repaint(); 277 279 } 278 280 279 281 private static void notifyNodesNotOnCircle() { 280 282 new Notification( -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r6336 r6814 20 20 21 21 /** 22 * This action loads the set of primitives referring to the current selection from the OSM 23 * server. 24 * 22 * This action loads the set of primitives referring to the current selection from the OSM server. 23 * @since 1810 25 24 */ 26 public class DownloadReferrersAction extends JosmAction {25 public class DownloadReferrersAction extends JosmAction { 27 26 27 /** 28 * Constructs a new {@code DownloadReferrersAction}. 29 */ 28 30 public DownloadReferrersAction() { 29 super(tr("Download parent ways/relations..."), "downloadreferrers", tr("Download objects referring to one of the selected objects"), 30 Shortcut.registerShortcut("file:downloadreferrers", tr("File: {0}", tr("Download parent ways/relations...")), KeyEvent.VK_D, Shortcut.ALT_CTRL), true); 31 super(tr("Download parent ways/relations..."), "download", 32 tr("Download objects referring to one of the selected objects"), 33 Shortcut.registerShortcut("file:downloadreferrers", 34 tr("File: {0}", tr("Download parent ways/relations...")), KeyEvent.VK_D, Shortcut.ALT_CTRL), 35 true, "downloadreferrers", true); 31 36 putValue("help", ht("/Action/DownloadParentWaysAndRelation")); 32 37 } … … 41 46 * @exception IllegalArgumentException thrown if targetLayer is null 42 47 */ 43 static public void downloadReferrers(OsmDataLayer targetLayer, Collection<OsmPrimitive> children) throws IllegalArgumentException {48 public static void downloadReferrers(OsmDataLayer targetLayer, Collection<OsmPrimitive> children) throws IllegalArgumentException { 44 49 if (children == null || children.isEmpty()) return; 45 50 Main.worker.submit(new DownloadReferrersTask(targetLayer, children)); … … 55 60 * @exception IllegalArgumentException thrown if targetLayer is null 56 61 */ 57 static public void downloadReferrers(OsmDataLayer targetLayer, Map<Long, OsmPrimitiveType> children) throws IllegalArgumentException {62 public static void downloadReferrers(OsmDataLayer targetLayer, Map<Long, OsmPrimitiveType> children) throws IllegalArgumentException { 58 63 if (children == null || children.isEmpty()) return; 59 64 Main.worker.submit(new DownloadReferrersTask(targetLayer, children)); … … 64 69 * <code>type</code>. 65 70 * 66 *67 71 * @param targetLayer the target layer. Must not be null. 68 72 * @param id the primitive id. id > 0 required. … … 72 76 * @exception IllegalArgumentException thrown if type == null 73 77 */ 74 static public void downloadReferrers(OsmDataLayer targetLayer, long id, OsmPrimitiveType type) throws IllegalArgumentException {78 public static void downloadReferrers(OsmDataLayer targetLayer, long id, OsmPrimitiveType type) throws IllegalArgumentException { 75 79 if (id <= 0) 76 80 throw new IllegalArgumentException(MessageFormat.format("Id > 0 required, got {0}", id)); -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r6380 r6814 27 27 28 28 public class JoinNodeWayAction extends JosmAction { 29 30 /** 31 * Constructs a new {@code JoinNodeWayAction}. 32 */ 29 33 public JoinNodeWayAction() { 30 34 super(tr("Join Node to Way"), "joinnodeway", tr("Include a node into the nearest way segments"), … … 53 57 HashMap<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>(); 54 58 for (WaySegment ws : wss) { 55 // Maybe cleaner to pass a "isSelected" predicate to getNearestWaySeg ements, but this is atm.less invasive.59 // Maybe cleaner to pass a "isSelected" predicate to getNearestWaySegments, but this is less invasive. 56 60 if(restrictToSelectedWays && !ws.way.isSelected()) { 57 61 continue; -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r6380 r6814 44 44 private SelectionChangeAdapter selectionChangeAdapter; 45 45 46 /** 47 * Returns the shortcut for this action. 48 * @return the shortcut for this action, or "No shortcut" if none is defined 49 */ 46 50 public Shortcut getShortcut() { 47 51 if (sc == null) { … … 110 114 } 111 115 116 /** 117 * Constructs a new {@code JosmAction}. 118 * 119 * Use this super constructor to setup your action. 120 * 121 * @param name the action's text as displayed on the menu (if it is added to a menu) 122 * @param iconName the filename of the icon to use 123 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 124 * that html is not supported for menu actions on some platforms. 125 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 126 * do want a shortcut, remember you can always register it with group=none, so you 127 * won't be assigned a shortcut unless the user configures one. If you pass null here, 128 * the user CANNOT configure a shortcut for your action. 129 * @param registerInToolbar register this action for the toolbar preferences? 130 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 131 */ 112 132 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar, boolean installAdapters) { 113 133 this(name, iconName, tooltip, shortcut, registerInToolbar, null, installAdapters); 114 134 } 115 135 136 /** 137 * Constructs a new {@code JosmAction}. 138 * 139 * Use this super constructor to setup your action. 140 * 141 * @param name the action's text as displayed on the menu (if it is added to a menu) 142 * @param iconName the filename of the icon to use 143 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 144 * that html is not supported for menu actions on some platforms. 145 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 146 * do want a shortcut, remember you can always register it with group=none, so you 147 * won't be assigned a shortcut unless the user configures one. If you pass null here, 148 * the user CANNOT configure a shortcut for your action. 149 * @param registerInToolbar register this action for the toolbar preferences? 150 */ 116 151 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) { 117 152 this(name, iconName, tooltip, shortcut, registerInToolbar, null, true); 118 153 } 119 154 155 /** 156 * Constructs a new {@code JosmAction}. 157 */ 120 158 public JosmAction() { 121 159 this(true); 122 160 } 123 161 162 /** 163 * Constructs a new {@code JosmAction}. 164 * 165 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 166 */ 124 167 public JosmAction(boolean installAdapters) { 125 168 setHelpId(); … … 146 189 } 147 190 191 /** 192 * Sets the tooltip text of this action. 193 * @param tooltip The text to display in tooltip. Can be {@code null} 194 */ 148 195 public void setTooltip(String tooltip) { 149 196 if (tooltip != null) { -
trunk/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java
r4982 r6814 14 14 /** 15 15 * This action synchronizes a set of primitives with their state on the server. 16 * 16 * @since 2682 17 17 */ 18 18 public class UpdateModifiedAction extends UpdateSelectionAction { 19 19 20 20 /** 21 * constructor21 * Constructs a new {@code UpdateModifiedAction}. 22 22 */ 23 23 public UpdateModifiedAction() { 24 super(tr("Update modified"), 25 "updatemodified", 24 super(tr("Update modified"), "updatedata", 26 25 tr("Updates the currently modified objects from the server (re-downloads data)"), 27 26 Shortcut.registerShortcut("file:updatemodified", 28 27 tr("File: {0}", tr("Update modified")), KeyEvent.VK_M, 29 28 Shortcut.ALT_CTRL), 30 true );29 true, "updatemodified"); 31 30 putValue("help", ht("/Action/UpdateModified")); 32 31 } -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r6336 r6814 26 26 /** 27 27 * This action synchronizes a set of primitives with their state on the server. 28 * 28 * @since 1670 29 29 */ 30 30 public class UpdateSelectionAction extends JosmAction { … … 34 34 * 35 35 * @param id the primitive id 36 * @param type The primitive type. Must be one of {@link OsmPrimitiveType#NODE NODE}, {@link OsmPrimitiveType#WAY WAY}, {@link OsmPrimitiveType#RELATION RELATION} 36 37 */ 37 38 public static void handlePrimitiveGoneException(long id, OsmPrimitiveType type) { 38 39 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 39 reader.append(getCurrentDataSet(), id, type);40 reader.append(getCurrentDataSet(), id, type); 40 41 try { 41 42 DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE); … … 80 81 81 82 /** 82 * constructor83 * Constructs a new {@code UpdateSelectionAction}. 83 84 */ 84 85 public UpdateSelectionAction() { 85 super(tr("Update selection"), 86 "updateselection", 86 super(tr("Update selection"), "updatedata", 87 87 tr("Updates the currently selected objects from the server (re-downloads data)"), 88 88 Shortcut.registerShortcut("file:updateselection", 89 89 tr("File: {0}", tr("Update selection")), KeyEvent.VK_U, 90 90 Shortcut.ALT_CTRL), 91 true );91 true, "updateselection", true); 92 92 putValue("help", ht("/Action/UpdateSelection")); 93 93 } 94 public UpdateSelectionAction(String name, String iconName, String tooltip, 95 Shortcut shortcut, boolean register) { 96 super(name, iconName, tooltip, shortcut, register); 94 95 /** 96 * Constructs a new {@code UpdateSelectionAction}. 97 * 98 * @param name the action's text as displayed on the menu (if it is added to a menu) 99 * @param iconName the filename of the icon to use 100 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 101 * that html is not supported for menu actions on some platforms. 102 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 103 * do want a shortcut, remember you can always register it with group=none, so you 104 * won't be assigned a shortcut unless the user configures one. If you pass null here, 105 * the user CANNOT configure a shortcut for your action. 106 * @param register register this action for the toolbar preferences? 107 * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null 108 */ 109 public UpdateSelectionAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbarId) { 110 super(name, iconName, tooltip, shortcut, register, toolbarId, true); 97 111 } 98 112 … … 111 125 } 112 126 113 /**114 * action handler115 */116 127 @Override 117 128 public void actionPerformed(ActionEvent e) { 118 129 if (! isEnabled()) 119 130 return; 120 Collection<OsmPrimitive> toUpdate = getData();131 Collection<OsmPrimitive> toUpdate = getData(); 121 132 if (toUpdate.isEmpty()) { 122 133 JOptionPane.showMessageDialog( … … 131 142 } 132 143 144 /** 145 * Returns the data on which this action operates. Override if needed. 146 * @return the data on which this action operates 147 */ 133 148 public Collection<OsmPrimitive> getData() { 134 149 return getCurrentDataSet().getAllSelected();
Note:
See TracChangeset
for help on using the changeset viewer.