Package org.intellij.vcs.mks.actions

Source Code of org.intellij.vcs.mks.actions.SourceIntegrityPreferencesAction

package org.intellij.vcs.mks.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.mks.api.CmdRunner;
import com.mks.api.Command;
import com.mks.api.Option;
import com.mks.api.response.APIException;
import org.intellij.vcs.mks.MKSAPIHelper;
import org.intellij.vcs.mks.MksBundle;
import org.intellij.vcs.mks.MksVcs;

import java.util.ArrayList;

public class SourceIntegrityPreferencesAction extends AnAction {

    public SourceIntegrityPreferencesAction() {
    }

    @Override
    public void actionPerformed(final AnActionEvent anActionEvent) {
        try {
            final CmdRunner runner =  MKSAPIHelper.getInstance().getSession().createCmdRunner();
            Command command = new Command(Command.SI);
            command.setCommandName("viewprefs");
            command.addOption(new Option("gui"));
            runner.execute(command);
        } catch (APIException e) {
            final Project project = PlatformDataKeys.PROJECT.getData(anActionEvent.getDataContext());
            ArrayList<VcsException> errors = new ArrayList<VcsException>();
            //noinspection ThrowableInstanceNeverThrown
            errors.add(new VcsException(e));
            MksVcs.getInstance(project).showErrors(errors, MksBundle.message("action.mks.preferences"));
        }


    }
}
TOP

Related Classes of org.intellij.vcs.mks.actions.SourceIntegrityPreferencesAction

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.