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
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.action;
/**
 * The <code>IMenuManager</code> interface provides protocol for managing
 * contributions to a menu bar and its sub menus.
 * An <code>IMenuManager</code> is also an <code>IContributionItem</code>,
 * allowing sub-menus to be nested in parent menus.
 * <p>
 * This interface is internal to the framework; it should not be implemented outside
 * the framework.
 * </p>
 * <p>
 * This package provides a concrete menu manager implementation,
 * {@link MenuManager <code>MenuManager</code>}.
 * </p>
 */
public interface IMenuManager extends IContributionManager, IContributionItem {