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

📄 redoaction.java

📁 对eclipse gef进行封装,可以生成图形化编辑器
💻 JAVA
字号:
/*******************************************************************************
 * $Header: /cvsroot/EOS6/work_dir/niegy/com.primeton.studio.gef.ui/src/com/primeton/studio/gef/ui/properties/RedoAction.java,v 1.1 2006/11/17 03:15:13 niegy Exp $
 * $Revision: 1.1 $
 * $Date: 2006/11/17 03:15:13 $
 *
 *==============================================================================
 *
 * Copyright (c) 2001-2006 Primeton Technologies, Ltd.
 * All rights reserved. 
 * 
 * Created on 2006-10-26
 *******************************************************************************/


package com.primeton.studio.gef.ui.properties;

import java.text.MessageFormat;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gef.internal.GEFMessages;
import org.eclipse.jface.action.Action;

/**
 * TODO此处填写 class 信息
 *
 * @author niegy (mailto:niegy@primeton.com)
 */
/*
 * 修改历史
 * $Log: RedoAction.java,v $
 * Revision 1.1  2006/11/17 03:15:13  niegy
 * create
 * 
 */
public class RedoAction extends Action {
    private CommandStack cmdStack;

    public RedoAction(CommandStack commandStack)
    {
        cmdStack = commandStack;
    }

    protected boolean calculateEnabled()
    {
        return cmdStack.canRedo();
    }

    protected String getLabelForCommand(Command command)
    {
        if(command == null)
            return "";
        if(command.getLabel() == null)
            return "";
        else
            return command.getLabel();
    }

    public void run()
    {
        cmdStack.redo();
    }

    protected void refresh()
    {
        Command redoCmd = cmdStack.getRedoCommand();
        setToolTipText(MessageFormat.format(GEFMessages.RedoAction_Tooltip, new Object[] {
            getLabelForCommand(redoCmd)
        }).trim());
        setText(MessageFormat.format(GEFMessages.RedoAction_Label, new Object[] {
            getLabelForCommand(redoCmd)
        }).trim());
        setEnabled(calculateEnabled());
    }
}

⌨️ 快捷键说明

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