Changeset 13925 in josm for trunk/src


Ignore:
Timestamp:
2018-06-13T00:05:31+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #13467 - use DataSelectionListener everywhere. Deprecate SelectionChangedListener

Location:
trunk/src/org/openstreetmap/josm
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r13647 r13925  
    1717import org.openstreetmap.josm.Main;
    1818import org.openstreetmap.josm.command.Command;
    19 import org.openstreetmap.josm.data.SelectionChangedListener;
     19import org.openstreetmap.josm.data.osm.DataSelectionListener;
    2020import org.openstreetmap.josm.data.osm.DataSet;
    2121import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2222import org.openstreetmap.josm.data.osm.OsmUtils;
    23 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
    2423import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    2524import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
     
    4645 * layer/selection listeners that call {@link #updateEnabledState()} whenever the global context is changed.
    4746 *
    48  * A JosmAction can register a {@link LayerChangeListener} and a {@link SelectionChangedListener}. Upon
     47 * A JosmAction can register a {@link LayerChangeListener} and a {@link DataSelectionListener}. Upon
    4948 * a layer change event or a selection change event it invokes {@link #updateEnabledState()}.
    5049 * Subclasses can override {@link #updateEnabledState()} in order to update the {@link #isEnabled()}-state
     
    203202        if (listenToSelectionChange()) {
    204203            selectionChangeAdapter = new SelectionChangeAdapter();
    205             SelectionEventManager.getInstance()
    206                 .addSelectionListener(selectionChangeAdapter, FireMode.IN_EDT_CONSOLIDATED);
     204            SelectionEventManager.getInstance().addSelectionListenerForEdt(selectionChangeAdapter);
    207205        }
    208206        initEnabledState();
     
    220218    /**
    221219     * Overwrite this if {@link #updateEnabledState()} should be called when the selection changed. Default is true.
    222      * @return <code>true</code> if a {@link SelectionChangedListener} should be registered.
     220     * @return <code>true</code> if a {@link DataSelectionListener} should be registered.
    223221     * @since 10353
    224222     */
     
    237235        }
    238236        if (selectionChangeAdapter != null) {
    239             DataSet.removeSelectionListener(selectionChangeAdapter);
     237            SelectionEventManager.getInstance().removeSelectionListener(selectionChangeAdapter);
    240238        }
    241239    }
     
    417415     * Adapter for selection change events. Runs updateEnabledState() whenever the selection changed.
    418416     */
    419     protected class SelectionChangeAdapter implements SelectionChangedListener {
    420         @Override
    421         public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    422             updateEnabledState(newSelection);
     417    protected class SelectionChangeAdapter implements DataSelectionListener {
     418        @Override
     419        public void selectionChanged(SelectionChangeEvent event) {
     420            updateEnabledState(event.getSelection());
    423421        }
    424422
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r13512 r13925  
    2929import org.openstreetmap.josm.command.SequenceCommand;
    3030import org.openstreetmap.josm.data.Bounds;
    31 import org.openstreetmap.josm.data.SelectionChangedListener;
    3231import org.openstreetmap.josm.data.coor.EastNorth;
     32import org.openstreetmap.josm.data.osm.DataSelectionListener;
    3333import org.openstreetmap.josm.data.osm.DataSet;
    3434import org.openstreetmap.josm.data.osm.Node;
     
    3636import org.openstreetmap.josm.data.osm.Way;
    3737import org.openstreetmap.josm.data.osm.WaySegment;
     38import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    3839import org.openstreetmap.josm.data.preferences.CachingProperty;
    3940import org.openstreetmap.josm.data.preferences.IntegerProperty;
     
    5960 * @author Alexander Kachkaev &lt;alexander@kachkaev.ru&gt;, 2011
    6061 */
    61 public class ImproveWayAccuracyAction extends MapMode implements
    62         SelectionChangedListener, ModifierExListener {
     62public class ImproveWayAccuracyAction extends MapMode implements DataSelectionListener, ModifierExListener {
    6363
    6464    private static final String CROSSHAIR = /* ICON(cursor/)*/ "crosshair";
     
    154154        map.mapView.addMouseMotionListener(this);
    155155        map.mapView.addTemporaryLayer(temporaryLayer);
    156         DataSet.addSelectionListener(this);
     156        SelectionEventManager.getInstance().addSelectionListener(this);
    157157
    158158        map.keyDetector.addModifierExListener(this);
     
    172172        map.mapView.removeMouseMotionListener(this);
    173173        map.mapView.removeTemporaryLayer(temporaryLayer);
    174         DataSet.removeSelectionListener(this);
     174        SelectionEventManager.getInstance().removeSelectionListener(this);
    175175
    176176        map.keyDetector.removeModifierExListener(this);
     
    368368
    369369    @Override
    370     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     370    public void selectionChanged(SelectionChangeEvent event) {
    371371        if (selectionChangedBlocked) {
    372372            return;
  • trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java

    r13611 r13925  
    1313import org.openstreetmap.josm.command.Command;
    1414import org.openstreetmap.josm.command.SequenceCommand;
    15 import org.openstreetmap.josm.data.SelectionChangedListener;
     15import org.openstreetmap.josm.data.osm.DataSelectionListener;
    1616import org.openstreetmap.josm.data.osm.DataSet;
    1717import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2828 * @since 5799
    2929 */
    30 public class AddSelectionToRelations extends AbstractRelationAction implements SelectionChangedListener {
     30public class AddSelectionToRelations extends AbstractRelationAction implements DataSelectionListener {
    3131    /**
    3232    * Constructs a new <code>AddSelectionToRelation</code>.
     
    6969    }
    7070
    71     @Override
    72     public void selectionChanged(final Collection<? extends OsmPrimitive> newSelection) {
     71    private void selectionChanged(final Collection<? extends OsmPrimitive> newSelection) {
    7372        GuiHelper.runInEDT(() -> setEnabled(newSelection != null && !newSelection.isEmpty()
    7473                && OsmUtils.isOsmCollectionEditable(relations)));
    7574    }
     75
     76    @Override
     77    public void selectionChanged(SelectionChangeEvent event) {
     78        selectionChanged(event.getSelection());
     79    }
    7680}
  • trunk/src/org/openstreetmap/josm/data/SelectionChangedListener.java

    r12098 r13925  
    3030     * Informs the listener that the selection in the dataset has changed.
    3131     * @param newSelection The new selection.
     32     * @deprecated use {@link DataSelectionListener} instead
    3233     */
     34    @Deprecated
    3335    void selectionChanged(Collection<? extends OsmPrimitive> newSelection);
    3436}
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r13916 r13925  
    548548     * themselves for any dataset selection changes that occur, regardless of the current active
    549549     * dataset. (However, the selection does only change in the active layer)
    550      */
     550     * @deprecated to be removed
     551     */
     552    @Deprecated
    551553    private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>();
    552554
     
    556558     * @see #addSelectionListener(DataSelectionListener)
    557559     * @see SelectionEventManager#removeSelectionListener(SelectionChangedListener)
    558      */
     560     * @deprecated Use {@link SelectionEventManager#addSelectionListener(DataSelectionListener)} instead
     561     */
     562    @Deprecated
    559563    public static void addSelectionListener(SelectionChangedListener listener) {
    560564        ((CopyOnWriteArrayList<SelectionChangedListener>) selListeners).addIfAbsent(listener);
     
    566570     * @see #removeSelectionListener(DataSelectionListener)
    567571     * @see SelectionEventManager#removeSelectionListener(SelectionChangedListener)
    568      */
     572     * @deprecated Use {@link SelectionEventManager#removeSelectionListener(DataSelectionListener)} instead
     573     */
     574    @Deprecated
    569575    public static void removeSelectionListener(SelectionChangedListener listener) {
    570576        selListeners.remove(listener);
    571577    }
    572578
     579    /**
     580     * @deprecated to be removed
     581     * @param currentSelection current selection
     582     */
     583    @Deprecated
    573584    private static void fireSelectionChange(Collection<? extends OsmPrimitive> currentSelection) {
    574585        for (SelectionChangedListener l : selListeners) {
  • trunk/src/org/openstreetmap/josm/data/osm/OsmData.java

    r13916 r13925  
    1111import org.openstreetmap.josm.data.DataSource;
    1212import org.openstreetmap.josm.data.ProjectionBounds;
    13 import org.openstreetmap.josm.data.SelectionChangedListener;
    1413import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    1514import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    398397    /**
    399398     * Sets the current selection to the primitives in <code>selection</code>
    400      * and notifies all {@link SelectionChangedListener}.
     399     * and notifies all {@link DataSelectionListener}.
    401400     *
    402401     * @param selection the selection
     
    406405    /**
    407406     * Sets the current selection to the primitives in <code>osm</code>
    408      * and notifies all {@link SelectionChangedListener}.
     407     * and notifies all {@link DataSelectionListener}.
    409408     *
    410409     * @param osm the primitives to set. <code>null</code> values are ignored for now, but this may be removed in the future.
     
    414413    /**
    415414     * Adds the primitives in <code>selection</code> to the current selection
    416      * and notifies all {@link SelectionChangedListener}.
     415     * and notifies all {@link DataSelectionListener}.
    417416     *
    418417     * @param selection the selection
     
    422421    /**
    423422     * Adds the primitives in <code>osm</code> to the current selection
    424      * and notifies all {@link SelectionChangedListener}.
     423     * and notifies all {@link DataSelectionListener}.
    425424     *
    426425     * @param osm the primitives to add
     
    449448     * @param listener The listener.
    450449     * @see #removeSelectionListener(DataSelectionListener)
    451      * @see SelectionEventManager#addSelectionListener(SelectionChangedListener,
    452      *      org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode)
     450     * @see SelectionEventManager#addSelectionListener(DataSelectionListener)
    453451     *      To add a global listener.
    454452     */
  • trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java

    r13434 r13925  
    4848    }
    4949
     50    /**
     51     * @deprecated to be removed
     52     */
     53    @Deprecated
    5054    private static class OldListenerInfo implements ListenerInfo {
    5155        private final SelectionChangedListener listener;
     
    130134     * @param fireMode Set this to IN_EDT_CONSOLIDATED if you want the event to be fired in the EDT thread.
    131135     *                 Set it to IMMEDIATELY if you want the event to fire in the thread that caused the selection update.
    132      */
     136     * @deprecated Use {@link #addSelectionListener(DataSelectionListener)} or {@link #addSelectionListenerForEdt(DataSelectionListener)}
     137     */
     138    @Deprecated
    133139    public void addSelectionListener(SelectionChangedListener listener, FireMode fireMode) {
    134140        if (fireMode == FireMode.IN_EDT) {
     
    163169     * Unregisters a {@code SelectionChangedListener}.
    164170     * @param listener listener to remove
    165      */
     171     * @deprecated use {@link #removeSelectionListener(DataSelectionListener)}
     172     */
     173    @Deprecated
    166174    public void removeSelectionListener(SelectionChangedListener listener) {
    167175        remove(new OldListenerInfo(listener));
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java

    r13082 r13925  
    1010
    1111import org.openstreetmap.josm.Main;
    12 import org.openstreetmap.josm.data.SelectionChangedListener;
     12import org.openstreetmap.josm.data.osm.DataSelectionListener;
    1313import org.openstreetmap.josm.data.osm.DataSet;
    1414import org.openstreetmap.josm.data.osm.Node;
     
    2323import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent;
    2424import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent;
     25import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    2526import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    2627import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
     
    3940 * @since 4623
    4041 */
    41 public final class MultipolygonCache implements DataSetListener, LayerChangeListener, ProjectionChangeListener, SelectionChangedListener {
     42public final class MultipolygonCache implements DataSetListener, LayerChangeListener, ProjectionChangeListener, DataSelectionListener {
    4243
    4344    private static final MultipolygonCache INSTANCE = new MultipolygonCache();
     
    4950    private MultipolygonCache() {
    5051        Main.addProjectionChangeListener(this);
    51         DataSet.addSelectionListener(this);
     52        SelectionEventManager.getInstance().addSelectionListener(this);
    5253        MainApplication.getLayerManager().addLayerChangeListener(this);
    5354    }
     
    294295
    295296    @Override
    296     public synchronized void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     297    public synchronized void selectionChanged(SelectionChangeEvent event) {
    297298
    298299        for (Iterator<PolyData> it = selectedPolyData.iterator(); it.hasNext();) {
     
    303304        DataSet ds = null;
    304305        Collection<Map<Relation, Multipolygon>> maps = null;
    305         for (OsmPrimitive p : newSelection) {
     306        for (OsmPrimitive p : event.getSelection()) {
    306307            if (p instanceof Way && p.getDataSet() != null) {
    307308                if (ds == null) {
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r13649 r13925  
    6060
    6161import org.openstreetmap.josm.Main;
    62 import org.openstreetmap.josm.data.SelectionChangedListener;
    6362import org.openstreetmap.josm.data.SystemOfMeasurement;
    6463import org.openstreetmap.josm.data.SystemOfMeasurement.SoMChangeListener;
     
    6867import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat;
    6968import org.openstreetmap.josm.data.coor.conversion.ProjectedCoordinateFormat;
     69import org.openstreetmap.josm.data.osm.DataSelectionListener;
    7070import org.openstreetmap.josm.data.osm.DataSet;
    7171import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
     
    121121 */
    122122public final class MapStatus extends JPanel implements
    123     Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener, SelectionChangedListener, DataSetListener, ZoomChangeListener {
     123    Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener, DataSelectionListener, DataSetListener, ZoomChangeListener {
    124124
    125125    private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Config.getPref().get("statusbar.decimal-format", "0.0"));
     
    952952        Config.getPref().addPreferenceChangeListener(this);
    953953        DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT);
    954         SelectionEventManager.getInstance().addSelectionListener(this, FireMode.IN_EDT_CONSOLIDATED);
     954        SelectionEventManager.getInstance().addSelectionListenerForEdt(this);
    955955
    956956        mvComponentAdapter = new ComponentAdapter() {
     
    12041204
    12051205    @Override
    1206     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    1207         refreshDistText(newSelection);
     1206    public void selectionChanged(SelectionChangeEvent event) {
     1207        refreshDistText(event.getSelection());
    12081208    }
    12091209
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r13852 r13925  
    6161import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent;
    6262import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent;
     63import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    6364import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    6465import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
     
    239240        newAction.updateEnabledState();
    240241        DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT);
    241         DataSet.addSelectionListener(addSelectionToRelations);
     242        SelectionEventManager.getInstance().addSelectionListener(addSelectionToRelations);
    242243        dataChanged(null);
    243244        ExpertToggleAction.addExpertModeChangeListener(this);
     
    251252        MapView.removeZoomChangeListener(this);
    252253        DatasetEventManager.getInstance().removeDatasetListener(this);
    253         DataSet.removeSelectionListener(addSelectionToRelations);
     254        SelectionEventManager.getInstance().removeSelectionListener(addSelectionToRelations);
    254255        ExpertToggleAction.removeExpertModeChangeListener(this);
    255256    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r13564 r13925  
    4242import org.openstreetmap.josm.actions.relation.EditRelationAction;
    4343import org.openstreetmap.josm.actions.relation.SelectInRelationListAction;
    44 import org.openstreetmap.josm.data.SelectionChangedListener;
     44import org.openstreetmap.josm.data.osm.DataSelectionListener;
    4545import org.openstreetmap.josm.data.osm.DataSet;
    4646import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
     
    6565import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    6666import org.openstreetmap.josm.gui.MainApplication;
     67import org.openstreetmap.josm.gui.PopupMenuHandler;
    6768import org.openstreetmap.josm.gui.PrimitiveRenderer;
    68 import org.openstreetmap.josm.gui.PopupMenuHandler;
    6969import org.openstreetmap.josm.gui.SideButton;
    7070import org.openstreetmap.josm.gui.datatransfer.PrimitiveTransferable;
     
    165165    @Override
    166166    public void showNotify() {
    167         SelectionEventManager.getInstance().addSelectionListener(actShowHistory, FireMode.IN_EDT_CONSOLIDATED);
    168         SelectionEventManager.getInstance().addSelectionListener(model, FireMode.IN_EDT_CONSOLIDATED);
     167        SelectionEventManager.getInstance().addSelectionListenerForEdt(actShowHistory);
     168        SelectionEventManager.getInstance().addSelectionListenerForEdt(model);
    169169        DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT);
    170170        MainApplication.getLayerManager().addActiveLayerChangeListener(actSearch);
     
    339339     * The action for showing history information of the current history item.
    340340     */
    341     class ShowHistoryAction extends AbstractAction implements ListSelectionListener, SelectionChangedListener {
     341    class ShowHistoryAction extends AbstractAction implements ListSelectionListener, DataSelectionListener {
    342342        /**
    343343         * Constructs a new {@code ShowHistoryAction}.
     
    372372
    373373        @Override
    374         public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    375             updateEnabledState(newSelection.size());
     374        public void selectionChanged(SelectionChangeEvent event) {
     375            updateEnabledState(event.getSelection().size());
    376376        }
    377377    }
     
    461461     */
    462462    static class SelectionListModel extends AbstractListModel<OsmPrimitive>
    463     implements ActiveLayerChangeListener, SelectionChangedListener, DataSetListener {
     463    implements ActiveLayerChangeListener, DataSelectionListener, DataSetListener {
    464464
    465465        private static final int SELECTION_HISTORY_SIZE = 10;
     
    673673
    674674        /* ------------------------------------------------------------------------ */
    675         /* interface SelectionChangedListener                                       */
     675        /* interface DataSelectionListener                                          */
    676676        /* ------------------------------------------------------------------------ */
    677677        @Override
    678         public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    679             setJOSMSelection(newSelection);
     678        public void selectionChanged(SelectionChangeEvent event) {
     679            setJOSMSelection(event.getSelection());
    680680        }
    681681
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r13905 r13925  
    3434import org.openstreetmap.josm.actions.relation.EditRelationAction;
    3535import org.openstreetmap.josm.command.Command;
    36 import org.openstreetmap.josm.data.SelectionChangedListener;
     36import org.openstreetmap.josm.data.osm.DataSelectionListener;
    3737import org.openstreetmap.josm.data.osm.DataSet;
    3838import org.openstreetmap.josm.data.osm.Node;
    3939import org.openstreetmap.josm.data.osm.OsmPrimitive;
    4040import org.openstreetmap.josm.data.osm.WaySegment;
     41import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    4142import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    4243import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
     
    7273 * @author frsantos
    7374 */
    74 public class ValidatorDialog extends ToggleDialog implements SelectionChangedListener, ActiveLayerChangeListener {
     75public class ValidatorDialog extends ToggleDialog implements DataSelectionListener, ActiveLayerChangeListener {
    7576
    7677    /** The display tree */
     
    181182    @Override
    182183    public void showNotify() {
    183         DataSet.addSelectionListener(this);
     184        SelectionEventManager.getInstance().addSelectionListener(this);
    184185        DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
    185186        if (ds != null) {
     
    192193    public void hideNotify() {
    193194        MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
    194         DataSet.removeSelectionListener(this);
     195        SelectionEventManager.getInstance().removeSelectionListener(this);
    195196    }
    196197
     
    585586
    586587    @Override
    587     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    588         updateSelection(newSelection);
     588    public void selectionChanged(SelectionChangeEvent event) {
     589        updateSelection(event.getSelection());
    589590    }
    590591
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r13854 r13925  
    5959import org.openstreetmap.josm.command.ChangePropertyCommand;
    6060import org.openstreetmap.josm.command.Command;
    61 import org.openstreetmap.josm.data.SelectionChangedListener;
    6261import org.openstreetmap.josm.data.osm.AbstractPrimitive;
     62import org.openstreetmap.josm.data.osm.DataSelectionListener;
    6363import org.openstreetmap.josm.data.osm.DataSet;
    6464import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
     
    124124 */
    125125public class PropertiesDialog extends ToggleDialog
    126 implements SelectionChangedListener, ActiveLayerChangeListener, DataSetListenerAdapter.Listener {
     126implements DataSelectionListener, ActiveLayerChangeListener, DataSetListenerAdapter.Listener {
    127127
    128128    /**
     
    512512    public void showNotify() {
    513513        DatasetEventManager.getInstance().addDatasetListener(dataChangedAdapter, FireMode.IN_EDT_CONSOLIDATED);
    514         SelectionEventManager.getInstance().addSelectionListener(this, FireMode.IN_EDT_CONSOLIDATED);
     514        SelectionEventManager.getInstance().addSelectionListenerForEdt(this);
    515515        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
    516516        for (JosmAction action : josmActions) {
     
    549549
    550550    @Override
    551     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     551    public void selectionChanged(SelectionChangeEvent event) {
    552552        if (!isVisible())
    553553            return;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r13434 r13925  
    2121import javax.swing.table.AbstractTableModel;
    2222
    23 import org.openstreetmap.josm.data.SelectionChangedListener;
    24 import org.openstreetmap.josm.data.osm.DataSet;
     23import org.openstreetmap.josm.data.osm.DataSelectionListener;
    2524import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2625import org.openstreetmap.josm.data.osm.Relation;
     
    3332import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent;
    3433import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent;
     34import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    3535import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    3636import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
     
    5353 */
    5454public class MemberTableModel extends AbstractTableModel
    55 implements TableModelListener, SelectionChangedListener, DataSetListener, OsmPrimitivesTableModel {
     55implements TableModelListener, DataSelectionListener, DataSetListener, OsmPrimitivesTableModel {
    5656
    5757    /**
     
    9797     */
    9898    public void register() {
    99         DataSet.addSelectionListener(this);
     99        SelectionEventManager.getInstance().addSelectionListener(this);
    100100        getLayer().data.addDataSetListener(this);
    101101    }
     
    105105     */
    106106    public void unregister() {
    107         DataSet.removeSelectionListener(this);
     107        SelectionEventManager.getInstance().removeSelectionListener(this);
    108108        getLayer().data.removeDataSetListener(this);
    109109    }
    110110
    111111    /* --------------------------------------------------------------------------- */
    112     /* Interface SelectionChangedListener                                          */
     112    /* Interface DataSelectionListener                                             */
    113113    /* --------------------------------------------------------------------------- */
    114114    @Override
    115     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     115    public void selectionChanged(SelectionChangeEvent event) {
    116116        if (MainApplication.getLayerManager().getActiveDataLayer() != this.layer) return;
    117117        // just trigger a repaint
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java

    r13434 r13925  
    77import javax.swing.table.AbstractTableModel;
    88
    9 import org.openstreetmap.josm.data.SelectionChangedListener;
    10 import org.openstreetmap.josm.data.osm.DataSet;
     9import org.openstreetmap.josm.data.osm.DataSelectionListener;
    1110import org.openstreetmap.josm.data.osm.OsmPrimitive;
     11import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    1212import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     
    2222/**
    2323 * This table shows the primitives that are currently selected in the main OSM view.
     24 * @since 1790
    2425 */
    25 public class SelectionTableModel extends AbstractTableModel implements SelectionChangedListener, ActiveLayerChangeListener, LayerChangeListener {
     26public class SelectionTableModel extends AbstractTableModel implements DataSelectionListener, ActiveLayerChangeListener, LayerChangeListener {
    2627
    2728    /** this selection table model only displays selected primitives in this layer */
     
    4647     */
    4748    public void register() {
    48         DataSet.addSelectionListener(this);
     49        SelectionEventManager.getInstance().addSelectionListener(this);
    4950        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
    5051    }
     
    5455     */
    5556    public void unregister() {
    56         DataSet.removeSelectionListener(this);
     57        SelectionEventManager.getInstance().removeSelectionListener(this);
    5758        MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
    5859    }
     
    106107
    107108    @Override
    108     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     109    public void selectionChanged(SelectionChangeEvent event) {
     110        selectionChanged(event.getSelection());
     111    }
     112
     113    private void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    109114        if (layer == MainApplication.getLayerManager().getActiveDataLayer()) {
    110115            cache.clear();
     
    116121    }
    117122
     123    /**
     124     * Returns the selected primitives.
     125     * @return the selected primitives
     126     */
    118127    public List<OsmPrimitive> getSelection() {
    119128        return cache;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchDialog.java

    r13069 r13925  
    77
    88import org.openstreetmap.josm.Main;
    9 import org.openstreetmap.josm.data.osm.DataSet;
     9import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    1010import org.openstreetmap.josm.gui.ExtendedDialog;
    1111
     
    3535        selector = new TaggingPresetSelector(true, true);
    3636        setContent(selector, false);
    37         DataSet.addSelectionListener(selector);
     37        SelectionEventManager.getInstance().addSelectionListener(selector);
    3838        selector.setDblClickListener(e -> buttonAction(0, null));
    3939    }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r13836 r13925  
    3535
    3636import org.openstreetmap.josm.Main;
    37 import org.openstreetmap.josm.data.SelectionChangedListener;
     37import org.openstreetmap.josm.data.osm.DataSelectionListener;
    3838import org.openstreetmap.josm.data.osm.DataSet;
    3939import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    5353 * @since 6068
    5454 */
    55 public class TaggingPresetSelector extends SearchTextResultListPanel<TaggingPreset> implements SelectionChangedListener {
     55public class TaggingPresetSelector extends SearchTextResultListPanel<TaggingPreset> implements DataSelectionListener {
    5656
    5757    private static final int CLASSIFICATION_IN_FAVORITES = 300;
     
    370370
    371371    @Override
    372     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     372    public void selectionChanged(SelectionChangeEvent event) {
    373373        typesInSelectionDirty = true;
    374374    }
Note: See TracChangeset for help on using the changeset viewer.