Changeset 12718 in josm for trunk/src/org/openstreetmap/josm/command/conflict
- Timestamp:
- 2017-09-04T00:50:22+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/command/conflict
- Files:
-
- 3 edited
-
ConflictAddCommand.java (modified) (4 diffs)
-
ConflictResolveCommand.java (modified) (6 diffs)
-
RelationMemberConflictResolverCommand.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r12672 r12718 16 16 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.MainApplication;19 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 20 19 import org.openstreetmap.josm.tools.ImageProvider; … … 33 32 * @param layer the data layer. Must not be null. 34 33 * @param conflict the conflict to add 34 * @deprecated to be removed end of 2017. Use {@link #ConflictAddCommand(DataSet, Conflict)} instead 35 35 */ 36 @Deprecated 36 37 public ConflictAddCommand(OsmDataLayer layer, Conflict<? extends OsmPrimitive> conflict) { 37 38 super(layer); … … 56 57 + "''{1}''.<br>" 57 58 + "This conflict cannot be added.</html>", 58 Utils.escapeReservedCharactersHTML(get Layer().getName()),59 Utils.escapeReservedCharactersHTML(getAffectedDataSet().getName()), 59 60 Utils.escapeReservedCharactersHTML(conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())) 60 61 ), … … 77 78 @Override 78 79 public void undoCommand() { 79 if (MainApplication.isDisplayingMapView() && !MainApplication.getLayerManager().containsLayer(getLayer())) { 80 DataSet ds = getAffectedDataSet(); 81 if (!Main.main.containsDataSet(ds)) { 80 82 Logging.warn(tr("Layer ''{0}'' does not exist any more. Cannot remove conflict for object ''{1}''.", 81 getLayer().getName(),83 ds.getName(), 82 84 conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance()) 83 85 )); 84 86 return; 85 87 } 86 getAffectedDataSet().getConflicts().remove(conflict);88 ds.getConflicts().remove(conflict); 87 89 } 88 90 -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
r12672 r12718 6 6 import java.util.Objects; 7 7 8 import org.openstreetmap.josm.Main; 8 9 import org.openstreetmap.josm.command.Command; 9 10 import org.openstreetmap.josm.data.conflict.Conflict; 10 11 import org.openstreetmap.josm.data.conflict.ConflictCollection; 11 12 import org.openstreetmap.josm.data.osm.DataSet; 12 import org.openstreetmap.josm.gui.MainApplication;13 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 14 14 import org.openstreetmap.josm.tools.Logging; … … 24 24 public abstract class ConflictResolveCommand extends Command { 25 25 /** the list of resolved conflicts */ 26 private final ConflictCollection resolvedConflicts; 26 private final ConflictCollection resolvedConflicts = new ConflictCollection(); 27 27 28 28 /** … … 30 30 */ 31 31 public ConflictResolveCommand() { 32 super(); 33 resolvedConflicts = new ConflictCollection(); 32 // Do nothing 34 33 } 35 34 … … 37 36 * Constructs a new {@code ConflictResolveCommand} in the context of a given data layer. 38 37 * @param layer the data layer. Must not be null. 38 * @deprecated to be removed end of 2017. Use {@link #ConflictResolveCommand(DataSet)} instead 39 39 */ 40 @Deprecated 40 41 public ConflictResolveCommand(OsmDataLayer layer) { 41 42 super(layer); 42 resolvedConflicts = new ConflictCollection(); 43 } 44 45 /** 46 * Constructs a new {@code ConflictResolveCommand} in the context of a given data set. 47 * @param ds the data set. Must not be null. 48 */ 49 public ConflictResolveCommand(DataSet ds) { 50 super(ds); 43 51 } 44 52 … … 56 64 /** 57 65 * reconstitutes all remembered conflicts. Add the remembered conflicts to the 58 * set of conflicts of the {@link OsmDataLayer} this command was applied to.66 * set of conflicts of the {@link DataSet} this command was applied to. 59 67 * 60 68 */ … … 72 80 super.undoCommand(); 73 81 74 if (MainApplication.isDisplayingMapView()) {75 if (!MainApplication.getLayerManager().containsLayer(getLayer())) {76 Logging.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",77 this.toString(),78 getLayer().toString()79 ));80 return;81 }82 DataSet ds = getAffectedDataSet(); 83 if (!Main.main.containsDataSet(ds)) { 84 Logging.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more", 85 this.toString(), 86 ds.getName() 87 )); 88 return; 89 } 82 90 83 MainApplication.getLayerManager().setActiveLayer(getLayer()); 84 } 91 Main.main.setEditDataSet(ds); 85 92 reconstituteConflicts(); 86 93 } -
trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
r12672 r12718 10 10 import javax.swing.Icon; 11 11 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.data.conflict.Conflict; 13 14 import org.openstreetmap.josm.data.osm.DataSet; … … 15 16 import org.openstreetmap.josm.data.osm.Relation; 16 17 import org.openstreetmap.josm.data.osm.RelationMember; 17 import org.openstreetmap.josm.gui.MainApplication;18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;19 18 import org.openstreetmap.josm.tools.ImageProvider; 20 19 import org.openstreetmap.josm.tools.Logging; … … 72 71 @Override 73 72 public void undoCommand() { 74 OsmDataLayer layer = getLayer();75 if (!Main Application.getLayerManager().containsLayer(layer)) {73 DataSet editDs = getAffectedDataSet(); 74 if (!Main.main.containsDataSet(editDs)) { 76 75 Logging.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more", 77 76 this.toString(), 78 layer.toString()77 editDs.getName() 79 78 )); 80 79 return; 81 80 } 82 81 83 MainApplication.getLayerManager().setActiveLayer(layer); 84 DataSet editDs = MainApplication.getLayerManager().getEditDataSet(); 82 Main.main.setEditDataSet(editDs); 85 83 86 84 // restore the former state
Note:
See TracChangeset
for help on using the changeset viewer.
