[Mercurial] Removing HgCommitExecutor with the "Commit Repositories" button: changes...
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Fri, 25 Jun 2010 08:06:21 +0000 (12:06 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Fri, 25 Jun 2010 08:06:21 +0000 (12:06 +0400)
plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties
plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCommitExecutor.java [deleted file]
plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCommitSession.java [deleted file]

index fcf1a9478ed43c07fe7e95acf5a546226334d4ec..80359c1166845a5c4c1014eed89d20244058615f 100644 (file)
@@ -62,9 +62,6 @@ hg4idea.configuration.executable.error=\"{0}\" doesn''t appear to be a valid hg
 hg4idea.command.executable.error=Error executing \"{0}\". Make sure you have setup the right executable in Mercurial configuration
 
 hg4idea.commit.error.messageEmpty=Please provide a commit message
-hg4idea.commit.error.unknown=Could not commit, no error message was provided
-hg4idea.commit.repository.title=Commit Repositories
-hg4idea.commit.repository.body=Commit all changes in all affected repositories
 
 hg4idea.add.title=Add files to Mercurial
 hg4idea.add.single.title=Add file to Mercurial
index a1fdf65f15ec7eee68a150677621fa4fcc46f073..ca5031690c9bbc9558dc1fb0e664410c3a8779e5 100644 (file)
@@ -27,7 +27,6 @@ import com.intellij.openapi.vcs.CommittedChangesProvider;
 import com.intellij.openapi.vcs.ProjectLevelVcsManager;
 import com.intellij.openapi.vcs.VcsException;
 import com.intellij.openapi.vcs.annotate.AnnotationProvider;
-import com.intellij.openapi.vcs.changes.ChangeListManager;
 import com.intellij.openapi.vcs.changes.ChangeProvider;
 import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
 import com.intellij.openapi.vcs.diff.DiffProvider;
@@ -45,7 +44,6 @@ import com.intellij.util.messages.Topic;
 import org.zmlx.hg4idea.provider.*;
 import org.zmlx.hg4idea.provider.annotate.HgAnnotationProvider;
 import org.zmlx.hg4idea.provider.commit.HgCheckinEnvironment;
-import org.zmlx.hg4idea.provider.commit.HgCommitExecutor;
 import org.zmlx.hg4idea.provider.update.HgIntegrateEnvironment;
 import org.zmlx.hg4idea.provider.update.HgUpdateEnvironment;
 import org.zmlx.hg4idea.ui.HgChangesetStatus;
@@ -87,7 +85,6 @@ public class HgVcs extends AbstractVcs {
   private final HgUpdateEnvironment updateEnvironment;
   private final HgIntegrateEnvironment integrateEnvironment;
   private final HgCachingCommitedChangesProvider commitedChangesProvider;
-  private final HgCommitExecutor commitExecutor;
   private final HgCurrentBranchStatus hgCurrentBranchStatus = new HgCurrentBranchStatus();
   private final HgChangesetStatus incomingChangesStatus = new HgChangesetStatus(INCOMING_ICON);
   private final HgChangesetStatus outgoingChangesStatus = new HgChangesetStatus(OUTGOING_ICON);
@@ -115,7 +112,6 @@ public class HgVcs extends AbstractVcs {
     updateEnvironment = new HgUpdateEnvironment(project);
     integrateEnvironment = new HgIntegrateEnvironment(project);
     commitedChangesProvider = new HgCachingCommitedChangesProvider(project);
-    commitExecutor = new HgCommitExecutor(project);
     myDirStateChangeListener = new HgDirStateChangeListener(myProject);
   }
 
@@ -240,8 +236,6 @@ public class HgVcs extends AbstractVcs {
       return;
     }
 
-    ChangeListManager.getInstance(myProject).registerCommitExecutor(commitExecutor);
-
     StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
     if (statusBar != null) {
       statusBar.addWidget(hgCurrentBranchStatus, myProject);
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCommitExecutor.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCommitExecutor.java
deleted file mode 100644 (file)
index 41758e5..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2008-2010 Victor Iacoban
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software distributed under
-// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
-// either express or implied. See the License for the specific language governing permissions and
-// limitations under the License.
-package org.zmlx.hg4idea.provider.commit;
-
-import com.intellij.openapi.vcs.changes.CommitExecutor;
-import com.intellij.openapi.vcs.changes.CommitSession;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.ui.EmptyIcon;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nls;
-import org.zmlx.hg4idea.HgVcsMessages;
-
-import javax.swing.Icon;
-
-public class HgCommitExecutor implements CommitExecutor {
-
-  private final Project project;
-
-  public HgCommitExecutor(Project project) {
-    this.project = project;
-  }
-
-  @NotNull
-  public Icon getActionIcon() {
-    return new EmptyIcon(1);
-  }
-
-  @Nls
-  public String getActionText() {
-    return HgVcsMessages.message("hg4idea.commit.repository.title");
-  }
-
-  @Nls
-  public String getActionDescription() {
-    return HgVcsMessages.message("hg4idea.commit.repository.body");
-  }
-
-  @NotNull
-  public CommitSession createCommitSession() {
-    return new HgCommitSession(project);
-  }
-
-}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCommitSession.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCommitSession.java
deleted file mode 100644 (file)
index b932da9..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2008-2010 Victor Iacoban
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software distributed under
-// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
-// either express or implied. See the License for the specific language governing permissions and
-// limitations under the License.
-package org.zmlx.hg4idea.provider.commit;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vcs.FilePath;
-import com.intellij.openapi.vcs.VcsException;
-import com.intellij.openapi.vcs.changes.Change;
-import com.intellij.openapi.vcs.changes.CommitSession;
-import com.intellij.openapi.vcs.changes.ContentRevision;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.vcsUtil.VcsUtil;
-import org.apache.commons.lang.StringUtils;
-import org.zmlx.hg4idea.HgUtil;
-import org.zmlx.hg4idea.HgVcsMessages;
-import org.zmlx.hg4idea.command.HgCommandException;
-import org.zmlx.hg4idea.command.HgCommitCommand;
-
-import javax.swing.*;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-public class HgCommitSession implements CommitSession {
-
-  private final Project project;
-
-  public HgCommitSession(Project project) {
-    this.project = project;
-  }
-
-  @Deprecated
-  public JComponent getAdditionalConfigurationUI() {
-    return null;
-  }
-
-  public JComponent getAdditionalConfigurationUI(Collection<Change> changes, String commitMessage) {
-    return null;
-  }
-
-  public boolean canExecute(Collection<Change> changes, String commitMessage) {
-    return changes != null && !changes.isEmpty() && StringUtils.isNotBlank(commitMessage);
-  }
-
-  public void execute(Collection<Change> changes, String commitMessage) {
-    for (VirtualFile root : extractRoots(changes)) {
-      HgCommitCommand command = new HgCommitCommand(project, root, commitMessage);
-      try {
-        command.execute();
-        VcsUtil.showStatusMessage(
-          project, HgVcsMessages.message("hg4idea.commit.success", root.getPath())
-        );
-        HgUtil.markDirectoryDirty(project, root);
-        root.refresh(true, true);
-      } catch (HgCommandException e) {
-        VcsUtil.showErrorMessage(project, e.getMessage(), "Error");
-      } catch (VcsException e) {
-        VcsUtil.showErrorMessage(project, e.getMessage(), "Error");
-      }
-    }
-  }
-
-  public void executionCanceled() {
-  }
-
-  private Set<VirtualFile> extractRoots(Collection<Change> changes) {
-    Set<VirtualFile> result = new HashSet<VirtualFile>();
-    for (Change change : changes) {
-      ContentRevision afterRevision = change.getAfterRevision();
-      ContentRevision beforeRevision = change.getBeforeRevision();
-
-      FilePath filePath = null;
-      if (afterRevision != null) {
-        filePath = afterRevision.getFile();
-      } else if (beforeRevision != null) {
-        filePath = beforeRevision.getFile();
-      }
-
-      if (filePath == null || filePath.isDirectory()) {
-        continue;
-      }
-
-      VirtualFile repo = VcsUtil.getVcsRootFor(project, filePath);
-      if (repo != null) {
-        result.add(repo);
-      }
-    }
-    return result;
-  }
-
-}