- Timestamp:
- 2006-07-23T23:40:38+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r123 r124 12 12 import java.net.URISyntaxException; 13 13 import java.util.Collection; 14 import java.util.LinkedList; 14 15 import java.util.Map; 15 16 import java.util.StringTokenizer; … … 40 41 import org.openstreetmap.josm.actions.UploadAction; 41 42 import org.openstreetmap.josm.actions.mapmode.MapMode; 43 import org.openstreetmap.josm.command.ChangeCommand; 44 import org.openstreetmap.josm.command.Command; 45 import org.openstreetmap.josm.command.SequenceCommand; 42 46 import org.openstreetmap.josm.data.Bounds; 43 47 import org.openstreetmap.josm.data.Preferences; 44 48 import org.openstreetmap.josm.data.osm.DataSet; 49 import org.openstreetmap.josm.data.osm.Node; 50 import org.openstreetmap.josm.data.osm.OsmPrimitive; 51 import org.openstreetmap.josm.data.osm.Segment; 45 52 import org.openstreetmap.josm.data.projection.Epsg4326; 46 53 import org.openstreetmap.josm.data.projection.Projection; … … 156 163 } 157 164 }; 158 annotationTesterAction.putValue(Action.NAME, "Annotation Preset Tester");165 annotationTesterAction.putValue(Action.NAME, tr("Annotation Preset Tester")); 159 166 annotationTesterAction.putValue(Action.SMALL_ICON, ImageProvider.get("annotation-tester")); 167 final Action reverseSegmentAction = new AbstractAction(){ 168 public void actionPerformed(ActionEvent e) { 169 Collection<OsmPrimitive> sel = Main.ds.getSelected(); 170 boolean hasSegments = false; 171 for (OsmPrimitive osm : sel) { 172 if (osm instanceof Segment) { 173 hasSegments = true; 174 break; 175 } 176 } 177 if (!hasSegments) { 178 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one segment.")); 179 return; 180 } 181 Collection<Command> c = new LinkedList<Command>(); 182 for (OsmPrimitive osm : sel) { 183 if (!(osm instanceof Segment)) 184 continue; 185 Segment s = (Segment)osm; 186 Segment snew = new Segment(s); 187 Node n = snew.from; 188 snew.from = snew.to; 189 snew.to = n; 190 c.add(new ChangeCommand(s, snew)); 191 } 192 editLayer().add(new SequenceCommand(tr("Reverse Segments"), c)); 193 map.repaint(); 194 } 195 }; 196 reverseSegmentAction.putValue(Action.NAME, tr("Reverse Segments")); 197 reverseSegmentAction.putValue(Action.SMALL_ICON, ImageProvider.get("segmentflip")); 160 198 161 199 final Action uploadAction = new UploadAction(); … … 192 230 editMenu.add(undoAction); 193 231 editMenu.add(redoAction); 232 editMenu.addSeparator(); 233 editMenu.add(reverseSegmentAction); 194 234 editMenu.addSeparator(); 195 235 editMenu.add(preferencesAction); … … 216 256 toolBar.add(undoAction); 217 257 toolBar.add(redoAction); 258 toolBar.addSeparator(); 259 toolBar.add(reverseSegmentAction); 218 260 toolBar.addSeparator(); 219 261 toolBar.add(preferencesAction);
Note:
See TracChangeset
for help on using the changeset viewer.