From d90f87964921aaa2dd7ce03b7f28bec35a4c3358 Mon Sep 17 00:00:00 2001 From: Dmitry Zhuravlev Date: Mon, 9 Sep 2024 17:37:23 +0200 Subject: [PATCH] [lvcs] extract idea gateway API (IJPL-161713) GitOrigin-RevId: 6e7944d2f7cec28c950a669b00a057f73cf927ca --- platform/lvcs-impl/api-dump.txt | 1 + platform/lvcs-impl/resources/intellij.platform.lvcs.impl.xml | 1 + .../src/com/intellij/history/integration/IdeaGateway.java | 4 ++++ .../src/com/intellij/history/integration/LocalHistoryImpl.kt | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/lvcs-impl/api-dump.txt b/platform/lvcs-impl/api-dump.txt index 7d81d95378da..edae107c8f3b 100644 --- a/platform/lvcs-impl/api-dump.txt +++ b/platform/lvcs-impl/api-dump.txt @@ -436,6 +436,7 @@ c:com.intellij.history.integration.IdeaGateway - findVirtualFile(java.lang.String):com.intellij.openapi.vfs.VirtualFile - getDocument(java.lang.String):com.intellij.openapi.editor.Document - getFileType(java.lang.String):com.intellij.openapi.fileTypes.FileType +- s:getInstance():com.intellij.history.integration.IdeaGateway - s:getNameOrUrlPart(com.intellij.openapi.vfs.VirtualFile):java.lang.String - getPathOrUrl(com.intellij.openapi.vfs.VirtualFile):java.lang.String - ps:getVersionedFilterData():com.intellij.history.integration.IdeaGateway$VersionedFilterData diff --git a/platform/lvcs-impl/resources/intellij.platform.lvcs.impl.xml b/platform/lvcs-impl/resources/intellij.platform.lvcs.impl.xml index 0d832dcccbbf..1ce64323c644 100644 --- a/platform/lvcs-impl/resources/intellij.platform.lvcs.impl.xml +++ b/platform/lvcs-impl/resources/intellij.platform.lvcs.impl.xml @@ -82,6 +82,7 @@ + diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java index f5784d2376b9..153cbedcb313 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java @@ -48,6 +48,10 @@ public class IdeaGateway { private static final Key SAVED_DOCUMENT_CONTENT_AND_STAMP_KEY = Key.create("LocalHistory.SAVED_DOCUMENT_CONTENT_AND_STAMP_KEY"); + public static @NotNull IdeaGateway getInstance() { + return ApplicationManager.getApplication().getService(IdeaGateway.class); + } + public boolean isVersioned(@NotNull VirtualFile f) { return isVersioned(f, false); } diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.kt b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.kt index 954bc87326a6..aaa0694d9ec1 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.kt +++ b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.kt @@ -39,6 +39,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor /** * @see [LocalHistory.getInstance] * @see [LocalHistoryFacade.getInstance] + * @see [IdeaGateway.getInstance] */ @JvmStatic fun getInstanceImpl(): LocalHistoryImpl = getInstance() as LocalHistoryImpl @@ -54,7 +55,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor var facade: LocalHistoryFacade? = null private set - val gateway: IdeaGateway = IdeaGateway() + val gateway: IdeaGateway = IdeaGateway.getInstance() private var flusherTask: Job? = null private val initialFlush = AtomicBoolean(true)