Changeset 3416 in josm


Ignore:
Timestamp:
2010-08-05T07:58:54+02:00 (14 years ago)
Author:
jttt
Message:

Add Dataset.add/removeSelectionListener methods, change eclipse project to java 1.6

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r3167 r3416  
    1616        <classpathentry kind="lib" path="test/lib/fest/MRJToolkitStubs-1.0.jar"/>
    1717        <classpathentry kind="lib" path="test/lib/jfcunit.jar"/>
    18         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     18        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 6"/>
    1919        <classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
    2020        <classpathentry kind="lib" path="lib/signpost-core-1.1.jar"/>
  • trunk/.settings/org.eclipse.jdt.core.prefs

    r2899 r3416  
    1 #Mon Jan 11 09:44:51 EST 2010
     1#Sun May 23 17:35:27 CEST 2010
    22eclipse.preferences.version=1
    33org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
    4 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
     4org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
    55org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
    6 org.eclipse.jdt.core.compiler.compliance=1.5
     6org.eclipse.jdt.core.compiler.compliance=1.6
    77org.eclipse.jdt.core.compiler.debug.lineNumber=generate
    88org.eclipse.jdt.core.compiler.debug.localVariable=generate
     
    7272org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
    7373org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
    74 org.eclipse.jdt.core.compiler.source=1.5
     74org.eclipse.jdt.core.compiler.source=1.6
    7575org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
    7676org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r3385 r3416  
    9696        }
    9797        MapView.removeLayerChangeListener(layerChangeAdapter);
    98         DataSet.selListeners.remove(selectionChangeAdapter);
     98        DataSet.removeSelectionListener(selectionChangeAdapter);
    9999    }
    100100
     
    131131        selectionChangeAdapter = new SelectionChangeAdapter();
    132132        MapView.addLayerChangeListener(layerChangeAdapter);
    133         DataSet.selListeners.add(selectionChangeAdapter);
     133        DataSet.addSelectionListener(selectionChangeAdapter);
    134134        initEnabledState();
    135135    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r3327 r3416  
    218218        Main.map.mapView.addMouseMotionListener(this);
    219219        Main.map.mapView.addTemporaryLayer(this);
    220         DataSet.selListeners.add(this);
     220        DataSet.addSelectionListener(this);
    221221
    222222        try {
     
    233233        Main.map.mapView.removeMouseMotionListener(this);
    234234        Main.map.mapView.removeTemporaryLayer(this);
    235         DataSet.selListeners.remove(this);
     235        DataSet.removeSelectionListener(this);
    236236        removeHighlighting();
    237237        try {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r3414 r3416  
    322322     * themselves for any dataset selection changes that occur, regardless of the current active
    323323     * dataset. (However, the selection does only change in the active layer)
    324      */
    325     public static final Collection<SelectionChangedListener> selListeners =
    326         Collections.synchronizedList(new LinkedList<SelectionChangedListener>());
     324     * @deprecated Use addSelectionListener/removeSelectionListener instead
     325     */
     326    @Deprecated
     327    public static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<SelectionChangedListener>();
     328
     329    public static void addSelectionListener(SelectionChangedListener listener) {
     330        ((CopyOnWriteArrayList<SelectionChangedListener>)selListeners).addIfAbsent(listener);
     331    }
     332
     333    public static void removeSelectionListener(SelectionChangedListener listener) {
     334        selListeners.remove(listener);
     335    }
    327336
    328337    /**
  • trunk/src/org/openstreetmap/josm/data/osm/DatasetCollection.java

    r3207 r3416  
    5050    private final Collection<? extends OsmPrimitive> primitives;
    5151    private final Predicate<OsmPrimitive> predicate;
     52    int size = -1;
    5253
    5354    public DatasetCollection(Collection<? extends OsmPrimitive> primitives, Predicate<OsmPrimitive> predicate) {
     
    6364    @Override
    6465    public int size() {
    65         int size = 0;
    66         Iterator<T> it = iterator();
    67         while (it.hasNext()) {
    68             size++;
    69             it.next();
     66        if (size == -1) {
     67            size = 0;
     68            Iterator<T> it = iterator();
     69            while (it.hasNext()) {
     70                size++;
     71                it.next();
     72            }
    7073        }
    7174        return size;
  • trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java

    r3083 r3416  
    4949
    5050    public SelectionEventManager() {
    51         DataSet.selListeners.add(this);
     51        DataSet.addSelectionListener(this);
    5252    }
    5353
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r3327 r3416  
    222222
    223223        // listend to selection changes to redraw the map
    224         DataSet.selListeners.add(new SelectionChangedListener(){
     224        DataSet.addSelectionListener(new SelectionChangedListener(){
    225225            public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    226226                repaint();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r3206 r3416  
    115115        ChangesetCache.getInstance().addChangesetCacheListener(inSelectionModel);
    116116        MapView.addEditLayerChangeListener(inSelectionModel);
    117         DataSet.selListeners.add(inSelectionModel);
     117        DataSet.addSelectionListener(inSelectionModel);
    118118
    119119        // let the model for changesets in the current layer listen to various
     
    141141        //
    142142        MapView.removeEditLayerChangeListener(inSelectionModel);
    143         DataSet.selListeners.remove(inSelectionModel);
     143        DataSet.removeSelectionListener(inSelectionModel);
    144144    }
    145145
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r3078 r3416  
    121121    @Override
    122122    public void showNotify() {
    123         DataSet.selListeners.add(this);
     123        DataSet.addSelectionListener(this);
    124124        MapView.addEditLayerChangeListener(this, true);
    125125        refreshView();
     
    129129    public void hideNotify() {
    130130        MapView.removeEditLayerChangeListener(this);
    131         DataSet.selListeners.remove(this);
     131        DataSet.removeSelectionListener(this);
    132132    }
    133133
  • trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r2961 r3416  
    7171                        Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 150);
    7272        build();
    73         DataSet.selListeners.add(model);
     73        DataSet.addSelectionListener(model);
    7474
    7575        HelpUtil.setHelpContext(this, HelpUtil.ht("/Dialog/HistoryDialog"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r3071 r3416  
    7171    @Override
    7272    public void showNotify() {
    73         DataSet.selListeners.add(this);
     73        DataSet.addSelectionListener(this);
    7474        MapView.addLayerChangeListener(this);
    7575    }
     
    7878    public void hideNotify() {
    7979        MapView.removeLayerChangeListener(this);
    80         DataSet.selListeners.remove(this);
     80        DataSet.removeSelectionListener(this);
    8181    }
    8282
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r3095 r3416  
    7373
    7474    public void register() {
    75         DataSet.selListeners.add(this);
     75        DataSet.addSelectionListener(this);
    7676        getLayer().data.addDataSetListener(this);
    7777    }
    7878
    7979    public void unregister() {
    80         DataSet.selListeners.remove(this);
     80        DataSet.removeSelectionListener(this);
    8181        getLayer().data.removeDataSetListener(this);
    8282    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java

    r3095 r3416  
    3636
    3737    public void register() {
    38         DataSet.selListeners.add(this);
     38        DataSet.addSelectionListener(this);
    3939        MapView.addLayerChangeListener(this);
    4040    }
    4141
    4242    public void unregister() {
    43         DataSet.selListeners.remove(this);
     43        DataSet.removeSelectionListener(this);
    4444        MapView.removeLayerChangeListener(this);
    4545    }
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r3408 r3416  
    202202        conflicts = new ConflictCollection();
    203203        data.addDataSetListener(new DataSetListenerAdapter(this));
    204         DataSet.selListeners.add(this);
     204        DataSet.addSelectionListener(this);
    205205    }
    206206
     
    653653    @Override
    654654    public void destroy() {
    655         DataSet.selListeners.remove(this);
     655        DataSet.removeSelectionListener(this);
    656656    }
    657657
Note: See TracChangeset for help on using the changeset viewer.