From 42ff943a02f46fead40145115f3f4c368897cb46 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 12 Oct 2019 21:07:24 +0300 Subject: [PATCH] vcs: cleanup - remove dead code The only usage was removed in 7cafb3a2cc907e845718be436345935de7d7e8a6 GitOrigin-RevId: 4e5984315e940aad137a78fbb46f064788f05c12 --- .../vcs/changes/ChangeViewDiffRequestProcessor.java | 4 ---- .../vcs/changes/ChangesViewDiffPreviewProcessor.kt | 4 ---- .../vcs/changes/ui/ChangesViewContentManager.kt | 12 ++++-------- .../vcs/changes/ui/CommitChangeListDialog.java | 6 ------ .../vcs/log/history/FileHistoryDiffPreview.kt | 4 ---- .../vcs/log/ui/frame/VcsLogChangeProcessor.java | 5 ----- 6 files changed, 4 insertions(+), 31 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeViewDiffRequestProcessor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeViewDiffRequestProcessor.java index 80d6fab13530..045c3cc869c8 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeViewDiffRequestProcessor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeViewDiffRequestProcessor.java @@ -95,10 +95,6 @@ public abstract class ChangeViewDiffRequestProcessor extends CacheDiffRequestPro return isRequestValid(request) ? request : null; } - protected boolean hasSelection() { - return true; - } - private static boolean isRequestValid(@Nullable DiffRequest request) { if (request instanceof ErrorDiffRequest) return false; if (request instanceof ContentDiffRequest) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewDiffPreviewProcessor.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewDiffPreviewProcessor.kt index 8a5655267628..3901923be111 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewDiffPreviewProcessor.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewDiffPreviewProcessor.kt @@ -28,10 +28,6 @@ private class ChangesViewDiffPreviewProcessor(private val changesView: ChangesLi override fun getAllChanges(): List = wrap(changesView.changes, changesView.unversionedFiles) - override fun hasSelection(): Boolean { - return !changesView.isSelectionEmpty - } - override fun selectChange(change: Wrapper) { changesView.findNodePathInTree(change.userObject)?.let { TreeUtil.selectPath(changesView, it, false) } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewContentManager.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewContentManager.kt index 708c31e86705..19d298673ee5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewContentManager.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewContentManager.kt @@ -7,7 +7,10 @@ import com.intellij.openapi.util.Comparing import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.Key import com.intellij.openapi.wm.ToolWindowId -import com.intellij.ui.content.* +import com.intellij.ui.content.Content +import com.intellij.ui.content.ContentManager +import com.intellij.ui.content.ContentManagerAdapter +import com.intellij.ui.content.ContentManagerEvent import com.intellij.util.ObjectUtils import com.intellij.util.containers.ContainerUtil import java.util.* @@ -72,13 +75,6 @@ class ChangesViewContentManager : ChangesViewContentI, Disposable { contentManager.setSelectedContent(content, requestFocus) } - fun adviseSelectionChanged(listener: ContentManagerListener) { - contentManager?.let { - it.addContentManagerListener(listener) - Disposer.register(this, Disposable { it.removeContentManagerListener(listener) }) - } - } - override fun getActiveComponent(aClass: Class): T? { val selectedContent = contentManager?.selectedContent ?: return null return ObjectUtils.tryCast(selectedContent.component, aClass) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index 078c9f70899c..eb505aa77578 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -796,12 +796,6 @@ public abstract class CommitChangeListDialog extends DialogWrapper implements Si getBrowser().selectEntries(singletonList(change.getUserObject())); } - @Override - protected boolean hasSelection() { - CommitDialogChangesBrowser browser = getBrowser(); - return !browser.getSelectedChanges().isEmpty() || !browser.getSelectedUnversionedFiles().isEmpty(); - } - @NotNull private List wrap(@NotNull Collection changes, @NotNull Collection unversioned) { return concat(map(changes, ChangeWrapper::new), diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt index 73da92362338..1c354dc884ea 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt @@ -21,10 +21,6 @@ internal class FileHistoryDiffPreview(project: Project, private val changeGetter Disposer.register(disposable, this) } - override fun hasSelection(): Boolean { - return true - } - override fun getSelectedChanges(): List = allChanges override fun getAllChanges(): List { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java index e2d33a1ced80..550ad5973e10 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java @@ -65,11 +65,6 @@ class VcsLogChangeProcessor extends ChangeViewDiffRequestProcessor { } } - @Override - protected boolean hasSelection() { - return myBrowser.getViewer().getSelectionModel().getSelectionCount() != 0; - } - private void updatePreviewLater() { ApplicationManager.getApplication().invokeLater(() -> updatePreview(getComponent().isShowing())); }