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

📄 uiaction.java

📁 mywork是rcp开发的很好的例子
💻 JAVA
字号:
/*
 * Created on 2003-4-10
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package net.sf.pim.action;

import net.sf.pim.UiCore;
import net.sf.pim.UiUtil;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;

/**
 * @author lzhang
 */
public abstract class UiAction extends org.eclipse.jface.action.Action implements IWorkbenchWindowActionDelegate {
    protected UiCore parent;
    protected String name;
    protected String gif;
    protected int quick=0;
    
    public UiAction() {
    }

    public String getText() {
        return name;
    }

    public String getToolTipText() {
        return name;
    }
    
    @Override
	public int getAccelerator() {
    	return quick;
	}

	@Override
	public void run() {
		parent=UiUtil.getInstance();
		IAction action = UiUtil.getActionMap().get(this.getClass().getSimpleName()+"_"+UiUtil.getActiveTableEditor().getName());
		//20061001实现一个类似于retarget的方案,允许每个view有自己的同名action
		if(action != null){
			action.run();
		}
	}

	
	/**以下是一组关于workbenchaction的接口*/
	public void dispose() {
	}

	public void init(IWorkbenchWindow window) {
	}

	public void run(IAction action) {
		if(isEnabled())
			this.run();
	}

	public void selectionChanged(IAction action, ISelection selection) {
	}
	
	
}

⌨️ 快捷键说明

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