Changeset 12101 in josm for trunk/src/org
- Timestamp:
- 2017-05-10T23:24:52+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r11747 r12101 31 31 import org.openstreetmap.josm.Main; 32 32 import org.openstreetmap.josm.actions.AbstractInfoAction; 33 import org.openstreetmap.josm.data.SelectionChangedListener; 34 import org.openstreetmap.josm.data.osm.DataSet; 33 import org.openstreetmap.josm.data.osm.DataSelectionListener; 35 34 import org.openstreetmap.josm.data.osm.OsmPrimitive; 36 35 import org.openstreetmap.josm.data.osm.User; 36 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 37 37 import org.openstreetmap.josm.gui.SideButton; 38 38 import org.openstreetmap.josm.gui.layer.Layer; … … 51 51 * 52 52 */ 53 public class UserListDialog extends ToggleDialog implements SelectionChangedListener, ActiveLayerChangeListener {53 public class UserListDialog extends ToggleDialog implements DataSelectionListener, ActiveLayerChangeListener { 54 54 55 55 /** … … 71 71 @Override 72 72 public void showNotify() { 73 DataSet.addSelectionListener(this);73 SelectionEventManager.getInstance().addSelectionListenerForEdt(this); 74 74 Main.getLayerManager().addActiveLayerChangeListener(this); 75 75 } … … 78 78 public void hideNotify() { 79 79 Main.getLayerManager().removeActiveLayerChangeListener(this); 80 DataSet.removeSelectionListener(this);80 SelectionEventManager.getInstance().removeSelectionListener(this); 81 81 } 82 82 … … 103 103 } 104 104 105 /** 106 * Called when the selection in the dataset changed. 107 * @param newSelection The new selection array. 108 */ 109 @Override 110 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 111 refresh(newSelection); 105 @Override 106 public void selectionChanged(SelectionChangeEvent event) { 107 refresh(event.getSelection()); 112 108 } 113 109 … … 115 111 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 116 112 Layer activeLayer = e.getSource().getActiveLayer(); 113 refreshForActiveLayer(activeLayer); 114 } 115 116 private void refreshForActiveLayer(Layer activeLayer) { 117 117 if (activeLayer instanceof OsmDataLayer) { 118 118 refresh(((OsmDataLayer) activeLayer).data.getAllSelected()); … … 127 127 */ 128 128 public void refresh(Collection<? extends OsmPrimitive> fromPrimitives) { 129 model.populate(fromPrimitives);130 129 GuiHelper.runInEDT(() -> { 130 model.populate(fromPrimitives); 131 131 if (model.getRowCount() != 0) { 132 132 setTitle(trn("{0} Author", "{0} Authors", model.getRowCount(), model.getRowCount())); … … 140 140 public void showDialog() { 141 141 super.showDialog(); 142 Layer layer = Main.getLayerManager().getActiveLayer(); 143 if (layer instanceof OsmDataLayer) { 144 refresh(((OsmDataLayer) layer).data.getAllSelected()); 145 } 142 refreshForActiveLayer(Main.getLayerManager().getActiveLayer()); 146 143 } 147 144 … … 308 305 309 306 public void populate(Collection<? extends OsmPrimitive> primitives) { 307 GuiHelper.assertCallFromEdt(); 310 308 Map<User, Integer> statistics = computeStatistics(primitives); 311 309 data.clear(); … … 316 314 } 317 315 Collections.sort(data); 318 GuiHelper.runInEDTAndWait(this::fireTableDataChanged);316 this.fireTableDataChanged(); 319 317 } 320 318
Note:
See TracChangeset
for help on using the changeset viewer.