⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iaction.java

📁 jfa2ce 源码帮助开发人员更好的理解运用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************* * Copyright (c) 2000, 2005 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;import org.eclipse.core.commands.IHandlerAttributes;import org.eclipse.jface.resource.ImageDescriptor;import org.eclipse.jface.util.IPropertyChangeListener;import org.eclipse.swt.events.HelpListener;import org.eclipse.swt.widgets.Event;/** * An action represents the non-UI side of a command which can be triggered * by the end user. Actions are typically associated with buttons, menu items, * and items in tool bars. The controls for a command are built by some container, * which furnished the context where these controls appear and configures  * them with data from properties declared by the action. When the end user * triggers the command via its control, the action's <code>run</code> * method is invoked to do the real work. * <p> * Actions support a predefined set of properties (and possibly others as well). * Clients of an action may register property change listeners so that they get  * notified whenever the value of a property changes. * </p> * <p> * Clients should subclass the abstract base class <code>Action</code> to define  * concrete actions rather than implementing <code>IAction</code> from scratch. * </p> * <p> * This interface exists only to define the API for actions. * It is not intended to be implemented by clients. * </p> *  * @see Action */public interface IAction {    /**     * Action style constant (value <code>0</code>) indicating action style      * is not specified yet. By default, the action will assume a push button     * style. If <code>setChecked</code> is called, then the style will change     * to a check box, or if <code>setMenuCreator</code> is called, then the     * style will change to a drop down menu.     *      * @since 2.1     */    public static int AS_UNSPECIFIED = 0x00;    /**     * Action style constant (value <code>1</code>) indicating action is      * a simple push button.     */    public static int AS_PUSH_BUTTON = 0x01;    /**     * Action style constant (value <code>2</code>) indicating action is      * a check box (or a toggle button).     */    public static int AS_CHECK_BOX = 0x02;    /**     * Action style constant (value <code>4</code>) indicating action is      * a drop down menu.     */    public static int AS_DROP_DOWN_MENU = 0x04;    /**     * Action style constant (value <code>8</code>) indicating action is      * a radio button.     *      * @since 2.1     */    public static int AS_RADIO_BUTTON = 0x08;    /**     * Property name of an action's text (value <code>"text"</code>).     */    public static final String TEXT = "text"; //$NON-NLS-1$    /**     * Property name of an action's enabled state     * (value <code>"enabled"</code>).     */    public static final String ENABLED = "enabled"; //$NON-NLS-1$    /**     * Property name of an action's image (value <code>"image"</code>).     */    public static final String IMAGE = "image"; //$NON-NLS-1$    /**     * Property name of an action's tooltip text (value <code>"toolTipText"</code>).     */    public static final String TOOL_TIP_TEXT = "toolTipText"; //$NON-NLS-1$    /**     * Property name of an action's description (value <code>"description"</code>).     * Typically the description is shown as a (longer) help text in the status line.     */    public static final String DESCRIPTION = "description"; //$NON-NLS-1$    /**     * Property name of an action's checked status (value     * <code>"checked"</code>). Applicable when the style is     * <code>AS_CHECK_BOX</code> or <code>AS_RADIO_BUTTON</code>.     */    public static final String CHECKED = "checked"; //$NON-NLS-1$    /**     * Property name of an action's success/fail result     * (value <code>"result"</code>). The values are     * <code>Boolean.TRUE</code> if running the action succeeded and      * <code>Boolean.FALSE</code> if running the action failed or did not     * complete.     * <p>     * Not all actions report whether they succeed or fail. This property     * is provided for use by actions that may be invoked by clients that can     * take advantage of this information when present (for example, actions     * used in cheat sheets). Clients should always assume that running the     * action succeeded in the absence of notification to the contrary.      * </p>     *      * @since 3.0     */    public static final String RESULT = "result"; //$NON-NLS-1$        /**     * Property name of an action's handler. Some actions delegate some or all     * of their behaviour or state to another object. In this case, if the     * object to which behaviour has been delegated changes, then a property     * change event should be sent with this name.     *      * This is used to support backward compatibility of actions within the     * commands framework.     *      * @since 3.1     */	public static final String HANDLED = IHandlerAttributes.ATTRIBUTE_HANDLED;    /**     * Adds a property change listener to this action.     * Has no effect if an identical listener is already registered.     *     * @param listener a property change listener     */    public void addPropertyChangeListener(IPropertyChangeListener listener);    /**     * Returns the accelerator keycode for this action.     * The result is the bit-wise OR of zero or more modifier masks     * and a key, as explained in <code>MenuItem.getAccelerator</code>.     *     * @return the accelerator keycode     * @see org.eclipse.swt.widgets.MenuItem#getAccelerator()     */    public int getAccelerator();    /**     * Returns the action definition id of this action.     *      * @return the action definition id of this action, or     * <code>null</code> if none     * @since 2.0     */    public String getActionDefinitionId();    /**     * Returns the action's description if it has one.     * Otherwise it returns <code>getToolTipText()</code>.     *      * @return a description for the action; may be <code>null</code>      */    public String getDescription();    /**     * Returns the disabled image for this action as an image descriptor.     * <p>     * This method is associated with the <code>IMAGE</code> property;     * property change events are reported when its value changes.     * </p>     *     * @return the image, or <code>null</code> if this action has no image     * @see #IMAGE     */    public ImageDescriptor getDisabledImageDescriptor();    /**     * Returns a help listener for this action.      *     * @return a help listener for this action     */    public HelpListener getHelpListener();    /**     * Returns the hover image for this action as an image descriptor.     * <p>     * Hover images will be used on platforms that support changing the image     * when the user hovers over the item. This method is associated with      * the <code>IMAGE</code> property;     * property change events are reported when its value changes.     * </p>     *     * @return the image, or <code>null</code> if this action has no image     * @see #IMAGE     */    public ImageDescriptor getHoverImageDescriptor();    /**     * Returns a unique identifier for this action, or <code>null</code> if it has     * none.     *     * @return the action id, or <code>null</code> if none     */    public String getId();    /**     * Returns the image for this action as an image descriptor.     * <p>     * This method is associated with the <code>IMAGE</code> property;     * property change events are reported when its value changes.     * </p>     *     * @return the image, or <code>null</code> if this action has no image     * @see #IMAGE     */    public ImageDescriptor getImageDescriptor();    /**     * Returns the menu creator for this action.     *     * @return the menu creator, or <code>null</code> if none     */    public IMenuCreator getMenuCreator();    /**     * Return this action's style.     *     * @return one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,     * <code>AS_RADIO_BUTTON</code> and <code>AS_DROP_DOWN_MENU</code>.     */    public int getStyle();    /**     * Returns the text for this action.     * <p>     * This method is associated with the <code>TEXT</code> property;     * property change events are reported when its value changes.     * </p>     *     * @return the text, or <code>null</code> if none     * @see #TEXT     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -