Bug 97337 [Contributions] javadoc for IMenuManager removeAll get/set incorrect
The interface IMenuManager describes the method setRemoveAllWhenShown(boolean) as following: Returns whether all items should be removed when the menu is >first< shown, but before notifying menu listeners. Looking at its implementation in MenuManager (which seems to be the only class implementing this method, NullMenuManager put aside), there is no indication that the removeAll property applies only to the first time the menu is shown. In fact, fireAboutToShow(IMenuManager manager) is only called by handleAboutToShow(), which always checks the removeAll property. Just as the setter's documentation, the getter's states: Returns whether all items should be removed when the menu is >first< shown, but before notifying menu listeners. Strangely, the @param and @return tags in the documentation are not affected. I believe that the documentation of IMenuManager should be updated to reflect the actual behaviour of MenuManager objects as following: /** * Sets whether all items should be removed when the menu is about to show, * but before notifying menu listeners. * * @param removeAll <code>true</code> if all items should be removed when shown, <code>false</code> if not */ public void setRemoveAllWhenShown(boolean removeAll); /** * Returns whether all items should be removed when the menu is about to show, * but before notifying menu listeners. The default is <code>false</code>. * * @return <code>true</code> if all items should be removed when shown, <code>false</code> if not */ public boolean getRemoveAllWhenShown();
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java
* Returns whether this menu should be enabled or not.
     *
     * @return <code>true</code> if enabled, and
     *   <code>false</code> if disabled
     */
    public boolean isEnabled();
    /**
     * Removes the given menu listener from this menu.
     * Has no effect if an identical listener is not registered.
     *
     * @param listener the menu listener
     */
    public void removeMenuListener(IMenuListener listener);
    /**
     * Sets whether all items should be removed when the menu is first shown,
     * but before notifying menu listeners.
     *
     * @param removeAll <code>true</code> if all items should be removed when shown, <code>false</code> if not 
     */
    public void setRemoveAllWhenShown(boolean removeAll);
    /**
     * Incrementally builds the menu from the contribution items, and
     * does so recursively for all submenus.
     *
     * @param force <code>true</code> means update even if not dirty,
     *   and <code>false</code> for normal incremental updating
     */
    public void updateAll(boolean force);
}