All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.ui.menus.CommandContributionItemParameter Maven / Gradle / Ivy

There is a newer version: 3.108.0.v20160602-1232
Show newest version
/*******************************************************************************
 * Copyright (c) 2007, 2008 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.ui.menus;

import java.util.Map;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.services.IServiceLocator;

/**
 * A help class for the various parameters that can be used with command
 * contributions. Mandatory parameters are in the constructor, and public fields
 * can be set to fill in other parameters.
 *
 * @since 3.4
 */
public class CommandContributionItemParameter {
	/**
	 * a service locator that is most appropriate for this contribution.
	 * Typically the local {@link IWorkbenchWindow} or
	 * {@link IWorkbenchPartSite} will be sufficient. Must not be
	 * null.
	 */
	public IServiceLocator serviceLocator;

	/**
	 * The id for this item. May be null. Items without an id
	 * cannot be referenced later.
	 */
	public String id;

	/**
	 * A command id for a defined command. Must not be null.
	 */
	public String commandId;

	/**
	 * A map of strings to strings which represent parameter names to values.
	 * The parameter names must match those in the command definition. May be
	 * null
	 */
	public Map parameters;

	/**
	 * An icon for this item. May be null.
	 */
	public ImageDescriptor icon;

	/**
	 * A disabled icon for this item. May be null.
	 */
	public ImageDescriptor disabledIcon;

	/**
	 * A hover icon for this item. May be null.
	 */
	public ImageDescriptor hoverIcon;

	/**
	 * A label for this item. May be null.
	 */
	public String label;

	/**
	 * A mnemonic for this item to be applied to the label. May be
	 * null.
	 */
	public String mnemonic;

	/**
	 * A tooltip for this item. May be null. Tooltips are
	 * currently only valid for toolbar contributions.
	 */
	public String tooltip;

	/**
	 * The style of this menu contribution. See the CommandContributionItem
	 * STYLE_* contants.
	 */
	public int style;

	/**
	 * The help context id to be applied to this contribution. May be
	 * null
	 */
	public String helpContextId;

	/**
	 * The icon style to use. May be null for default style.
	 *
	 * @see org.eclipse.ui.commands.ICommandImageService
	 */
	public String iconStyle;

	/**
	 * The visibility tracking for a menu contribution.
	 */
	public boolean visibleEnabled;

	/**
	 * Any number of mode bits, like
	 * {@link CommandContributionItem#MODE_FORCE_TEXT}.
	 */
	public int mode;

	/**
	 * Create the parameter object. Nullable attributes can be set directly.
	 *
	 * @param serviceLocator
	 *            a service locator that is most appropriate for this
	 *            contribution. Typically the local {@link IWorkbenchWindow} or
	 *            {@link IWorkbenchPartSite} will be sufficient. Must not be
	 *            null.
	 * @param id
	 *            The id for this item. May be null. Items
	 *            without an id cannot be referenced later.
	 * @param commandId
	 *            A command id for a defined command. Must not be
	 *            null.
	 * @param style
	 *            The style of this menu contribution. See the STYLE_* contants.
	 */
	public CommandContributionItemParameter(IServiceLocator serviceLocator,
			String id, String commandId, int style) {
		this.serviceLocator = serviceLocator;
		this.id = id;
		this.commandId = commandId;
		this.style = style;
	}

	/**
	 * Build the parameter object.
	 * 

* Note: This constructor should not be called outside the framework. *

* * @param serviceLocator * a service locator that is most appropriate for this * contribution. Typically the local {@link IWorkbenchWindow} or * {@link IWorkbenchPartSite} will be sufficient. Must not be * null. * @param id * The id for this item. May be null. Items * without an id cannot be referenced later. * @param commandId * A command id for a defined command. Must not be * null. * @param parameters * A map of strings to strings which represent parameter names to * values. The parameter names must match those in the command * definition. May be null * @param icon * An icon for this item. May be null. * @param disabledIcon * A disabled icon for this item. May be null. * @param hoverIcon * A hover icon for this item. May be null. * @param label * A label for this item. May be null. * @param mnemonic * A mnemonic for this item to be applied to the label. May be * null. * @param tooltip * A tooltip for this item. May be null. Tooltips * are currently only valid for toolbar contributions. * @param style * The style of this menu contribution. See the STYLE_* contants. * @param helpContextId * the help context id to be applied to this contribution. May be * null * @param visibleEnabled * Visibility tracking for the menu contribution. * @noreference This constructor is not intended to be referenced by clients. */ public CommandContributionItemParameter(IServiceLocator serviceLocator, String id, String commandId, Map parameters, ImageDescriptor icon, ImageDescriptor disabledIcon, ImageDescriptor hoverIcon, String label, String mnemonic, String tooltip, int style, String helpContextId, boolean visibleEnabled) { this.serviceLocator = serviceLocator; this.id = id; this.commandId = commandId; this.parameters = parameters; this.icon = icon; this.disabledIcon = disabledIcon; this.hoverIcon = hoverIcon; this.label = label; this.mnemonic = mnemonic; this.tooltip = tooltip; this.style = style; this.helpContextId = helpContextId; this.visibleEnabled = visibleEnabled; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy