Package org.jbpm.ui.common.action

Source Code of org.jbpm.ui.common.action.UpdateJpdlVersionAction

package org.jbpm.ui.common.action;

import org.eclipse.gef.commands.Command;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.jbpm.ui.JpdlVersionRegistry;
import org.jbpm.ui.common.command.UpdateJpdlVersionCommand;
import org.jbpm.ui.common.model.ProcessDefinition;
import org.jbpm.ui.editor.DesignerEditor;

public class UpdateJpdlVersionAction extends BaseActionDelegate {

    public void run(IAction action) {
         DesignerEditor editor = getActiveDesignerEditor();
         Command command = new UpdateJpdlVersionCommand(editor, editor.getDefinitionFile(), editor.getDefinition());
         executeCommand(command);
    }

    @Override
    public void selectionChanged(IAction action, ISelection selection) {
        super.selectionChanged(action, selection);
        if (selectedPart != null) {
            ProcessDefinition definition = (ProcessDefinition) selectedPart.getModel();
            action.setEnabled(JpdlVersionRegistry.canBeUpdatedToNextVersion(definition));
        } else {
            action.setEnabled(false);
        }
    }

}
TOP

Related Classes of org.jbpm.ui.common.action.UpdateJpdlVersionAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.