From 7538e556423f88659b010fbdf38d323e69902cd2 Mon Sep 17 00:00:00 2001 From: "Evgeniy.Stepanov" Date: Tue, 28 Apr 2020 20:11:43 +0200 Subject: [PATCH] Remove dependency `intellij.platform.diff.impl` -> `intellij.platform.vcs`, IDEA-CR-1366 GitOrigin-RevId: 3f914e4174f33ba581f47dd42c43939cbb3dda53 --- .../resources/messages/DiffBundle.properties | 7 ++ .../diff/DiffApplicationSettings.java | 33 +++++++ .../com/intellij/diff/vcs/DiffVcsFacade.java | 27 ++++++ .../intellij/openapi/LineNumberConstants.java | 7 ++ .../diff-impl/intellij.platform.diff.impl.iml | 2 - .../intellij/diff/DiffContentFactoryImpl.java | 12 +-- .../intellij/diff/DiffRequestFactoryImpl.java | 8 +- .../diff/chains/AsyncDiffRequestChain.java | 2 +- .../diff/impl/DiffRequestProcessor.java | 8 +- .../com/intellij/diff/merge/MergeUtil.java | 30 ------- .../diff/tools/external/ExternalDiffTool.java | 24 ++++- .../diff/util/DiffUserDataKeysEx.java | 4 - .../diff/impl/dir/DirDiffTableModel.java | 5 +- .../vcs/ex/LineStatusMarkerPopupRenderer.java | 15 ++-- .../openapi/vcs/ex/LineStatusTrackerBase.kt | 10 +-- .../com/intellij/openapi/vcs/FilePath.java | 0 .../intellij/openapi/vcs/LocalFilePath.java | 20 +---- .../src/com/intellij/ui/GuiUtils.java | 23 +++++ .../src/com/intellij/util/ListSelection.java | 87 +++++++++++++++++++ .../src/META-INF/PlatformExtensions.xml | 1 + .../src/META-INF/VcsExtensions.xml | 4 + .../com/intellij/openapi/ListSelection.java | 29 +++---- .../localVcs/UpToDateLineNumberProvider.java | 6 +- .../openapi/vcs/VcsApplicationSettings.java | 1 - .../com/intellij/openapi/vcs/VcsDataKeys.java | 2 +- .../src/com/intellij/vcsUtil/UIVcsUtil.kt | 21 ----- .../resources/messages/VcsBundle.properties | 6 -- .../vcs-impl/intellij.platform.vcs.impl.iml | 1 + .../src/com/intellij/diff/DiffVcsDataKeys.kt | 12 +++ .../com/intellij/diff/DiffVcsFacadeImpl.kt | 17 ++++ .../vcs/actions/AnnotateDiffViewerAction.java | 4 +- .../vcs/actions/DiffActionExecutor.java | 4 +- .../vcs/actions/ShowDiffFromAnnotation.java | 2 +- .../vcs/changes/VcsChangesSelectionRule.java | 2 +- .../actions/ShowDiffWithLocalAction.java | 2 +- .../diff/ChangeDiffRequestProducer.java | 7 +- .../changes/actions/diff/ShowDiffAction.java | 2 +- ...howDiffFromLocalChangesActionProvider.java | 2 +- .../DiffShelvedChangesActionProvider.java | 2 +- .../shelf/ShelvedChangesViewManager.java | 2 +- .../changes/ui/ChangeDiffRequestChain.java | 4 +- .../vcs/changes/ui/ChangesBrowserBase.java | 2 +- .../vcs/changes/ui/OldChangesBrowserBase.java | 2 +- .../vcs/changes/ui/VcsTreeModelData.java | 2 +- .../openapi/vcs/history/VcsHistoryUtil.java | 8 +- .../intellij/openapi/vcs/merge/MergeUtils.kt | 46 ++++++++++ .../vcs/merge/MultipleFileMergeDialog.kt | 3 +- .../intellij/vcs/log/ui/frame/MainFrame.java | 3 +- .../log/ui/frame/VcsLogChangesBrowser.java | 4 +- .../conflicts/MergeConflictResolveUtil.kt | 3 +- .../src/git4idea/log/GitLogDiffHandler.java | 4 +- 51 files changed, 366 insertions(+), 168 deletions(-) create mode 100644 platform/diff-api/src/com/intellij/diff/DiffApplicationSettings.java create mode 100644 platform/diff-api/src/com/intellij/diff/vcs/DiffVcsFacade.java create mode 100644 platform/diff-api/src/com/intellij/openapi/LineNumberConstants.java rename platform/{vcs-api/vcs-api-core => platform-api}/src/com/intellij/openapi/vcs/FilePath.java (100%) rename platform/{vcs-impl => platform-api}/src/com/intellij/openapi/vcs/LocalFilePath.java (86%) create mode 100644 platform/platform-api/src/com/intellij/util/ListSelection.java delete mode 100644 platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.kt create mode 100644 platform/vcs-impl/src/com/intellij/diff/DiffVcsDataKeys.kt create mode 100644 platform/vcs-impl/src/com/intellij/diff/DiffVcsFacadeImpl.kt create mode 100644 platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MergeUtils.kt diff --git a/platform/diff-api/resources/messages/DiffBundle.properties b/platform/diff-api/resources/messages/DiffBundle.properties index 211a367be764..f3187f522023 100644 --- a/platform/diff-api/resources/messages/DiffBundle.properties +++ b/platform/diff-api/resources/messages/DiffBundle.properties @@ -6,7 +6,14 @@ cannot.create.diff.error=Cannot create diff element from: {0} cannot.compare.error=Diff manager cannot compare ''{0}'' and ''{1}'' unknown.file.type.error=Unknown file type: {0} +dialog.title.diff.for.range=Diff for Range +diff.content.title.up.to.date=Base revision +diff.content.title.current.range=Current + +refresh.failed.message=Refresh failed: {0} + save.merge.result.command.name=Merge +rollback.change.command.name=Rollback Change compare.file.vs.file.dialog.title={0} vs {1} diff.content.editor.content.title=Editor diff.content.clipboard.content.title=From clipboard diff --git a/platform/diff-api/src/com/intellij/diff/DiffApplicationSettings.java b/platform/diff-api/src/com/intellij/diff/DiffApplicationSettings.java new file mode 100644 index 000000000000..cbd60fa78b15 --- /dev/null +++ b/platform/diff-api/src/com/intellij/diff/DiffApplicationSettings.java @@ -0,0 +1,33 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.diff; + +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; +import com.intellij.util.xmlb.XmlSerializerUtil; +import org.jetbrains.annotations.NotNull; + +@State( + name = "DiffApplicationSettings", + storages = @Storage("vcs.xml"), + reportStatistic = true +) +public class DiffApplicationSettings implements PersistentStateComponent { + + public boolean SHOW_LST_WORD_DIFFERENCES = true; + + public static DiffApplicationSettings getInstance() { + return ServiceManager.getService(DiffApplicationSettings.class); + } + + @Override + public DiffApplicationSettings getState() { + return this; + } + + @Override + public void loadState(@NotNull DiffApplicationSettings state) { + XmlSerializerUtil.copyBean(state, this); + } +} diff --git a/platform/diff-api/src/com/intellij/diff/vcs/DiffVcsFacade.java b/platform/diff-api/src/com/intellij/diff/vcs/DiffVcsFacade.java new file mode 100644 index 000000000000..7e7941d7740d --- /dev/null +++ b/platform/diff-api/src/com/intellij/diff/vcs/DiffVcsFacade.java @@ -0,0 +1,27 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.diff.vcs; + +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.LocalFilePath; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +@ApiStatus.Internal +public class DiffVcsFacade { + @NotNull + public static DiffVcsFacade getInstance() { + return ServiceManager.getService(DiffVcsFacade.class); + } + + @NotNull + public FilePath getFilePath(@NotNull String path) { + return new LocalFilePath(path, false); + } + + @NotNull + public FilePath getFilePath(@NotNull VirtualFile virtualFile) { + return new LocalFilePath(virtualFile.getPath(), virtualFile.isDirectory()); + } +} diff --git a/platform/diff-api/src/com/intellij/openapi/LineNumberConstants.java b/platform/diff-api/src/com/intellij/openapi/LineNumberConstants.java new file mode 100644 index 000000000000..3c2cfa6378cd --- /dev/null +++ b/platform/diff-api/src/com/intellij/openapi/LineNumberConstants.java @@ -0,0 +1,7 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.openapi; + +public final class LineNumberConstants { + public static final int ABSENT_LINE_NUMBER = -1; + public static final int FAKE_LINE_NUMBER = -2; +} diff --git a/platform/diff-impl/intellij.platform.diff.impl.iml b/platform/diff-impl/intellij.platform.diff.impl.iml index 75136d0c57b5..2723313614d0 100644 --- a/platform/diff-impl/intellij.platform.diff.impl.iml +++ b/platform/diff-impl/intellij.platform.diff.impl.iml @@ -11,8 +11,6 @@ - - diff --git a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java index f8c13b6055ec..f7bd7ea4b334 100644 --- a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java +++ b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java @@ -7,6 +7,7 @@ import com.intellij.diff.contents.*; import com.intellij.diff.tools.util.DiffNotifications; import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.diff.util.DiffUtil; +import com.intellij.diff.vcs.DiffVcsFacade; import com.intellij.ide.highlighter.ArchiveFileType; import com.intellij.lang.properties.charset.Native2AsciiCharset; import com.intellij.openapi.application.ReadAction; @@ -34,7 +35,6 @@ import com.intellij.ui.LightColors; import com.intellij.util.LineSeparator; import com.intellij.util.ObjectUtils; import com.intellij.util.PathUtil; -import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -270,7 +270,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { @NotNull FileType fileType, @NotNull String fileName) throws IOException { if (isBinaryContent(content, fileType)) { - return createBinaryImpl(project, content, fileType, VcsUtil.getFilePath(fileName), null); + return createBinaryImpl(project, content, fileType, DiffVcsFacade.getInstance().getFilePath(fileName), null); } return createDocumentFromBytes(project, content, fileType, fileName); @@ -282,7 +282,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { byte @NotNull [] content, @NotNull VirtualFile highlightFile) throws IOException { if (isBinaryContent(content, highlightFile.getFileType())) { - return createBinaryImpl(project, content, highlightFile.getFileType(), VcsUtil.getFilePath(highlightFile), highlightFile); + return createBinaryImpl(project, content, highlightFile.getFileType(), DiffVcsFacade.getInstance().getFilePath(highlightFile), highlightFile); } return createDocumentFromBytes(project, content, highlightFile); @@ -336,7 +336,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { byte @NotNull [] content, @NotNull FileType type, @NotNull String fileName) throws IOException { - return createBinaryImpl(project, content, type, VcsUtil.getFilePath(fileName), null); + return createBinaryImpl(project, content, type, DiffVcsFacade.getInstance().getFilePath(fileName), null); } @@ -593,7 +593,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { public DocumentContentBuilder contextByHighlightFile(@Nullable VirtualFile file) { if (file != null) { context = new Context.ByHighlightFile(file); - originalFilePath = VcsUtil.getFilePath(file); + originalFilePath = DiffVcsFacade.getInstance().getFilePath(file); fileName = file.getName(); } return this; @@ -606,7 +606,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { context = new Context.ByReferent(referent); VirtualFile file = referent.getHighlightFile(); if (file != null) { - originalFilePath = VcsUtil.getFilePath(file); + originalFilePath = DiffVcsFacade.getInstance().getFilePath(file); fileName = file.getName(); } } diff --git a/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java b/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java index c14910553f3a..2d03593abaf6 100644 --- a/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java +++ b/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java @@ -17,6 +17,7 @@ import com.intellij.diff.requests.ContentDiffRequest; import com.intellij.diff.requests.SimpleDiffRequest; import com.intellij.diff.requests.TextMergeRequestImpl; import com.intellij.diff.util.DiffUtil; +import com.intellij.diff.vcs.DiffVcsFacade; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diff.DiffBundle; import com.intellij.openapi.editor.Document; @@ -26,7 +27,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; -import com.intellij.vcsUtil.VcsUtil; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -100,14 +100,14 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory { @Override public String getContentTitle(@Nullable VirtualFile file) { if (file == null) return null; - return getContentTitle(VcsUtil.getFilePath(file)); + return getContentTitle(DiffVcsFacade.getInstance().getFilePath(file)); } @NotNull @Override public String getTitle(@Nullable VirtualFile file1, @Nullable VirtualFile file2) { - FilePath path1 = file1 != null ? VcsUtil.getFilePath(file1) : null; - FilePath path2 = file2 != null ? VcsUtil.getFilePath(file2) : null; + FilePath path1 = file1 != null ? DiffVcsFacade.getInstance().getFilePath(file1) : null; + FilePath path2 = file2 != null ? DiffVcsFacade.getInstance().getFilePath(file2) : null; return getTitle(path1, path2, " vs "); } diff --git a/platform/diff-impl/src/com/intellij/diff/chains/AsyncDiffRequestChain.java b/platform/diff-impl/src/com/intellij/diff/chains/AsyncDiffRequestChain.java index d7cc0eb6a4c6..5951c763910a 100644 --- a/platform/diff-impl/src/com/intellij/diff/chains/AsyncDiffRequestChain.java +++ b/platform/diff-impl/src/com/intellij/diff/chains/AsyncDiffRequestChain.java @@ -5,10 +5,10 @@ import com.intellij.diff.chains.SimpleDiffRequestChain.DiffRequestProducerWrappe import com.intellij.diff.requests.ErrorDiffRequest; import com.intellij.diff.requests.LoadingDiffRequest; import com.intellij.openapi.Disposable; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.util.BackgroundTaskUtil; import com.intellij.util.EventDispatcher; +import com.intellij.util.ListSelection; import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.CalledInBackground; import org.jetbrains.annotations.NotNull; diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java index 843f63b1b2c7..9adebf6189fe 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java @@ -50,10 +50,7 @@ import com.intellij.openapi.util.UserDataHolder; import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy; -import com.intellij.ui.HintHint; -import com.intellij.ui.JBColor; -import com.intellij.ui.JBSplitter; -import com.intellij.ui.LightweightHint; +import com.intellij.ui.*; import com.intellij.ui.components.JBPanelWithEmptyText; import com.intellij.ui.components.panels.Wrapper; import com.intellij.ui.mac.TouchbarDataKeys; @@ -62,7 +59,6 @@ import com.intellij.ui.scale.JBUIScale; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; -import com.intellij.vcsUtil.UIVcsUtilKt; import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -149,7 +145,7 @@ public abstract class DiffRequestProcessor implements Disposable { JPanel statusPanel = JBUI.Panels.simplePanel(myToolbarStatusPanel).addToLeft(myProgressBar); JPanel topPanel = JBUI.Panels.simplePanel(myToolbarWrapper).addToRight(statusPanel); - UIVcsUtilKt.installVisibilityReferent(topPanel, myToolbar.getComponent()); + GuiUtils.installVisibilityReferent(topPanel, myToolbar.getComponent()); Splitter bottomContentSplitter = new JBSplitter(true, "DiffRequestProcessor.BottomComponentSplitter", 0.8f); bottomContentSplitter.setFirstComponent(myContentPanel); diff --git a/platform/diff-impl/src/com/intellij/diff/merge/MergeUtil.java b/platform/diff-impl/src/com/intellij/diff/merge/MergeUtil.java index 945277755c40..17ee5505a3a8 100644 --- a/platform/diff-impl/src/com/intellij/diff/merge/MergeUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/merge/MergeUtil.java @@ -19,9 +19,6 @@ import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.history.VcsRevisionNumber; -import com.intellij.openapi.vcs.merge.MergeData; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.projectImport.ProjectOpenProcessor; import com.intellij.util.Function; @@ -174,33 +171,6 @@ public class MergeUtil { Messages.getQuestionIcon()) == Messages.YES; } - public static void putRevisionInfos(@NotNull MergeRequest request, @NotNull MergeData data) { - if (request instanceof ThreesideMergeRequest) { - List contents = ((ThreesideMergeRequest)request).getContents(); - putRevisionInfo(contents, data); - } - } - - public static void putRevisionInfos(@NotNull DiffRequest request, @NotNull MergeData data) { - if (request instanceof ContentDiffRequest) { - List contents = ((ContentDiffRequest)request).getContents(); - if (contents.size() == 3) { - putRevisionInfo(contents, data); - } - } - } - - private static void putRevisionInfo(@NotNull List contents, @NotNull MergeData data) { - for (ThreeSide side : ThreeSide.values()) { - DiffContent content = side.select(contents); - FilePath filePath = side.select(data.CURRENT_FILE_PATH, data.ORIGINAL_FILE_PATH, data.LAST_FILE_PATH); - VcsRevisionNumber revision = side.select(data.CURRENT_REVISION_NUMBER, data.ORIGINAL_REVISION_NUMBER, data.LAST_REVISION_NUMBER); - if (filePath != null && revision != null) { - content.putUserData(DiffUserDataKeysEx.REVISION_INFO, Pair.create(filePath, revision)); - } - } - } - public static void reportProjectFileChangeIfNeeded(@Nullable Project project, @Nullable VirtualFile file) { if (project != null && file != null && isProjectFile(file)) { StoreReloadManager.getInstance().saveChangedProjectFile(file, project); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffTool.java b/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffTool.java index 182ede7dd5bc..125bec5c9ef8 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffTool.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffTool.java @@ -24,16 +24,19 @@ import com.intellij.diff.requests.DiffRequest; import com.intellij.execution.ExecutionException; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diff.DiffBundle; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.vcsUtil.VcsUtil; +import com.intellij.util.ListSelection; +import com.intellij.util.ThrowableConvertor; +import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -86,7 +89,7 @@ public class ExternalDiffTool { private static List loadRequestsUnderProgress(@Nullable Project project, @NotNull DiffRequestChain chain) throws Throwable { if (chain instanceof AsyncDiffRequestChain) { - return VcsUtil.computeWithModalProgress(project, DiffBundle.message("progress.title.loading.requests"), true, indicator -> { + return computeWithModalProgress(project, DiffBundle.message("progress.title.loading.requests"), true, indicator -> { ListSelection listSelection = ((AsyncDiffRequestChain)chain).loadRequestsInBackground(); return collectRequests(project, listSelection.getList(), listSelection.getSelectedIndex(), indicator); }); @@ -95,7 +98,7 @@ public class ExternalDiffTool { List allProducers = chain.getRequests(); int index = chain.getIndex(); - return VcsUtil.computeWithModalProgress(project, DiffBundle.message("progress.title.loading.requests"), true, indicator -> { + return computeWithModalProgress(project, DiffBundle.message("progress.title.loading.requests"), true, indicator -> { return collectRequests(project, allProducers, index, indicator); }); } @@ -138,6 +141,19 @@ public class ExternalDiffTool { return requests; } + private static T computeWithModalProgress(@Nullable Project project, + @NotNull @Nls String title, + boolean canBeCancelled, + @NotNull ThrowableConvertor computable) + throws Exception { + return ProgressManager.getInstance().run(new Task.WithResult(project, title, canBeCancelled) { + @Override + protected T compute(@NotNull ProgressIndicator indicator) throws Exception { + return computable.convert(indicator); + } + }); + } + public static void showRequest(@Nullable Project project, @NotNull DiffRequest request) throws ExecutionException, IOException { request.onAssigned(true); try { diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffUserDataKeysEx.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUserDataKeysEx.java index 546e6155d1e3..f47586836db3 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUserDataKeysEx.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUserDataKeysEx.java @@ -13,9 +13,6 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import gnu.trove.TIntFunction; @@ -34,7 +31,6 @@ public interface DiffUserDataKeysEx extends DiffUserDataKeys { * Override line numbers in editor gutter (function "document line -> user-visible line number") */ Key LINE_NUMBER_CONVERTOR = Key.create("Diff.LineNumberConvertor"); - Key> REVISION_INFO = Key.create("Diff.RevisionInfo"); Key FILE_NAME = Key.create("Diff.FileName"); Key DIFF_IN_EDITOR = Key.create("Diff.DiffInEditor"); diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java index efe606bb55c0..154e12f2595b 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java @@ -27,7 +27,6 @@ import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.ComponentUtil; import com.intellij.ui.TableUtil; @@ -254,7 +253,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode } catch (IOException e) { LOG.warn(e); - reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); + reportException(DiffBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); } finally { if (myTree != null) { @@ -283,7 +282,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode } catch (final IOException e) { LOG.warn(e); - reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); + reportException(DiffBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); } finally { myTree.setSource(mySource); diff --git a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupRenderer.java b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupRenderer.java index d2f2199b93d2..77980ee02a7f 100644 --- a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupRenderer.java +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupRenderer.java @@ -5,6 +5,7 @@ import com.intellij.codeInsight.hint.EditorFragmentComponent; import com.intellij.codeInsight.hint.EditorHintListener; import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.hint.HintManagerImpl; +import com.intellij.diff.DiffApplicationSettings; import com.intellij.diff.DiffContentFactory; import com.intellij.diff.DiffManager; import com.intellij.diff.comparison.ByWord; @@ -40,8 +41,6 @@ import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.vcs.VcsApplicationSettings; -import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.*; import com.intellij.util.ui.JBUI; @@ -93,7 +92,7 @@ public abstract class LineStatusMarkerPopupRenderer extends LineStatusMarkerRend } private static boolean isShowInnerDifferences() { - return VcsApplicationSettings.getInstance().SHOW_LST_WORD_DIFFERENCES; + return DiffApplicationSettings.getInstance().SHOW_LST_WORD_DIFFERENCES; } @Nullable @@ -524,10 +523,10 @@ public abstract class LineStatusMarkerPopupRenderer extends LineStatusMarkerRend myTracker.getVirtualFile(), getCurrentTextRange(ourRange)); - SimpleDiffRequest request = new SimpleDiffRequest(VcsBundle.message("dialog.title.diff.for.range"), + SimpleDiffRequest request = new SimpleDiffRequest(DiffBundle.message("dialog.title.diff.for.range"), vcsContent, currentContent, - VcsBundle.message("diff.content.title.up.to.date"), - VcsBundle.message("diff.content.title.current.range")); + DiffBundle.message("diff.content.title.up.to.date"), + DiffBundle.message("diff.content.title.current.range")); DiffManager.getInstance().showDiff(myTracker.getProject(), request); } @@ -567,13 +566,13 @@ public abstract class LineStatusMarkerPopupRenderer extends LineStatusMarkerRend @Override public boolean isSelected(@NotNull AnActionEvent e) { - return VcsApplicationSettings.getInstance().SHOW_LST_WORD_DIFFERENCES; + return DiffApplicationSettings.getInstance().SHOW_LST_WORD_DIFFERENCES; } @Override public void setSelected(@NotNull AnActionEvent e, boolean state) { if (!myTracker.isValid()) return; - VcsApplicationSettings.getInstance().SHOW_LST_WORD_DIFFERENCES = state; + DiffApplicationSettings.getInstance().SHOW_LST_WORD_DIFFERENCES = state; Range newRange = myTracker.findRange(myRange); if (newRange != null) { diff --git a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt index caf537dab70c..c1d952389c95 100644 --- a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt @@ -18,18 +18,18 @@ package com.intellij.openapi.vcs.ex import com.intellij.diff.util.DiffUtil import com.intellij.diff.util.Side import com.intellij.openapi.Disposable +import com.intellij.openapi.LineNumberConstants import com.intellij.openapi.application.Application import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.WriteThread import com.intellij.openapi.command.CommandProcessor import com.intellij.openapi.command.undo.UndoConstants import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.diff.DiffBundle import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.impl.DocumentImpl -import com.intellij.openapi.localVcs.UpToDateLineNumberProvider.ABSENT_LINE_NUMBER import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer -import com.intellij.openapi.vcs.VcsBundle import com.intellij.openapi.vcs.ex.DocumentTracker.Block import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.containers.nullize @@ -334,7 +334,7 @@ abstract class LineStatusTrackerBase : LineStatusTrackerI { protected fun runBulkRollback(condition: (Block) -> Boolean) { if (!isValid()) return - updateDocument(Side.RIGHT, VcsBundle.message("command.name.rollback.change")) { + updateDocument(Side.RIGHT, DiffBundle.message("rollback.change.command.name")) { documentTracker.partiallyApplyBlocks(Side.RIGHT, condition) { block, shift -> fireLinesUnchanged(block.start + shift, block.start + shift + (block.vcsEnd - block.vcsStart)) } @@ -370,7 +370,7 @@ abstract class LineStatusTrackerBase : LineStatusTrackerI { private fun transferLine(line: Int, approximate: Boolean, fromVcs: Boolean): Int { LOCK.read { - if (!isValid()) return if (approximate) line else ABSENT_LINE_NUMBER + if (!isValid()) return if (approximate) line else LineNumberConstants.ABSENT_LINE_NUMBER var result = line @@ -381,7 +381,7 @@ abstract class LineStatusTrackerBase : LineStatusTrackerI { val endLine2 = if (fromVcs) block.end else block.vcsEnd if (line in startLine1 until endLine1) { - return if (approximate) startLine2 else ABSENT_LINE_NUMBER + return if (approximate) startLine2 else LineNumberConstants.ABSENT_LINE_NUMBER } if (endLine1 > line) return result diff --git a/platform/vcs-api/vcs-api-core/src/com/intellij/openapi/vcs/FilePath.java b/platform/platform-api/src/com/intellij/openapi/vcs/FilePath.java similarity index 100% rename from platform/vcs-api/vcs-api-core/src/com/intellij/openapi/vcs/FilePath.java rename to platform/platform-api/src/com/intellij/openapi/vcs/FilePath.java diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/LocalFilePath.java b/platform/platform-api/src/com/intellij/openapi/vcs/LocalFilePath.java similarity index 86% rename from platform/vcs-impl/src/com/intellij/openapi/vcs/LocalFilePath.java rename to platform/platform-api/src/com/intellij/openapi/vcs/LocalFilePath.java index e045b02e29c5..36c51af15f55 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/LocalFilePath.java +++ b/platform/platform-api/src/com/intellij/openapi/vcs/LocalFilePath.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs; import com.intellij.openapi.editor.Document; @@ -20,13 +6,13 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.encoding.EncodingManager; import com.intellij.openapi.vfs.encoding.EncodingProjectManager; import com.intellij.util.PathUtil; -import com.intellij.vcsUtil.VcsFileUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -92,7 +78,7 @@ public class LocalFilePath implements FilePath { @Override public boolean isUnder(@NotNull FilePath parent, boolean strict) { - return VcsFileUtil.isAncestor(parent, this, strict); + return FileUtil.startsWith(this.getPath(), parent.getPath(), SystemInfo.isFileSystemCaseSensitive, strict); } @Override diff --git a/platform/platform-api/src/com/intellij/ui/GuiUtils.java b/platform/platform-api/src/com/intellij/ui/GuiUtils.java index f4051a3c922d..b2296ed9a539 100644 --- a/platform/platform-api/src/com/intellij/ui/GuiUtils.java +++ b/platform/platform-api/src/com/intellij/ui/GuiUtils.java @@ -31,6 +31,8 @@ import javax.swing.table.TableColumnModel; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; import java.lang.reflect.InvocationTargetException; public final class GuiUtils { @@ -305,4 +307,25 @@ public final class GuiUtils { size.width = fontMetrics.charWidth('a') * charCount; return size; } + + public static void installVisibilityReferent(JComponent owner, JComponent referent) { + referent.addComponentListener(new ComponentAdapter() { + @Override + public void componentShown(ComponentEvent e) { + toggleVisibility(e); + } + + @Override + public void componentHidden(ComponentEvent e) { + toggleVisibility(e); + } + + private void toggleVisibility(ComponentEvent e) { + Component component = e.getComponent(); + if (component != null) { + owner.setVisible(component.isVisible()); + } + } + }); + } } diff --git a/platform/platform-api/src/com/intellij/util/ListSelection.java b/platform/platform-api/src/com/intellij/util/ListSelection.java new file mode 100644 index 000000000000..f63eb9d9d634 --- /dev/null +++ b/platform/platform-api/src/com/intellij/util/ListSelection.java @@ -0,0 +1,87 @@ +/* + * Copyright 2000-2017 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 com.intellij.util; + +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * Utility class used to preserve index during 'map' operations + */ +public class ListSelection { + @NotNull private final List myList; + private final int mySelectedIndex; + + private ListSelection(@NotNull List list, int selectedIndex) { + myList = list; + if (selectedIndex >= 0 && selectedIndex < list.size()) { + mySelectedIndex = selectedIndex; + } + else { + mySelectedIndex = 0; + } + } + + @NotNull + public static ListSelection createAt(@NotNull List list, int selectedIndex) { + return new ListSelection<>(list, selectedIndex); + } + + @NotNull + public static ListSelection create(@NotNull List list, V selected) { + return createAt(list, list.indexOf(selected)); + } + + @NotNull + public static ListSelection create(V @NotNull [] array, V selected) { + return create(Arrays.asList(array), selected); + } + + @NotNull + public static ListSelection createSingleton(@NotNull V element) { + return createAt(Collections.singletonList(element), 0); + } + + + @NotNull + public List getList() { + return myList; + } + + public int getSelectedIndex() { + return mySelectedIndex; + } + + public boolean isEmpty() { + return myList.isEmpty(); + } + + @NotNull + public ListSelection map(@NotNull NullableFunction convertor) { + int newSelectionIndex = -1; + List result = new ArrayList<>(); + for (int i = 0; i < myList.size(); i++) { + if (i == mySelectedIndex) newSelectionIndex = result.size(); + V out = convertor.fun(myList.get(i)); + if (out != null) result.add(out); + } + return new ListSelection<>(result, newSelectionIndex); + } +} diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index 7163fb4b6200..a87333dde55d 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -236,6 +236,7 @@ + + + diff --git a/platform/vcs-api/src/com/intellij/openapi/ListSelection.java b/platform/vcs-api/src/com/intellij/openapi/ListSelection.java index a028c8c90935..f36d889be55f 100644 --- a/platform/vcs-api/src/com/intellij/openapi/ListSelection.java +++ b/platform/vcs-api/src/com/intellij/openapi/ListSelection.java @@ -16,6 +16,7 @@ package com.intellij.openapi; import com.intellij.util.NullableFunction; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -23,18 +24,16 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +/** + * @deprecated use @see com.intellij.util.ListSelection instead + */ +@Deprecated +@ApiStatus.ScheduledForRemoval(inVersion = "2020.3") public class ListSelection { - @NotNull private final List myList; - private final int mySelectedIndex; + @NotNull private final com.intellij.util.ListSelection myInstance; private ListSelection(@NotNull List list, int selectedIndex) { - myList = list; - if (selectedIndex >= 0 && selectedIndex < list.size()) { - mySelectedIndex = selectedIndex; - } - else { - mySelectedIndex = 0; - } + myInstance = com.intellij.util.ListSelection.createAt(list, selectedIndex); } @NotNull @@ -60,24 +59,24 @@ public class ListSelection { @NotNull public List getList() { - return myList; + return myInstance.getList(); } public int getSelectedIndex() { - return mySelectedIndex; + return myInstance.getSelectedIndex(); } public boolean isEmpty() { - return myList.isEmpty(); + return myInstance.getList().isEmpty(); } @NotNull public ListSelection map(@NotNull NullableFunction convertor) { int newSelectionIndex = -1; List result = new ArrayList<>(); - for (int i = 0; i < myList.size(); i++) { - if (i == mySelectedIndex) newSelectionIndex = result.size(); - V out = convertor.fun(myList.get(i)); + for (int i = 0; i < getList().size(); i++) { + if (i == getSelectedIndex()) newSelectionIndex = result.size(); + V out = convertor.fun(getList().get(i)); if (out != null) result.add(out); } return new ListSelection<>(result, newSelectionIndex); diff --git a/platform/vcs-api/src/com/intellij/openapi/localVcs/UpToDateLineNumberProvider.java b/platform/vcs-api/src/com/intellij/openapi/localVcs/UpToDateLineNumberProvider.java index e367ad0ecf7b..90d0e9650470 100644 --- a/platform/vcs-api/src/com/intellij/openapi/localVcs/UpToDateLineNumberProvider.java +++ b/platform/vcs-api/src/com/intellij/openapi/localVcs/UpToDateLineNumberProvider.java @@ -15,9 +15,11 @@ */ package com.intellij.openapi.localVcs; +import com.intellij.openapi.LineNumberConstants; + public interface UpToDateLineNumberProvider { - int ABSENT_LINE_NUMBER = -1; - int FAKE_LINE_NUMBER = -2; + int ABSENT_LINE_NUMBER = LineNumberConstants.ABSENT_LINE_NUMBER; + int FAKE_LINE_NUMBER = LineNumberConstants.FAKE_LINE_NUMBER; int getLineCount(); int getLineNumber(int currentNumber); diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java index 5472bc6e2351..15df1cb33b43 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java @@ -20,7 +20,6 @@ public class VcsApplicationSettings implements PersistentStateComponent{0, choice, 1#One|2#{0}} added/edited TODO {0 paths.affected.in.revision=Paths Affected in Revision {0} -#Dir diff -refresh.failed.message=Refresh failed: {0} executable.select.label=&Path to {0} executable: executable.select.title=Select Executable executable.select.description=Select executable file to be used for VCS operations diff --git a/platform/vcs-impl/intellij.platform.vcs.impl.iml b/platform/vcs-impl/intellij.platform.vcs.impl.iml index aa6385d97136..1f708b4e2e26 100644 --- a/platform/vcs-impl/intellij.platform.vcs.impl.iml +++ b/platform/vcs-impl/intellij.platform.vcs.impl.iml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/diff/DiffVcsDataKeys.kt b/platform/vcs-impl/src/com/intellij/diff/DiffVcsDataKeys.kt new file mode 100644 index 000000000000..dad1d448d0d5 --- /dev/null +++ b/platform/vcs-impl/src/com/intellij/diff/DiffVcsDataKeys.kt @@ -0,0 +1,12 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.diff + +import com.intellij.openapi.util.Key +import com.intellij.openapi.util.Pair +import com.intellij.openapi.vcs.FilePath +import com.intellij.openapi.vcs.history.VcsRevisionNumber + +object DiffVcsDataKeys { + @JvmField + val REVISION_INFO: Key> = Key.create("Merge.RevisionInfo") +} \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/diff/DiffVcsFacadeImpl.kt b/platform/vcs-impl/src/com/intellij/diff/DiffVcsFacadeImpl.kt new file mode 100644 index 000000000000..d4c1e3dd69eb --- /dev/null +++ b/platform/vcs-impl/src/com/intellij/diff/DiffVcsFacadeImpl.kt @@ -0,0 +1,17 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.diff + +import com.intellij.diff.vcs.DiffVcsFacade +import com.intellij.openapi.vcs.FilePath +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.vcsUtil.VcsUtil + +class DiffVcsFacadeImpl : DiffVcsFacade() { + override fun getFilePath(path: String): FilePath { + return VcsUtil.getFilePath(path) + } + + override fun getFilePath(virtualFile: VirtualFile): FilePath { + return VcsUtil.getFilePath(virtualFile) + } +} \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateDiffViewerAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateDiffViewerAction.java index faeed053415d..b3921a5a7970 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateDiffViewerAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateDiffViewerAction.java @@ -18,7 +18,6 @@ import com.intellij.diff.tools.util.base.DiffViewerBase; import com.intellij.diff.tools.util.base.DiffViewerListener; import com.intellij.diff.tools.util.side.OnesideTextDiffViewer; import com.intellij.diff.tools.util.side.TwosideTextDiffViewer; -import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.diff.util.Side; import com.intellij.diff.util.ThreeSide; import com.intellij.notification.Notification; @@ -45,6 +44,7 @@ import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.impl.BackgroundableActionLock; import com.intellij.openapi.vcs.impl.UpToDateLineNumberProviderImpl; import com.intellij.openapi.vcs.impl.VcsBackgroundableActions; +import com.intellij.diff.DiffVcsDataKeys; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.IdeFrame; import com.intellij.ui.BalloonLayoutData; @@ -236,7 +236,7 @@ public class AnnotateDiffViewerAction { if (loader != null) return loader; } - Pair info = content.getUserData(DiffUserDataKeysEx.REVISION_INFO); + Pair info = content.getUserData(DiffVcsDataKeys.REVISION_INFO); if (info != null) { FilePath filePath = info.first; AbstractVcs vcs = VcsUtil.getVcsFor(project, filePath); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java index 8ff6e62797d9..68bf16361a56 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java @@ -9,7 +9,6 @@ import com.intellij.diff.contents.DiffContent; import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.requests.SimpleDiffRequest; import com.intellij.diff.util.DiffUserDataKeys; -import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.diff.util.Side; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -32,6 +31,7 @@ import com.intellij.openapi.vcs.diff.DiffProvider; import com.intellij.openapi.vcs.diff.ItemLatestState; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.impl.VcsBackgroundableActions; +import com.intellij.diff.DiffVcsDataKeys; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; @@ -90,7 +90,7 @@ public abstract class DiffActionExecutor { diffContent = contentFactory.create(myProject, content, fileRevision.getFile()); } - diffContent.putUserData(DiffUserDataKeysEx.REVISION_INFO, Pair.create(fileRevision.getFile(), fileRevision.getRevisionNumber())); + diffContent.putUserData(DiffVcsDataKeys.REVISION_INFO, Pair.create(fileRevision.getFile(), fileRevision.getRevisionNumber())); return diffContent; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/ShowDiffFromAnnotation.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/ShowDiffFromAnnotation.java index 4bacadd1c467..60457fca3f0f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/ShowDiffFromAnnotation.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/ShowDiffFromAnnotation.java @@ -20,7 +20,6 @@ import com.intellij.diff.DiffManager; import com.intellij.diff.chains.DiffRequestChain; import com.intellij.diff.chains.DiffRequestProducerException; import com.intellij.diff.util.DiffUserDataKeysEx; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CustomShortcutSet; import com.intellij.openapi.actionSystem.IdeActions; @@ -44,6 +43,7 @@ import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain; import com.intellij.openapi.vcs.changes.ui.ChangesComparator; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; +import com.intellij.util.ListSelection; import com.intellij.util.containers.CacheOneStepIterator; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsChangesSelectionRule.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsChangesSelectionRule.java index 8f780e49a8e4..a4b82a5897c8 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsChangesSelectionRule.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsChangesSelectionRule.java @@ -16,9 +16,9 @@ package com.intellij.openapi.vcs.changes; import com.intellij.ide.impl.dataRules.GetDataRule; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.vcs.VcsDataKeys; +import com.intellij.util.ListSelection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowDiffWithLocalAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowDiffWithLocalAction.java index 54ecd856cc24..092d68584f48 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowDiffWithLocalAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowDiffWithLocalAction.java @@ -2,7 +2,6 @@ package com.intellij.openapi.vcs.changes.actions; import com.intellij.icons.AllIcons; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionExtensionProvider; @@ -19,6 +18,7 @@ import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.changes.CurrentContentRevision; import com.intellij.openapi.vcs.changes.committed.CommittedChangesBrowserUseCase; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.ListSelection; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java index 28afd5bc0de8..13c61c676bcc 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java @@ -14,7 +14,6 @@ import com.intellij.diff.contents.DiffContent; import com.intellij.diff.contents.DocumentContent; import com.intellij.diff.contents.FileContent; import com.intellij.diff.impl.DiffViewerWrapper; -import com.intellij.diff.merge.MergeUtil; import com.intellij.diff.requests.ContentDiffRequest; import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.requests.ErrorDiffRequest; @@ -47,6 +46,8 @@ import com.intellij.openapi.vcs.changes.actions.diff.lst.LocalChangeListDiffRequ import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain; import com.intellij.openapi.vcs.impl.LineStatusTrackerManager; import com.intellij.openapi.vcs.merge.MergeData; +import com.intellij.diff.DiffVcsDataKeys; +import com.intellij.openapi.vcs.merge.MergeUtils; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThreeState; @@ -327,7 +328,7 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer, ChangeDif contentFactory.createFromBytes(project, mergeData.LAST, file)); SimpleDiffRequest request = new SimpleDiffRequest(title, contents, titles); - MergeUtil.putRevisionInfos(request, mergeData); + MergeUtils.putRevisionInfos(request, mergeData); return request; } @@ -441,7 +442,7 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer, ChangeDif content = contentFactory.create(project, revisionContent, filePath); } - content.putUserData(DiffUserDataKeysEx.REVISION_INFO, Pair.create(revision.getFile(), revision.getRevisionNumber())); + content.putUserData(DiffVcsDataKeys.REVISION_INFO, Pair.create(revision.getFile(), revision.getRevisionNumber())); return content; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffAction.java index b27e9230791d..6d77a32a6246 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffAction.java @@ -18,7 +18,6 @@ package com.intellij.openapi.vcs.changes.actions.diff; import com.intellij.diff.DiffManager; import com.intellij.diff.chains.DiffRequestChain; import com.intellij.diff.util.DiffUserDataKeys; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionExtensionProvider; @@ -29,6 +28,7 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.vcs.VcsDataKeys; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain; +import com.intellij.util.ListSelection; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffFromLocalChangesActionProvider.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffFromLocalChangesActionProvider.java index c54578bd6c36..0742df62750c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffFromLocalChangesActionProvider.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffFromLocalChangesActionProvider.java @@ -7,7 +7,6 @@ import com.intellij.diff.chains.DiffRequestChain; import com.intellij.diff.chains.DiffRequestProducerException; import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.idea.ActionsBundle; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.project.Project; @@ -16,6 +15,7 @@ import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain; import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain.Producer; import com.intellij.openapi.vcs.changes.ui.ChangesListView; +import com.intellij.util.ListSelection; import com.intellij.util.concurrency.FutureResult; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesActionProvider.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesActionProvider.java index e96b3176405e..d9d536aba19a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesActionProvider.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesActionProvider.java @@ -12,7 +12,6 @@ import com.intellij.diff.requests.SimpleDiffRequest; import com.intellij.diff.requests.UnknownFileTypeDiffRequest; import com.intellij.diff.tools.util.SoftHardCacheMap; import com.intellij.diff.util.DiffUtil; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionExtensionProvider; import com.intellij.openapi.actionSystem.CommonDataKeys; @@ -41,6 +40,7 @@ import com.intellij.openapi.vcs.changes.patch.ApplyPatchForBaseRevisionTexts; import com.intellij.openapi.vcs.changes.patch.tool.PatchDiffRequest; import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.ListSelection; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.CalledInBackground; import org.jetbrains.annotations.NotNull; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java index 16b3180c2032..1dad62ca66ad 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java @@ -16,7 +16,6 @@ import com.intellij.ide.dnd.aware.DnDAwareTree; import com.intellij.notification.Notification; import com.intellij.notification.NotificationAction; import com.intellij.openapi.Disposable; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; @@ -52,6 +51,7 @@ import com.intellij.ui.content.impl.ContentImpl; import com.intellij.util.Consumer; import com.intellij.util.IconUtil; import com.intellij.util.IconUtil.IconSizeWrapper; +import com.intellij.util.ListSelection; import com.intellij.util.PathUtil; import com.intellij.util.containers.UtilKt; import com.intellij.util.text.DateFormatUtil; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeDiffRequestChain.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeDiffRequestChain.java index d3792c7ba315..e3ce970ce19f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeDiffRequestChain.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeDiffRequestChain.java @@ -3,7 +3,6 @@ package com.intellij.openapi.vcs.changes.ui; import com.intellij.diff.actions.impl.GoToChangePopupBuilder; import com.intellij.diff.chains.*; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -13,6 +12,7 @@ import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.changes.actions.diff.ChangeGoToChangePopupAction; import com.intellij.util.Consumer; +import com.intellij.util.ListSelection; import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; @@ -185,7 +185,7 @@ public class ChangeDiffRequestChain extends DiffRequestChainBase implements GoTo public static abstract class Async extends AsyncDiffRequestChain implements GoToChangePopupBuilder.Chain { @NotNull @Override - protected abstract ListSelection loadRequestProducers() throws DiffRequestProducerException; + protected abstract ListSelection loadRequestProducers() throws DiffRequestProducerException; @Nullable @Override diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java index 7b4a706ad788..946436e4536a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java @@ -5,7 +5,6 @@ import com.intellij.diff.DiffDialogHints; import com.intellij.diff.DiffManager; import com.intellij.diff.chains.DiffRequestChain; import com.intellij.diff.util.DiffUserDataKeys; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ActionUtil; import com.intellij.openapi.project.DumbAwareAction; @@ -15,6 +14,7 @@ import com.intellij.openapi.vcs.changes.actions.diff.ChangeDiffRequestProducer; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.SideBorder; +import com.intellij.util.ListSelection; import com.intellij.util.containers.ContainerUtil; import org.intellij.lang.annotations.MagicConstant; import org.jetbrains.annotations.NotNull; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/OldChangesBrowserBase.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/OldChangesBrowserBase.java index df8deb815b08..5ab6ac00f4b6 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/OldChangesBrowserBase.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/OldChangesBrowserBase.java @@ -4,7 +4,6 @@ package com.intellij.openapi.vcs.changes.ui; import com.intellij.diff.DiffDialogHints; import com.intellij.ide.DeleteProvider; import com.intellij.openapi.Disposable; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ActionUtil; import com.intellij.openapi.actionSystem.ex.CheckboxAction; @@ -23,6 +22,7 @@ import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction; import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffContext; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.ScrollPaneFactory; +import com.intellij.util.ListSelection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsTreeModelData.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsTreeModelData.java index 0c3175d60944..ec454e1a910d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsTreeModelData.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsTreeModelData.java @@ -1,7 +1,6 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.ui; -import com.intellij.openapi.ListSelection; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.FilePath; @@ -9,6 +8,7 @@ import com.intellij.openapi.vcs.VcsDataKeys; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangesUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.ListSelection; import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java index c4a5c4b946f7..04f2c038870b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java @@ -21,7 +21,6 @@ import com.intellij.diff.DiffRequestFactoryImpl; import com.intellij.diff.contents.DiffContent; import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.requests.SimpleDiffRequest; -import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; @@ -32,6 +31,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vcs.VcsException; +import com.intellij.diff.DiffVcsDataKeys; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.encoding.EncodingManager; @@ -46,7 +46,7 @@ import static com.intellij.diff.DiffRequestFactoryImpl.DIFF_TITLE_RENAME_SEPARAT public class VcsHistoryUtil { @Deprecated - public static final Key> REVISION_INFO_KEY = DiffUserDataKeysEx.REVISION_INFO; + public static final Key> REVISION_INFO_KEY = DiffVcsDataKeys.REVISION_INFO; private static final Logger LOG = Logger.getInstance(VcsHistoryUtil.class); @@ -105,8 +105,8 @@ public class VcsHistoryUtil { final DiffRequest request = new SimpleDiffRequest(title, diffContent1, diffContent2, title1, title2); - diffContent1.putUserData(DiffUserDataKeysEx.REVISION_INFO, getRevisionInfo(revision1)); - diffContent2.putUserData(DiffUserDataKeysEx.REVISION_INFO, getRevisionInfo(revision2)); + diffContent1.putUserData(DiffVcsDataKeys.REVISION_INFO, getRevisionInfo(revision1)); + diffContent2.putUserData(DiffVcsDataKeys.REVISION_INFO, getRevisionInfo(revision2)); WaitForProgressToShow.runOrInvokeLaterAboveProgress(() -> DiffManager.getInstance().showDiff(project, request), null, project); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MergeUtils.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MergeUtils.kt new file mode 100644 index 000000000000..5204b8743c75 --- /dev/null +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MergeUtils.kt @@ -0,0 +1,46 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.openapi.vcs.merge + +import com.intellij.diff.DiffVcsDataKeys +import com.intellij.diff.contents.DiffContent +import com.intellij.diff.merge.MergeRequest +import com.intellij.diff.merge.ThreesideMergeRequest +import com.intellij.diff.requests.ContentDiffRequest +import com.intellij.diff.requests.DiffRequest +import com.intellij.diff.util.ThreeSide +import com.intellij.openapi.util.Pair +import com.intellij.openapi.vcs.FilePath +import com.intellij.openapi.vcs.history.VcsRevisionNumber + +object MergeUtils { + + @JvmStatic + fun putRevisionInfos(request: MergeRequest, data: MergeData) { + if (request is ThreesideMergeRequest) { + val contents = request.contents + putRevisionInfo(contents, data) + } + } + + @JvmStatic + fun putRevisionInfos(request: DiffRequest, data: MergeData) { + if (request is ContentDiffRequest) { + val contents = request.contents + if (contents.size == 3) { + putRevisionInfo(contents, data) + } + } + } + + private fun putRevisionInfo(contents: List, data: MergeData) { + for (side in ThreeSide.values()) { + val content = side.select(contents) + val filePath: FilePath? = side.select(data.CURRENT_FILE_PATH, data.ORIGINAL_FILE_PATH, data.LAST_FILE_PATH) + val revision: VcsRevisionNumber? = side.select(data.CURRENT_REVISION_NUMBER, data.ORIGINAL_REVISION_NUMBER, + data.LAST_REVISION_NUMBER) + if (filePath != null && revision != null) { + content.putUserData(DiffVcsDataKeys.REVISION_INFO, Pair.create(filePath, revision)) + } + } + } +} \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MultipleFileMergeDialog.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MultipleFileMergeDialog.kt index c1050ef96d72..579e361e20ca 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MultipleFileMergeDialog.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/merge/MultipleFileMergeDialog.kt @@ -38,7 +38,6 @@ import com.intellij.ui.DoubleClickListener import com.intellij.ui.TableSpeedSearch import com.intellij.ui.components.Label import com.intellij.ui.layout.* -import com.intellij.ui.scale.JBUIScale import com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns import com.intellij.ui.treeStructure.treetable.TreeTable import com.intellij.ui.treeStructure.treetable.TreeTableModel @@ -428,7 +427,7 @@ open class MultipleFileMergeDialog( request = requestFactory.createMergeRequest(project, file, byteContents, title, contentTitles, callback) } - MergeUtil.putRevisionInfos(request, mergeData) + MergeUtils.putRevisionInfos(request, mergeData) } catch (e: InvalidDiffRequestException) { if (e.cause is FileTooBigException) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java index 18846588351d..5cfbe3800115 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java @@ -43,7 +43,6 @@ import com.intellij.vcs.log.util.BekUtil; import com.intellij.vcs.log.util.VcsLogUiUtil; import com.intellij.vcs.log.util.VcsLogUtil; import com.intellij.vcs.log.visible.VisiblePack; -import com.intellij.vcsUtil.UIVcsUtilKt; import net.miginfocom.swing.MigLayout; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -247,7 +246,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { leftCornerToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY); JPanel panel = new JPanel(new MigLayout("ins 0, fill", "[]0[left]0[left, fill]push[right]", "center")); - UIVcsUtilKt.installVisibilityReferent(panel, toolbar.getComponent()); + GuiUtils.installVisibilityReferent(panel, toolbar.getComponent()); panel.add(leftCornerToolbar.getComponent()); panel.add(textFilter); panel.add(toolbar.getComponent()); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java index fed848ea154a..448d24ce5719 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java @@ -21,6 +21,7 @@ import com.intellij.openapi.vcs.history.ShortVcsRevisionNumber; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.ComponentUtil; +import com.intellij.ui.GuiUtils; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.SideBorder; import com.intellij.ui.components.panels.Wrapper; @@ -44,7 +45,6 @@ import com.intellij.vcs.log.ui.VcsLogActionPlaces; import com.intellij.vcs.log.util.StopWatch; import com.intellij.vcs.log.util.VcsLogUiUtil; import com.intellij.vcs.log.util.VcsLogUtil; -import com.intellij.vcsUtil.UIVcsUtilKt; import com.intellij.vcsUtil.VcsFileUtil; import gnu.trove.THashSet; import org.jetbrains.annotations.Nls; @@ -104,7 +104,7 @@ public class VcsLogChangesBrowser extends ChangesBrowserBase implements Disposab JComponent toolbarComponent = getToolbar().getComponent(); myToolbarWrapper = new Wrapper(toolbarComponent); - UIVcsUtilKt.installVisibilityReferent(myToolbarWrapper, toolbarComponent); + GuiUtils.installVisibilityReferent(myToolbarWrapper, toolbarComponent); init(); diff --git a/plugins/git4idea/src/git4idea/conflicts/MergeConflictResolveUtil.kt b/plugins/git4idea/src/git4idea/conflicts/MergeConflictResolveUtil.kt index f70aecbab72c..8aebfd533593 100644 --- a/plugins/git4idea/src/git4idea/conflicts/MergeConflictResolveUtil.kt +++ b/plugins/git4idea/src/git4idea/conflicts/MergeConflictResolveUtil.kt @@ -19,6 +19,7 @@ import com.intellij.openapi.util.Key import com.intellij.openapi.util.UserDataHolder import com.intellij.openapi.vcs.impl.BackgroundableActionLock import com.intellij.openapi.vcs.merge.MergeDialogCustomizer +import com.intellij.openapi.vcs.merge.MergeUtils import com.intellij.openapi.vfs.VirtualFile import com.intellij.ui.EditorNotificationPanel import com.intellij.ui.EditorNotifications @@ -72,7 +73,7 @@ object MergeConflictResolveUtil { request.putUserData(DiffUserDataKeysEx.EDITORS_TITLE_CUSTOMIZER, listOf(leftTitleCustomizer, centerTitleCustomizer, rightTitleCustomizer)) } - MergeUtil.putRevisionInfos(request, mergeData) + MergeUtils.putRevisionInfos(request, mergeData) MergeCallback.register(request, MyMergeCallback(resolver)) return request } diff --git a/plugins/git4idea/src/git4idea/log/GitLogDiffHandler.java b/plugins/git4idea/src/git4idea/log/GitLogDiffHandler.java index 937274a8b009..7e6a81f7edb9 100644 --- a/plugins/git4idea/src/git4idea/log/GitLogDiffHandler.java +++ b/plugins/git4idea/src/git4idea/log/GitLogDiffHandler.java @@ -7,7 +7,6 @@ import com.intellij.diff.contents.DiffContent; import com.intellij.diff.contents.EmptyContent; import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.requests.SimpleDiffRequest; -import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressIndicator; @@ -23,6 +22,7 @@ import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.history.VcsDiffUtil; +import com.intellij.diff.DiffVcsDataKeys; import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; @@ -230,7 +230,7 @@ public class GitLogDiffHandler implements VcsLogDiffHandler { } } - diffContent.putUserData(DiffUserDataKeysEx.REVISION_INFO, new Pair<>(path, revisionNumber)); + diffContent.putUserData(DiffVcsDataKeys.REVISION_INFO, new Pair<>(path, revisionNumber)); return diffContent; }