// Path: src/org/github/irengrig/fossil4idea/checkin/FossilCheckinEnvironment.java
// public class FossilCheckinEnvironment implements CheckinEnvironment {
//   private final FossilVcs myFossilVcs;
//   // don't like it, but because of platform design
//   private boolean myPush;
// 
//   public FossilCheckinEnvironment(final FossilVcs fossilVcs) {
//     myFossilVcs = fossilVcs;
//   }
// 
//   @Nullable
//   @Override
//   public RefreshableOnComponent createAdditionalOptionsPanel(final CheckinProjectPanel panel, final PairConsumer<Object, Object> additionalDataConsumer) {
//     return null;
//   }
// 
//   @Nullable
//   @Override
//   public String getDefaultMessageFor(final FilePath[] filesToCheckin) {
//     return null;
//   }
// 
//   @Nullable
//   @Override
//   public String getHelpId() {
//     return null;
//   }
// 
//   @Override
//   public String getCheckinOperationName() {
//     return "Commit";
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> commit(final List<Change> changes, final String preparedComment) {
//     return commit(changes, preparedComment, FunctionUtil.<Object, Object>nullConstant(), null);
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> commit(final List<Change> changes, final String preparedComment,
//                                    @NotNull final NullableFunction<Object, Object> parametersHolder, final Set<String> feedback) {
//     final boolean wasToPush = myPush;
//     myPush = false;
//     final CheckinUtil checkinUtil = new CheckinUtil(myFossilVcs.getProject());
//     final List<File> files = ChangesUtil.getIoFilesFromChanges(changes);
//     final List<VcsException> exceptions = new ArrayList<VcsException>();
//     try {
//       final List<String> hashes = checkinUtil.checkin(files, preparedComment);
//       if (hashes != null && ! hashes.isEmpty()) {
//         if (feedback == null) {
//           // popup
//           PopupUtil.showBalloonForActiveComponent(createMessage(hashes), MessageType.INFO);
//         } else {
//           feedback.add(createMessage(hashes));
//         }
//         // something committed & need to push
//         if (wasToPush) {
//           checkinUtil.push();
//         }
//       }
//     } catch (VcsException e) {
//       exceptions.add(e);
//     }
//     return exceptions;
//   }
// 
//   private String createMessage(final List<String> hashes) {
//     return "Fossil: committed: " + StringUtil.join(hashes, ",");
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> scheduleMissingFileForDeletion(final List<FilePath> files) {
//     final List<VcsException> result = new ArrayList<VcsException>();
//     try {
//       AddUtil.deleteImpl(myFossilVcs.getProject(), ObjectsConvertor.convert(files, FossilUtils.FILE_PATH_FILE_CONVERTOR));
//     } catch (VcsException e) {
//       result.add(e);
//     }
//     return result;
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> scheduleUnversionedFilesForAddition(final List<VirtualFile> files) {
//     final List<VcsException> result = new ArrayList<VcsException>();
//     try {
//       AddUtil.scheduleForAddition(myFossilVcs.getProject(), ObjectsConvertor.convert(files,
//               new Convertor<VirtualFile, File>() {
//                 @Override
//                 public File convert(final VirtualFile o) {
//                   return new File(o.getPath());
//                 }
//               }));
//     } catch (VcsException e) {
//       result.add(e);
//     }
//     return result;
//   }
// 
//   @Override
//   public boolean keepChangeListAfterCommit(final ChangeList changeList) {
//     return false;
//   }
// 
//   @Override
//   public boolean isRefreshAfterCommitNeeded() {
//     return false;
//   }
// 
//   public void setPush() {
//     myPush = true;
//   }
// }


import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.CommitExecutor;
import com.intellij.openapi.vcs.changes.CommitSession;
import org.github.irengrig.fossil4idea.checkin.FossilCheckinEnvironment;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import java.util.List;
package org.github.irengrig.fossil4idea;



/**
 * Created by Irina.Chernushina on 6/1/2014.
 */
public class FossilCommitAndPushExecutor implements CommitExecutor {
  private final Project project;

  public FossilCommitAndPushExecutor(Project project) {
    this.project = project;
  }

  @Nls
  @Override
  public String getActionText() {
    return "Commit and &Push...";
  }

  @NotNull
  @Override
  public CommitSession createCommitSession() {
// Path: src/org/github/irengrig/fossil4idea/checkin/FossilCheckinEnvironment.java
// public class FossilCheckinEnvironment implements CheckinEnvironment {
//   private final FossilVcs myFossilVcs;
//   // don't like it, but because of platform design
//   private boolean myPush;
// 
//   public FossilCheckinEnvironment(final FossilVcs fossilVcs) {
//     myFossilVcs = fossilVcs;
//   }
// 
//   @Nullable
//   @Override
//   public RefreshableOnComponent createAdditionalOptionsPanel(final CheckinProjectPanel panel, final PairConsumer<Object, Object> additionalDataConsumer) {
//     return null;
//   }
// 
//   @Nullable
//   @Override
//   public String getDefaultMessageFor(final FilePath[] filesToCheckin) {
//     return null;
//   }
// 
//   @Nullable
//   @Override
//   public String getHelpId() {
//     return null;
//   }
// 
//   @Override
//   public String getCheckinOperationName() {
//     return "Commit";
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> commit(final List<Change> changes, final String preparedComment) {
//     return commit(changes, preparedComment, FunctionUtil.<Object, Object>nullConstant(), null);
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> commit(final List<Change> changes, final String preparedComment,
//                                    @NotNull final NullableFunction<Object, Object> parametersHolder, final Set<String> feedback) {
//     final boolean wasToPush = myPush;
//     myPush = false;
//     final CheckinUtil checkinUtil = new CheckinUtil(myFossilVcs.getProject());
//     final List<File> files = ChangesUtil.getIoFilesFromChanges(changes);
//     final List<VcsException> exceptions = new ArrayList<VcsException>();
//     try {
//       final List<String> hashes = checkinUtil.checkin(files, preparedComment);
//       if (hashes != null && ! hashes.isEmpty()) {
//         if (feedback == null) {
//           // popup
//           PopupUtil.showBalloonForActiveComponent(createMessage(hashes), MessageType.INFO);
//         } else {
//           feedback.add(createMessage(hashes));
//         }
//         // something committed & need to push
//         if (wasToPush) {
//           checkinUtil.push();
//         }
//       }
//     } catch (VcsException e) {
//       exceptions.add(e);
//     }
//     return exceptions;
//   }
// 
//   private String createMessage(final List<String> hashes) {
//     return "Fossil: committed: " + StringUtil.join(hashes, ",");
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> scheduleMissingFileForDeletion(final List<FilePath> files) {
//     final List<VcsException> result = new ArrayList<VcsException>();
//     try {
//       AddUtil.deleteImpl(myFossilVcs.getProject(), ObjectsConvertor.convert(files, FossilUtils.FILE_PATH_FILE_CONVERTOR));
//     } catch (VcsException e) {
//       result.add(e);
//     }
//     return result;
//   }
// 
//   @Nullable
//   @Override
//   public List<VcsException> scheduleUnversionedFilesForAddition(final List<VirtualFile> files) {
//     final List<VcsException> result = new ArrayList<VcsException>();
//     try {
//       AddUtil.scheduleForAddition(myFossilVcs.getProject(), ObjectsConvertor.convert(files,
//               new Convertor<VirtualFile, File>() {
//                 @Override
//                 public File convert(final VirtualFile o) {
//                   return new File(o.getPath());
//                 }
//               }));
//     } catch (VcsException e) {
//       result.add(e);
//     }
//     return result;
//   }
// 
//   @Override
//   public boolean keepChangeListAfterCommit(final ChangeList changeList) {
//     return false;
//   }
// 
//   @Override
//   public boolean isRefreshAfterCommitNeeded() {
//     return false;
//   }
// 
//   public void setPush() {
//     myPush = true;
//   }
// }


// Path: src/org/github/irengrig/fossil4idea/FossilCommitAndPushExecutor.java
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.CommitExecutor;
import com.intellij.openapi.vcs.changes.CommitSession;
import org.github.irengrig.fossil4idea.checkin.FossilCheckinEnvironment;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import java.util.List;

package org.github.irengrig.fossil4idea;



/**
 * Created by Irina.Chernushina on 6/1/2014.
 */
public class FossilCommitAndPushExecutor implements CommitExecutor {
  private final Project project;

  public FossilCommitAndPushExecutor(Project project) {
    this.project = project;
  }

  @Nls
  @Override
  public String getActionText() {
    return "Commit and &Push...";
  }

  @NotNull
  @Override
  public CommitSession createCommitSession() {
    ((FossilCheckinEnvironment) FossilVcs.getInstance(project).createCheckinEnvironment()).setPush();