Changeset 12672 in josm for trunk/src/org
- Timestamp:
- 2017-08-27T17:07:54+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/InfoAction.java
r12636 r12672 36 36 DataSet set = getLayerManager().getEditDataSet(); 37 37 if (set != null) { 38 new InspectPrimitiveDialog(set.getAllSelected(), getLayerManager().getEditLayer()).showDialog();38 new InspectPrimitiveDialog(set.getAllSelected(), set).showDialog(); 39 39 } 40 40 } -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r12605 r12672 122 122 } else { 123 123 getAffectedDataSet().removePrimitive(osm); 124 if (getLayer() != null) { 125 Conflict<?> conflict = getLayer().getConflicts().getConflictForMy(osm); 126 if (conflict != null) { 127 purgedConflicts.add(conflict); 128 getLayer().getConflicts().remove(conflict); 129 } 124 Conflict<?> conflict = getAffectedDataSet().getConflicts().getConflictForMy(osm); 125 if (conflict != null) { 126 purgedConflicts.add(conflict); 127 getAffectedDataSet().getConflicts().remove(conflict); 130 128 } 131 129 } … … 157 155 158 156 for (Conflict<?> conflict : purgedConflicts) { 159 get Layer().getConflicts().add(conflict);157 getAffectedDataSet().getConflicts().add(conflict); 160 158 } 161 159 } -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r12663 r12672 13 13 import org.openstreetmap.josm.command.Command; 14 14 import org.openstreetmap.josm.data.conflict.Conflict; 15 import org.openstreetmap.josm.data.osm.DataSet; 15 16 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 16 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 38 39 } 39 40 41 /** 42 * Constructs a new {@code ConflictAddCommand}. 43 * @param ds the data set. Must not be null. 44 * @param conflict the conflict to add 45 * @since 12672 46 */ 47 public ConflictAddCommand(DataSet ds, Conflict<? extends OsmPrimitive> conflict) { 48 super(ds); 49 this.conflict = conflict; 50 } 51 40 52 protected void warnBecauseOfDoubleConflict() { 41 53 JOptionPane.showMessageDialog( … … 55 67 public boolean executeCommand() { 56 68 try { 57 get Layer().getConflicts().add(conflict);69 getAffectedDataSet().getConflicts().add(conflict); 58 70 } catch (IllegalStateException e) { 59 71 Logging.error(e); … … 72 84 return; 73 85 } 74 get Layer().getConflicts().remove(conflict);86 getAffectedDataSet().getConflicts().remove(conflict); 75 87 } 76 88 -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
r12636 r12672 9 9 import org.openstreetmap.josm.data.conflict.Conflict; 10 10 import org.openstreetmap.josm.data.conflict.ConflictCollection; 11 import org.openstreetmap.josm.data.osm.DataSet; 11 12 import org.openstreetmap.josm.gui.MainApplication; 12 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 59 60 */ 60 61 protected void reconstituteConflicts() { 61 OsmDataLayer editLayer = getLayer();62 DataSet ds = getAffectedDataSet(); 62 63 for (Conflict<?> c : resolvedConflicts) { 63 if (! editLayer.getConflicts().hasConflictForMy(c.getMy())) {64 editLayer.getConflicts().add(c);64 if (!ds.getConflicts().hasConflictForMy(c.getMy())) { 65 ds.getConflicts().add(c); 65 66 } 66 67 } -
trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java
r10216 r12672 55 55 conflict.getMy().setModified(conflict.getTheir().isModified()); 56 56 } 57 get Layer().getConflicts().remove(conflict);57 getAffectedDataSet().getConflicts().remove(conflict); 58 58 rememberConflict(conflict); 59 59 return true; -
trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
r12636 r12672 11 11 12 12 import org.openstreetmap.josm.data.conflict.Conflict; 13 import org.openstreetmap.josm.data.osm.DataSet; 13 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 15 import org.openstreetmap.josm.data.osm.Relation; … … 81 82 82 83 MainApplication.getLayerManager().setActiveLayer(layer); 83 OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();84 DataSet editDs = MainApplication.getLayerManager().getEditDataSet(); 84 85 85 86 // restore the former state … … 89 90 // restore a conflict if necessary 90 91 // 91 if (!edit Layer.getConflicts().hasConflictForMy(conflict.getMy())) {92 edit Layer.getConflicts().add(conflict);92 if (!editDs.getConflicts().hasConflictForMy(conflict.getMy())) { 93 editDs.getConflicts().add(conflict); 93 94 } 94 95 } -
trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java
r10216 r12672 64 64 } 65 65 } 66 get Layer().getConflicts().remove(conflict);66 getAffectedDataSet().getConflicts().remove(conflict); 67 67 rememberConflict(conflict); 68 68 return true; -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r12620 r12672 30 30 import org.openstreetmap.josm.data.ProjectionBounds; 31 31 import org.openstreetmap.josm.data.SelectionChangedListener; 32 import org.openstreetmap.josm.data.conflict.ConflictCollection; 32 33 import org.openstreetmap.josm.data.coor.EastNorth; 33 34 import org.openstreetmap.josm.data.coor.LatLon; … … 196 197 private final Collection<DataSource> dataSources = new LinkedList<>(); 197 198 199 private final ConflictCollection conflicts = new ConflictCollection(); 200 198 201 /** 199 202 * Constructs a new {@code DataSet}. … … 1347 1350 } 1348 1351 1352 /** 1353 * Replies the set of conflicts currently managed in this layer. 1354 * 1355 * @return the set of conflicts currently managed in this layer 1356 * @since 12672 1357 */ 1358 public ConflictCollection getConflicts() { 1359 return conflicts; 1360 } 1361 1349 1362 /* --------------------------------------------------------------------------------- */ 1350 1363 /* interface ProjectionChangeListner */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r12643 r12672 218 218 */ 219 219 public void refreshView() { 220 OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();220 DataSet editDs = MainApplication.getLayerManager().getEditDataSet(); 221 221 synchronized (this) { 222 conflicts = edit Layer == null ? new ConflictCollection() : editLayer.getConflicts();222 conflicts = editDs == null ? new ConflictCollection() : editDs.getConflicts(); 223 223 } 224 224 GuiHelper.runInEDT(() -> { -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
r12213 r12672 11 11 import org.openstreetmap.josm.data.coor.EastNorth; 12 12 import org.openstreetmap.josm.data.osm.BBox; 13 import org.openstreetmap.josm.data.osm.DataSet; 13 14 import org.openstreetmap.josm.data.osm.Node; 14 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 16 17 import org.openstreetmap.josm.data.osm.RelationMember; 17 18 import org.openstreetmap.josm.data.osm.Way; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;19 19 import org.openstreetmap.josm.tools.Geometry; 20 20 import org.openstreetmap.josm.tools.date.DateUtils; … … 29 29 30 30 private final StringBuilder s = new StringBuilder(); 31 private final OsmDataLayer layer;32 33 InspectPrimitiveDataText( OsmDataLayer layer) {34 this. layer = layer;31 private final DataSet ds; 32 33 InspectPrimitiveDataText(DataSet ds) { 34 this.ds = ds; 35 35 } 36 36 … … 226 226 227 227 void addConflicts(OsmPrimitive o) { 228 Conflict<?> c = layer.getConflicts().getConflictForMy(o);228 Conflict<?> c = ds.getConflicts().getConflictForMy(o); 229 229 if (c != null) { 230 230 add(tr("In conflict with: ")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r12663 r12672 22 22 23 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.data.osm.DataSet; 24 25 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 25 26 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 28 29 import org.openstreetmap.josm.gui.MainApplication; 29 30 import org.openstreetmap.josm.gui.NavigatableComponent; 30 import org.openstreetmap.josm.gui.layer.OsmDataLayer;31 31 import org.openstreetmap.josm.gui.mappaint.Cascade; 32 32 import org.openstreetmap.josm.gui.mappaint.ElemStyles; … … 53 53 54 54 protected transient List<OsmPrimitive> primitives; 55 protected transient OsmDataLayer layer;56 55 private boolean mappaintTabLoaded; 57 56 private boolean editcountTabLoaded; … … 60 59 * Constructs a new {@code InspectPrimitiveDialog}. 61 60 * @param primitives collection of primitives 62 * @param layer data layer 61 * @param data data set 62 * @since 12672 (signature) 63 63 */ 64 public InspectPrimitiveDialog(final Collection<OsmPrimitive> primitives, OsmDataLayer layer) {64 public InspectPrimitiveDialog(final Collection<OsmPrimitive> primitives, DataSet data) { 65 65 super(Main.parent, tr("Advanced object info"), tr("Close")); 66 66 this.primitives = new ArrayList<>(primitives); 67 this.layer = layer;68 67 setRememberWindowGeometry(getClass().getName() + ".geometry", 69 68 WindowGeometry.centerInWindow(Main.parent, new Dimension(750, 550))); … … 72 71 final JTabbedPane tabs = new JTabbedPane(); 73 72 74 tabs.addTab(tr("data"), genericMonospacePanel(new JPanel(), buildDataText( layer, this.primitives)));73 tabs.addTab(tr("data"), genericMonospacePanel(new JPanel(), buildDataText(data, this.primitives))); 75 74 76 75 final JPanel pMapPaint = new JPanel(); … … 106 105 } 107 106 108 protected static String buildDataText( OsmDataLayer layer, List<OsmPrimitive> primitives) {109 InspectPrimitiveDataText dt = new InspectPrimitiveDataText( layer);107 protected static String buildDataText(DataSet data, List<OsmPrimitive> primitives) { 108 InspectPrimitiveDataText dt = new InspectPrimitiveDataText(data); 110 109 primitives.stream() 111 110 .sorted(OsmPrimitiveComparator.orderingWaysRelationsNodes().thenComparing(OsmPrimitiveComparator.comparingNames())) -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java
r12636 r12672 136 136 return; 137 137 } 138 DataSetMerger visitor = new DataSetMerger(MainApplication.getLayerManager().getEditLayer().data, ds); 138 DataSet editData = MainApplication.getLayerManager().getEditDataSet(); 139 DataSetMerger visitor = new DataSetMerger(editData, ds); 139 140 visitor.merge(); 140 141 if (!visitor.getConflicts().isEmpty()) { 141 MainApplication.getLayerManager().getEditLayer().getConflicts().add(visitor.getConflicts());142 editData.getConflicts().add(visitor.getConflicts()); 142 143 } 143 144 final RelationTreeModel model = (RelationTreeModel) getModel(); -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r12671 r12672 351 351 352 352 /** 353 * the collection of conflicts detected in this layer354 */355 private final ConflictCollection conflicts;356 357 /**358 353 * a texture for non-downloaded area 359 354 */ … … 407 402 this.data = data; 408 403 this.setAssociatedFile(associatedFile); 409 conflicts = new ConflictCollection();410 404 data.addDataSetListener(new DataSetListenerAdapter(this)); 411 405 data.addDataSetListener(MultipolygonCache.getInstance()); … … 567 561 int numNewConflicts = 0; 568 562 for (Conflict<?> c : visitor.getConflicts()) { 569 if (! conflicts.hasConflict(c)) {563 if (!data.getConflicts().hasConflict(c)) { 570 564 numNewConflicts++; 571 conflicts.add(c);565 data.getConflicts().add(c); 572 566 } 573 567 } … … 924 918 */ 925 919 public ConflictCollection getConflicts() { 926 return conflicts;920 return data.getConflicts(); 927 921 } 928 922
Note:
See TracChangeset
for help on using the changeset viewer.