|
10 | 10 | import java.util.Optional;
|
11 | 11 | import java.util.stream.Collectors;
|
12 | 12 |
|
13 |
| -import javax.swing.Icon; |
14 |
| - |
15 | 13 | import org.openstreetmap.josm.data.osm.DataSet;
|
16 | 14 | import org.openstreetmap.josm.data.osm.Node;
|
17 | 15 | import org.openstreetmap.josm.data.osm.NodeData;
|
@@ -68,6 +66,14 @@ private void init(List<PrimitiveData> data, List<PrimitiveData> toSelect) {
|
68 | 66 | @Override
|
69 | 67 | public boolean executeCommand() {
|
70 | 68 | DataSet ds = getAffectedDataSet();
|
| 69 | + ds.update(() -> this.executeRealCommand(ds)); |
| 70 | + if (toSelect != null) { |
| 71 | + ds.setSelected(toSelect.stream().map(ds::getPrimitiveById).collect(Collectors.toList())); |
| 72 | + } |
| 73 | + return true; |
| 74 | + } |
| 75 | + |
| 76 | + private void executeRealCommand(DataSet ds) { |
71 | 77 | if (createdPrimitives == null) { // first time execution
|
72 | 78 | List<OsmPrimitive> newPrimitives = new ArrayList<>(data.size());
|
73 | 79 | preExistingData = new ArrayList<>();
|
@@ -109,10 +115,6 @@ public boolean executeCommand() {
|
109 | 115 | }
|
110 | 116 | }
|
111 | 117 | }
|
112 |
| - if (toSelect != null) { |
113 |
| - ds.setSelected(toSelect.stream().map(ds::getPrimitiveById).collect(Collectors.toList())); |
114 |
| - } |
115 |
| - return true; |
116 | 118 | }
|
117 | 119 |
|
118 | 120 | @Override public void undoCommand() {
|
@@ -148,11 +150,6 @@ public String getDescriptionText() {
|
148 | 150 | return trn("Added {0} object", "Added {0} objects", size, size);
|
149 | 151 | }
|
150 | 152 |
|
151 |
| - @Override |
152 |
| - public Icon getDescriptionIcon() { |
153 |
| - return null; |
154 |
| - } |
155 |
| - |
156 | 153 | @Override
|
157 | 154 | public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
|
158 | 155 | Collection<OsmPrimitive> added) {
|
|
0 commit comments