Changeset 2260 in josm


Ignore:
Timestamp:
Oct 10, 2009 12:01:59 PM (4 years ago)
Author:
Gubaer
Message:

added documentation, fixed initialization of enabled state of JosmAction

File:
1 edited

Legend:

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

    r2256 r2260  
    152152    } 
    153153 
    154  
     154    /** 
     155     * Override in subclasses to init the enabled state of an action when it is 
     156     * created. Default behaviour is to call {@see #updateEnabledState()} 
     157     *  
     158     * @see #updateEnabledState() 
     159     * @see #updateEnabledState(Collection) 
     160     */ 
    155161    protected void initEnabledState() { 
    156         setEnabled(true); 
    157     } 
    158  
     162        updateEnabledState(); 
     163    } 
     164 
     165    /** 
     166     * Override in subclasses to update the enabled state of the action when 
     167     * something in the JOSM state changes, i.e. when a layer is removed or added. 
     168     *  
     169     * See {@see #updateEnabledState(Collection)} to respond to changes in the collection 
     170     * of selected primitives. 
     171     *  
     172     * Default behavior is empty. 
     173     *  
     174     * @see #updateEnabledState(Collection) 
     175     * @see #initEnabledState() 
     176     */ 
    159177    protected void updateEnabledState() { 
    160  
    161     } 
    162  
     178    } 
     179 
     180    /** 
     181     * Override in subclasses to update the enabled state of the action if the 
     182     * collection of selected primitives changes. This method is called with the 
     183     * new selection. Avoid calling getCurrentDataSet().getSelected() because this 
     184     * loops over the complete data set. 
     185     *  
     186     * @param selection the collection of selected primitives 
     187     *  
     188     * @see #updateEnabledState() 
     189     * @see #initEnabledState() 
     190     */ 
    163191    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 
    164  
    165192    } 
    166193 
Note: See TracChangeset for help on using the changeset viewer.