Project: Eclipse_Platform_UI
Bug 97337 [Contributions] javadoc for IMenuManager removeAll get/set incorrect
Reported: 2005-05-30 14:35:54 | Status: verified fixed

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();

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java