Package org.jbpm.ui.common.action

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

package org.jbpm.ui.common.action;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IAction;
import org.jbpm.ui.DesignerLogger;
import org.jbpm.ui.PluginConstants;
import org.jbpm.ui.common.model.FormNode;
import org.jbpm.ui.common.part.graph.FormNodeEditPart;
import org.jbpm.ui.util.IOUtils;

public abstract class OpenFormEditorDelegate extends BaseActionDelegate {

    public void run(IAction action) {
        try {
            FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
            String fileName = formNode.getFormFileName();
            IFile file = IOUtils.getAdjacentFile(getDefinitionFile(), fileName);
            if (!PluginConstants.UTF_ENCODING.equalsIgnoreCase(file.getCharset())) {
              // TODO bug for imported processes fixed in ExportParWizard now
              file.setCharset(PluginConstants.UTF_ENCODING, null);
            }
            openInEditor(file, formNode);
        } catch (CoreException e) {
            DesignerLogger.logError(e);
            throw new RuntimeException(e);
        }
    }

    protected abstract void openInEditor(IFile file, FormNode formNode) throws CoreException;

}
TOP

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

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.