From be64e12a7e88ede624b06e48764b7525849d0488 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 21 Nov 2016 16:49:49 +0300 Subject: [PATCH] vcs: remove unused method - AbstractVcsHelper.showDifferences --- .../openapi/vcs/AbstractVcsHelper.java | 2 - .../vcs/impl/AbstractVcsHelperImpl.java | 64 ++----------------- .../cvsSupport2/impl/CvsServicesImpl.java | 7 -- .../openapi/cvsIntegration/CvsServices.java | 1 - .../tests/git4idea/test/MockVcsHelper.kt | 4 -- .../zmlx/hg4idea/test/HgMockVcsHelper.java | 4 -- 6 files changed, 4 insertions(+), 78 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java index b4d29cf25692..130430599642 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java @@ -74,8 +74,6 @@ public abstract class AbstractVcsHelper { public abstract void showAnnotation(FileAnnotation annotation, VirtualFile file, AbstractVcs vcs, int line); - public abstract void showDifferences(final VcsFileRevision cvsVersionOn, final VcsFileRevision cvsVersionOn1, final File file); - public abstract void showChangesListBrowser(CommittedChangeList changelist, @Nls String title); public void showChangesListBrowser(CommittedChangeList changelist, @Nullable VirtualFile toSelect, @Nls String title) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java index bc3706c6bb18..939bd67da5ee 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java @@ -26,11 +26,11 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.diff.*; import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.fileEditor.*; -import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.fileTypes.FileTypeManager; +import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.fileEditor.OpenFileDescriptor; +import com.intellij.openapi.fileEditor.TextEditor; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.Task; @@ -39,7 +39,6 @@ import com.intellij.openapi.progress.impl.CoreProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Getter; import com.intellij.openapi.util.Pair; @@ -62,7 +61,6 @@ import com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.intellij.openapi.vcs.vfs.VcsFileSystem; import com.intellij.openapi.vcs.vfs.VcsVirtualFile; -import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ToolWindow; @@ -88,8 +86,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; import java.awt.*; -import java.io.File; -import java.io.IOException; import java.text.MessageFormat; import java.util.*; import java.util.List; @@ -426,47 +422,6 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper { AnnotateToggleAction.doAnnotate(editor, myProject, file, annotation, vcs); } - public void showDifferences(final VcsFileRevision version1, final VcsFileRevision version2, final File file) { - try { - final byte[] byteContent1 = VcsHistoryUtil.loadRevisionContent(version1); - final byte[] byteContent2 = VcsHistoryUtil.loadRevisionContent(version2); - - if (Comparing.equal(byteContent1, byteContent2)) { - Messages.showInfoMessage(VcsBundle.message("message.text.versions.are.identical"), VcsBundle.message("message.title.diff")); - } - - final SimpleDiffRequest request = new SimpleDiffRequest(myProject, file.getAbsolutePath()); - - final FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(file.getName()); - if (fileType.isBinary()) { - Messages.showInfoMessage(VcsBundle.message("message.text.binary.versions.differ"), VcsBundle.message("message.title.diff")); - - return; - } - - final DiffContent content1 = getContentForVersion(version1, file); - final DiffContent content2 = getContentForVersion(version2, file); - - if (version2.getRevisionNumber().compareTo(version1.getRevisionNumber()) > 0) { - request.setContents(content2, content1); - request.setContentTitles(version2.getRevisionNumber().asString(), version1.getRevisionNumber().asString()); - } - else { - request.setContents(content1, content2); - request.setContentTitles(version1.getRevisionNumber().asString(), version2.getRevisionNumber().asString()); - } - - DiffManager.getInstance().getDiffTool().show(request); - } - catch (VcsException e) { - showError(e, VcsBundle.message("message.title.diff")); - } - catch (IOException e) { - showError(new VcsException(e), VcsBundle.message("message.title.diff")); - } - - } - public void showChangesBrowser(List changelists) { showChangesBrowser(changelists, null); } @@ -622,17 +577,6 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper { return fileMergeDialog.getProcessedFiles(); } - private static DiffContent getContentForVersion(final VcsFileRevision version, final File file) throws IOException, VcsException { - VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file); - if (vFile != null && (version instanceof CurrentRevision) && !vFile.getFileType().isBinary()) { - return new DocumentContent(FileDocumentManager.getInstance().getDocument(vFile), vFile.getFileType()); - } - else { - return new SimpleContent(VcsHistoryUtil.loadRevisionContentGuessEncoding(version, vFile, null), - FileTypeManager.getInstance().getFileTypeByFileName(file.getName())); - } - } - public void openCommittedChangesTab(final AbstractVcs vcs, final VirtualFile root, final ChangeBrowserSettings settings, diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/impl/CvsServicesImpl.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/impl/CvsServicesImpl.java index 1e090fb3ab48..771d65d4943b 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/impl/CvsServicesImpl.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/impl/CvsServicesImpl.java @@ -94,13 +94,6 @@ public class CvsServicesImpl extends CvsServices { } - public void showDifferencesForFiles(CvsModule first, CvsModule second, Project project) throws Exception { - AbstractVcsHelper.getInstance(project).showDifferences( - createCvsVersionOn(first, project), - createCvsVersionOn(second, project), - new File(first.getPathInCvs())); - } - public String getScrambledPasswordForPServerCvsRoot(String cvsRoot) { return PServerLoginProvider.getInstance() .getScrambledPasswordForCvsRoot(cvsRoot); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/openapi/cvsIntegration/CvsServices.java b/plugins/cvs/cvs-plugin/src/com/intellij/openapi/cvsIntegration/CvsServices.java index 29fd7a5962b2..068b7953fd2d 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/openapi/cvsIntegration/CvsServices.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/openapi/cvsIntegration/CvsServices.java @@ -31,7 +31,6 @@ public abstract class CvsServices { boolean allowFilesSelection, String title, String selectModulePageTitle); public abstract CvsRepository[] getConfiguredRepositories(); - public abstract void showDifferencesForFiles(CvsModule first, CvsModule second, Project project) throws Exception; public abstract String getScrambledPasswordForPServerCvsRoot(String cvsRoot); public abstract boolean saveRepository(CvsRepository repository); public abstract void openInEditor(Project project, CvsModule cvsFile); diff --git a/plugins/git4idea/tests/git4idea/test/MockVcsHelper.kt b/plugins/git4idea/tests/git4idea/test/MockVcsHelper.kt index af52c850ddfb..740e0e65ed19 100644 --- a/plugins/git4idea/tests/git4idea/test/MockVcsHelper.kt +++ b/plugins/git4idea/tests/git4idea/test/MockVcsHelper.kt @@ -80,10 +80,6 @@ class MockVcsHelper(project: Project) : AbstractVcsHelper(project) { throw UnsupportedOperationException() } - override fun showDifferences(cvsVersionOn: VcsFileRevision, cvsVersionOn1: VcsFileRevision, file: File) { - throw UnsupportedOperationException() - } - override fun showChangesListBrowser(changelist: CommittedChangeList, title: String) { throw UnsupportedOperationException() } diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java index 625861257172..08ad5e8befbb 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java @@ -77,10 +77,6 @@ public class HgMockVcsHelper extends AbstractVcsHelper { public void showAnnotation(FileAnnotation annotation, VirtualFile file, AbstractVcs vcs) { } - @Override - public void showDifferences(VcsFileRevision cvsVersionOn, VcsFileRevision cvsVersionOn1, File file) { - } - @Override public void showChangesListBrowser(CommittedChangeList changelist, @Nls String title) { }