Changeset 10448 in josm for trunk/src/org
- Timestamp:
- 2016-06-21T01:29:31+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r10409 r10448 64 64 } 65 65 66 publicstatic String getCopyString(Collection<? extends OsmPrimitive> primitives) {66 static String getCopyString(Collection<? extends OsmPrimitive> primitives) { 67 67 StringBuilder idsBuilder = new StringBuilder(); 68 68 for (OsmPrimitive p : primitives) { … … 82 82 } 83 83 84 private staticboolean isEmptySelection() {85 Collection<OsmPrimitive> sel = get CurrentDataSet().getSelected();84 private boolean isEmptySelection() { 85 Collection<OsmPrimitive> sel = getLayerManager().getEditDataSet().getSelected(); 86 86 if (sel.isEmpty()) { 87 87 JOptionPane.showMessageDialog( -
trunk/src/org/openstreetmap/josm/actions/CopyCoordinatesAction.java
r10043 r10448 9 9 import java.util.Collections; 10 10 11 import org.openstreetmap.josm.data.osm.DataSet; 11 12 import org.openstreetmap.josm.data.osm.Node; 12 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 47 48 } 48 49 49 private static Collection<Node> getSelectedNodes() { 50 if (getCurrentDataSet() == null || getCurrentDataSet().getSelected() == null) { 50 private Collection<Node> getSelectedNodes() { 51 DataSet ds = getLayerManager().getEditDataSet(); 52 if (ds == null || ds.getSelected() == null) { 51 53 return Collections.emptyList(); 52 54 } else { 53 return Utils.filteredCollection( getCurrentDataSet().getSelected(), Node.class);55 return Utils.filteredCollection(ds.getSelected(), Node.class); 54 56 } 55 57 } -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r10446 r10448 176 176 } 177 177 178 private static Relation getSelectedMultipolygonRelation() { 179 return getSelectedMultipolygonRelation(getCurrentDataSet().getSelectedWays(), getCurrentDataSet().getSelectedRelations()); 178 private Relation getSelectedMultipolygonRelation() { 179 DataSet ds = getLayerManager().getEditDataSet(); 180 return getSelectedMultipolygonRelation(ds.getSelectedWays(), ds.getSelectedRelations()); 180 181 } 181 182 -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r10413 r10448 272 272 if (cmd != null) { 273 273 Main.main.undoRedo.add(cmd); 274 getCurrentDataSet().setSelected(target);274 layer.data.setSelected(target); 275 275 } 276 276 } -
trunk/src/org/openstreetmap/josm/actions/MergeSelectionAction.java
r10383 r10448 89 89 * @return true if the user wants to cancel, false if they want to continue 90 90 */ 91 public staticfinal boolean warnMergingUploadDiscouragedObjects(Layer targetLayer) {91 public final boolean warnMergingUploadDiscouragedObjects(Layer targetLayer) { 92 92 return GuiHelper.warnUser(tr("Merging too many objects with different upload policies"), 93 93 "<html>" + … … 96 96 "You should instead check and merge each object, <b>one by one</b>.<br /><br />"+ 97 97 "Are you sure you want to continue?", 98 get EditLayer().getName(), targetLayer.getName(), targetLayer.getName())+98 getLayerManager().getEditLayer().getName(), targetLayer.getName(), targetLayer.getName())+ 99 99 "</html>", 100 100 ImageProvider.get("dialogs", "mergedown"), tr("Ignore this hint and merge anyway")); -
trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java
r9594 r10448 38 38 */ 39 39 public static Collection<OsmPrimitive> getSurroundingObjects(EastNorth internalPoint) { 40 final DataSet ds = JosmAction.getCurrentDataSet();40 final DataSet ds = Main.getLayerManager().getEditDataSet(); 41 41 if (ds == null) { 42 42 return Collections.emptySet(); … … 87 87 public static void performSelection(EastNorth internalPoint, boolean doAdd, boolean doRemove) { 88 88 final Collection<OsmPrimitive> surroundingObjects = getSurroundingObjects(internalPoint); 89 final DataSet ds = JosmAction.getCurrentDataSet();89 final DataSet ds = Main.getLayerManager().getEditDataSet(); 90 90 if (surroundingObjects.isEmpty()) { 91 91 return; -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r10382 r10448 196 196 final List<List<Node>> wayChunks = buildSplitChunks(selectedWay, selectedNodes); 197 197 if (wayChunks != null) { 198 List<Relation> selectedRelations = 199 OsmPrimitive.getFilteredList(selection, Relation.class); 198 List<Relation> selectedRelations = OsmPrimitive.getFilteredList(selection, Relation.class); 200 199 final List<OsmPrimitive> sel = new ArrayList<>(selectedWays.size() + selectedRelations.size()); 201 200 sel.addAll(selectedWays); … … 308 307 toggleSaveState(); // necessary since #showDialog() does not handle it due to the non-modal dialog 309 308 if (getValue() == 1) { 310 final Way wayToKeep = list.getSelectedValue();311 final SplitWayResult result = doSplitWay(getEditLayer(), selectedWay, wayToKeep, newWays, selection);309 SplitWayResult result = doSplitWay(Main.getLayerManager().getEditLayer(), 310 selectedWay, list.getSelectedValue(), newWays, selection); 312 311 Main.main.undoRedo.add(result.getCommand()); 313 getCurrentDataSet().setSelected(result.getNewSelection());312 Main.getLayerManager().getEditDataSet().setSelected(result.getNewSelection()); 314 313 } 315 314 } -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r10420 r10448 560 560 * @param newNodes New created nodes by this set of command 561 561 */ 562 private staticvoid execCommands(List<Command> cmds, List<Node> newNodes) {562 private void execCommands(List<Command> cmds, List<Node> newNodes) { 563 563 Main.main.undoRedo.add(new SequenceCommand(/* for correct i18n of plural forms - see #9110 */ 564 564 trn("Dupe into {0} node", "Dupe into {0} nodes", newNodes.size() + 1L, newNodes.size() + 1L), cmds)); 565 565 // select one of the new nodes 566 get CurrentDataSet().setSelected(newNodes.get(0));566 getLayerManager().getEditDataSet().setSelected(newNodes.get(0)); 567 567 } 568 568 -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r10413 r10448 41 41 public static void handlePrimitiveGoneException(long id, OsmPrimitiveType type) { 42 42 MultiFetchServerObjectReader reader = MultiFetchServerObjectReader.create(); 43 reader.append( getCurrentDataSet(), id, type);43 reader.append(Main.getLayerManager().getEditDataSet(), id, type); 44 44 try { 45 45 DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE); … … 58 58 */ 59 59 public static void updatePrimitives(final Collection<OsmPrimitive> selection) { 60 UpdatePrimitivesTask task = new UpdatePrimitivesTask(Main.getLayerManager().getEditLayer(), selection); 61 Main.worker.submit(task); 60 Main.worker.submit(new UpdatePrimitivesTask(Main.getLayerManager().getEditLayer(), selection)); 62 61 } 63 62 … … 73 72 public static void updatePrimitive(PrimitiveId id) { 74 73 ensureParameterNotNull(id, "id"); 75 if ( getEditLayer() == null)74 if (Main.getLayerManager().getEditLayer() == null) 76 75 throw new IllegalStateException(tr("No current dataset found")); 77 OsmPrimitive primitive = getEditLayer().data.getPrimitiveById(id);76 OsmPrimitive primitive = Main.getLayerManager().getEditLayer().data.getPrimitiveById(id); 78 77 if (primitive == null) 79 78 throw new IllegalStateException(tr("Did not find an object with id {0} in the current dataset", id)); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r10382 r10448 25 25 import org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager; 26 26 import org.openstreetmap.josm.gui.layer.Layer; 27 import org.openstreetmap.josm.gui.layer.MainLayerManager; 27 28 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 29 import org.openstreetmap.josm.gui.util.HighlightHelper; … … 138 139 boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK | InputEvent.ALT_GRAPH_MASK)) != 0; 139 140 141 MainLayerManager lm = Main.getLayerManager(); 140 142 Command c; 141 143 if (ctrl) { 142 c = DeleteCommand.deleteWithReferences( getEditLayer(), getCurrentDataSet().getSelected());144 c = DeleteCommand.deleteWithReferences(lm.getEditLayer(), lm.getEditDataSet().getSelected()); 143 145 } else { 144 c = DeleteCommand.delete( getEditLayer(), getCurrentDataSet().getSelected(), !alt /* also delete nodes in way */);146 c = DeleteCommand.delete(lm.getEditLayer(), lm.getEditDataSet().getSelected(), !alt /* also delete nodes in way */); 145 147 } 146 148 // if c is null, an error occurred or the user aborted. Don't do anything in that case. 147 149 if (c != null) { 148 150 Main.main.undoRedo.add(c); 149 getCurrentDataSet().setSelected();151 lm.getEditDataSet().setSelected(); 150 152 Main.map.repaint(); 151 153 } … … 170 172 * removes any highlighting that may have been set beforehand. 171 173 */ 172 private staticvoid removeHighlighting() {174 private void removeHighlighting() { 173 175 highlightHelper.clear(); 174 DataSet ds = get CurrentDataSet();176 DataSet ds = getLayerManager().getEditDataSet(); 175 177 if (ds != null) { 176 178 ds.clearHighlightedWaySegments(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r10413 r10448 870 870 } 871 871 872 private static boolean movesHiddenWay() { 873 final Collection<OsmPrimitive> elementsToTest = new HashSet<>(getCurrentDataSet().getSelected()); 874 for (Way osm : Utils.filteredCollection(getCurrentDataSet().getSelected(), Way.class)) { 872 private boolean movesHiddenWay() { 873 DataSet ds = getLayerManager().getEditDataSet(); 874 final Collection<OsmPrimitive> elementsToTest = new HashSet<>(ds.getSelected()); 875 for (Way osm : Utils.filteredCollection(ds.getSelected(), Way.class)) { 875 876 elementsToTest.addAll(osm.getNodes()); 876 877 } -
trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java
r10446 r10448 14 14 15 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.actions.JosmAction;17 16 import org.openstreetmap.josm.data.APIDataSet; 18 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 73 72 } 74 73 } 75 OsmDataLayer editLayer = JosmAction.getEditLayer();74 OsmDataLayer editLayer = Main.getLayerManager().getEditLayer(); 76 75 if (editLayer != null) { 77 76 editLayer.validationErrors.clear(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r9675 r10448 12 12 import java.util.List; 13 13 14 import org.openstreetmap.josm. actions.JosmAction;14 import org.openstreetmap.josm.Main; 15 15 import org.openstreetmap.josm.command.ChangeCommand; 16 16 import org.openstreetmap.josm.command.Command; … … 44 44 */ 45 45 public Coastlines() { 46 super(tr("Coastlines"), 47 tr("This test checks that coastlines are correct.")); 46 super(tr("Coastlines"), tr("This test checks that coastlines are correct.")); 48 47 } 49 48 … … 53 52 super.startTest(monitor); 54 53 55 OsmDataLayer layer = JosmAction.getEditLayer();54 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 56 55 57 56 if (layer != null) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r10378 r10448 8 8 import java.util.Set; 9 9 10 import org.openstreetmap.josm. actions.JosmAction;10 import org.openstreetmap.josm.Main; 11 11 import org.openstreetmap.josm.command.Command; 12 12 import org.openstreetmap.josm.data.osm.DataSet; … … 123 123 public void startTest(ProgressMonitor monitor) { 124 124 super.startTest(monitor); 125 DataSet ds = JosmAction.getCurrentDataSet();125 DataSet ds = Main.getLayerManager().getEditDataSet(); 126 126 if (ds == null) 127 127 return; -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10446 r10448 268 268 // which would make this variable true. Of course we only want the popup to show 269 269 // if the middle mouse button has been pressed in the first place 270 boolean mouseNotMoved = oldMousePos != null 271 && oldMousePos.equals(ms.mousePos); 270 boolean mouseNotMoved = oldMousePos != null && oldMousePos.equals(ms.mousePos); 272 271 boolean isAtOldPosition = mouseNotMoved && popup != null; 273 272 boolean middleMouseDown = (ms.modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0; 274 273 try { 275 ds = mv.get CurrentDataSet();274 ds = mv.getLayerManager().getEditDataSet(); 276 275 if (ds != null) { 277 276 // This is not perfect, if current dataset was changed during execution, the lock would be useless
Note:
See TracChangeset
for help on using the changeset viewer.