Move showSubmittedFiles() to GitUtil, because it has some custom parameters used by callers.
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vcs.AbstractVcsHelper;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.FilePathsHelper;
+import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Consumer;
import com.intellij.util.Function;
+import com.intellij.util.ui.UIUtil;
import com.intellij.vcsUtil.VcsFileUtil;
import com.intellij.vcsUtil.VcsUtil;
import git4idea.changes.GitChangeUtils;
import git4idea.repo.GitRemote;
import git4idea.repo.GitRepository;
import git4idea.repo.GitRepositoryManager;
+import git4idea.util.GitUIUtil;
import git4idea.util.StringScanner;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
return "File";
}
}
+
+ /**
+ * Show changes made in the specified revision.
+ *
+ * @param project the project
+ * @param revision the revision number
+ * @param file the file affected by the revision
+ * @param local pass true to let the diff be editable, i.e. making the revision "at the right" be a local (current) revision.
+ * pass false to let both sides of the diff be non-editable.
+ * @param revertable pass true to let "Revert" action be active.
+ */
+ public static void showSubmittedFiles(final Project project, final String revision, final VirtualFile file,
+ final boolean local, final boolean revertable) {
+ new Task.Backgroundable(project, GitBundle.message("changes.retrieving", revision)) {
+ public void run(@NotNull ProgressIndicator indicator) {
+ indicator.setIndeterminate(true);
+ try {
+ VirtualFile vcsRoot = getGitRoot(file);
+ final CommittedChangeList changeList = GitChangeUtils.getRevisionChanges(project, vcsRoot, revision, true, local, revertable);
+ if (changeList != null) {
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ public void run() {
+ AbstractVcsHelper.getInstance(project).showChangesListBrowser(changeList,
+ GitBundle.message("paths.affected.title", revision));
+ }
+ });
+ }
+ }
+ catch (final VcsException e) {
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ public void run() {
+ GitUIUtil.showOperationError(project, e, "git show");
+ }
+ });
+ }
+ }
+ }.queue();
+ }
+
}
+++ /dev/null
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * 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 git4idea.actions;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.Task;
-import com.intellij.openapi.project.DumbAware;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.IconLoader;
-import com.intellij.openapi.vcs.AbstractVcsHelper;
-import com.intellij.openapi.vcs.VcsDataKeys;
-import com.intellij.openapi.vcs.VcsException;
-import com.intellij.openapi.vcs.history.VcsFileRevision;
-import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ui.UIUtil;
-import git4idea.GitFileRevision;
-import git4idea.GitUtil;
-import git4idea.changes.GitChangeUtils;
-import git4idea.i18n.GitBundle;
-import git4idea.util.GitUIUtil;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Initial code for show submitted files action, this action is accessed from history view
- */
-public class GitShowAllSubmittedFilesAction extends AnAction implements DumbAware {
-
- /**
- * A constructor
- */
- public GitShowAllSubmittedFilesAction() {
- super(GitBundle.message("show.all.paths.affected.action.name"), null, IconLoader.getIcon("/icons/allRevisions.png"));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void update(AnActionEvent e) {
- super.update(e);
- final Project project = e.getData(PlatformDataKeys.PROJECT);
- if (project == null) {
- e.getPresentation().setEnabled(false);
- return;
- }
- final VirtualFile revisionVirtualFile = e.getData(VcsDataKeys.VCS_VIRTUAL_FILE);
- e.getPresentation().setEnabled((e.getData(VcsDataKeys.VCS_FILE_REVISION) != null) && (revisionVirtualFile != null));
- }
-
- /**
- * {@inheritDoc}
- */
- public void actionPerformed(AnActionEvent e) {
- final Project project = e.getData(PlatformDataKeys.PROJECT);
- if (project == null) return;
- final VcsFileRevision revision = e.getData(VcsDataKeys.VCS_FILE_REVISION);
- final VirtualFile revisionVirtualFile = e.getData(VcsDataKeys.VCS_VIRTUAL_FILE);
- if ((revision != null) && (revisionVirtualFile != null)) {
- final GitFileRevision gitRevision = ((GitFileRevision)revision);
- showSubmittedFiles(project, gitRevision, revisionVirtualFile);
- }
- }
-
- /**
- * Show submitted files
- *
- * @param project a project
- * @param revision a file revision
- * @param file file affected by the revision
- */
- public static void showSubmittedFiles(final Project project, final VcsFileRevision revision, final VirtualFile file) {
- showSubmittedFiles(project, revision.getRevisionNumber().asString(), file, false, true);
- }
-
- /**
- * Show submitted files
- *
- * @param project a project
- * @param revision a revision number
- * @param file file affected by the revision
- * @param local
- * @param revertable
- */
- public static void showSubmittedFiles(final Project project, final String revision, final VirtualFile file,
- final boolean local, final boolean revertable) {
- new Task.Backgroundable(project, GitBundle.message("changes.retrieving", revision)) {
- public void run(@NotNull ProgressIndicator indicator) {
- indicator.setIndeterminate(true);
- try {
- VirtualFile vcsRoot = GitUtil.getGitRoot(file);
- final CommittedChangeList changeList = GitChangeUtils.getRevisionChanges(project, vcsRoot, revision, true, local, revertable);
- if (changeList != null) {
- UIUtil.invokeLaterIfNeeded(new Runnable() {
- public void run() {
- AbstractVcsHelper.getInstance(project)
- .showChangesListBrowser(changeList, GitShowAllSubmittedFilesAction.getTitle(revision));
- }
- });
- }
- }
- catch (final VcsException e) {
- UIUtil.invokeLaterIfNeeded(new Runnable() {
- public void run() {
- GitUIUtil.showOperationError(project, e, "git show");
- }
- });
- }
- }
- }.queue();
- }
-
-
- /**
- * Get dialog title
- *
- * @param revNumber a revision number for the dialog
- * @return a dialog title
- */
- private static String getTitle(final String revNumber) {
- return GitBundle.message("paths.affected.title", revNumber);
- }
-}
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vcs.VcsException;
+import com.intellij.openapi.vcs.annotate.ShowAllAffectedGenericAction;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.history.*;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.GitRevisionNumber;
import git4idea.GitUtil;
import git4idea.GitVcs;
-import git4idea.actions.GitShowAllSubmittedFilesAction;
import git4idea.changes.GitChangeUtils;
import git4idea.config.GitExecutableValidator;
import git4idea.history.browser.SHAHash;
}
public AnAction[] getAdditionalActions(Runnable refresher) {
- return new AnAction[]{new GitShowAllSubmittedFilesAction(), new GitCopyHistoryRevisionNumberAction()};
+ return new AnAction[]{new ShowAllAffectedGenericAction(), new GitCopyHistoryRevisionNumberAction()};
}
public boolean isDateOmittable() {
import com.intellij.util.ListWithSelection;
import com.intellij.util.ui.ComboBoxTableCellEditor;
import com.intellij.util.ui.ComboBoxTableCellRenderer;
-import git4idea.actions.GitShowAllSubmittedFilesAction;
-import git4idea.util.StringScanner;
+import git4idea.GitUtil;
import git4idea.config.GitConfigUtil;
import git4idea.i18n.GitBundle;
+import git4idea.util.StringScanner;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
return;
}
GitRebaseEntry entry = myTableModel.myEntries.get(row);
- GitShowAllSubmittedFilesAction.showSubmittedFiles(project, entry.getCommit(), gitRoot, false, false);
+ GitUtil.showSubmittedFiles(project, entry.getCommit(), gitRoot, false, false);
}
});
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.DocumentAdapter;
import git4idea.GitRevisionNumber;
-import git4idea.actions.GitShowAllSubmittedFilesAction;
+import git4idea.GitUtil;
import git4idea.util.GitUIUtil;
import javax.swing.*;
myLastResult = false;
try {
GitRevisionNumber revision = GitRevisionNumber.resolve(myProject, gitRoot(), revisionExpression);
- GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, revision.asString(), gitRoot(), false, false);
+ GitUtil.showSubmittedFiles(myProject, revision.asString(), gitRoot(), false, false);
myLastResult = true;
}
catch (VcsException ex) {
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.DocumentAdapter;
import com.intellij.util.Consumer;
-import git4idea.GitBranch;
-import git4idea.GitRevisionNumber;
-import git4idea.GitVcs;
-import git4idea.PlatformFacade;
-import git4idea.actions.GitShowAllSubmittedFilesAction;
+import git4idea.*;
import git4idea.commands.*;
import git4idea.config.GitVersionSpecialty;
import git4idea.i18n.GitBundle;
GitUIUtil.showOperationError(myProject, ex, "resolving revision");
return;
}
- GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, resolvedStash, root, true, false);
+ GitUtil.showSubmittedFiles(myProject, resolvedStash, root, true, false);
}
});
init();
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.PanelWithActionsAndCloseButton;
import com.intellij.openapi.vcs.VcsDataKeys;
+import com.intellij.openapi.vcs.annotate.ShowAllAffectedGenericAction;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.vcsUtil.VcsUtil;
import git4idea.GitFileRevision;
-import git4idea.actions.GitShowAllSubmittedFilesAction;
import git4idea.rebase.GitRebaseUtils;
import org.jetbrains.annotations.NotNull;
@Override
protected void addActionsTo(DefaultActionGroup group) {
super.addActionsTo(group);
- GitShowAllSubmittedFilesAction showCommit = new GitShowAllSubmittedFilesAction();
+ ShowAllAffectedGenericAction showCommit = new ShowAllAffectedGenericAction();
showCommit.registerCustomShortcutSet(new CustomShortcutSet(
CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myTree);
group.addAction(showCommit);