Package org.intellij.vcs.mks.actions.triclops

Source Code of org.intellij.vcs.mks.actions.triclops.AbstractMultipleTargetTriclopsCommand

package org.intellij.vcs.mks.actions.triclops;

import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import mks.integrations.common.TriclopsException;
import mks.integrations.common.TriclopsSiMembers;
import org.intellij.vcs.mks.MKSHelper;
import org.intellij.vcs.mks.MksVcs;
import org.intellij.vcs.mks.MksVcsException;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

import java.text.MessageFormat;
import java.util.List;

public abstract class AbstractMultipleTargetTriclopsCommand extends AbstractTriclopsCommand {
  public void executeCommand(@NotNull MksVcs mksVcs, @NotNull List<VcsException> exceptions,
                 @NotNull VirtualFile[] affectedFiles) throws VcsException {
    TriclopsSiMembers[] members = createSiMembers(mksVcs, affectedFiles);
    for (TriclopsSiMembers siMembers : members) {
      try {
        // todo if active change list is an mks one, use it as the change package ?
        perform(siMembers);
      } catch (TriclopsException e) {
        if (!MKSHelper.isLastCommandCancelled()) {
          @Nls final String message = "{0} Error: {1}";
          //noinspection ThrowableInstanceNeverThrown
          exceptions.add(new MksVcsException(
              MessageFormat.format(message, getActionName(mksVcs), MKSHelper.getMksErrorMessage()), e));
        }
      }
    }
  }

  protected abstract void perform(@NotNull TriclopsSiMembers siMembers) throws TriclopsException;

}
TOP

Related Classes of org.intellij.vcs.mks.actions.triclops.AbstractMultipleTargetTriclopsCommand

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.