mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
[lvcs] cleanup: gateway property can be not-null
GitOrigin-RevId: c7813c2ba95a9bbb0d8e95118bf2acb126a7daea
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a88eb6a71b
commit
4080f662b0
@@ -55,8 +55,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
var facade: LocalHistoryFacade? = null
|
||||
private set
|
||||
|
||||
var gateway: IdeaGateway? = null
|
||||
private set
|
||||
val gateway: IdeaGateway = IdeaGateway()
|
||||
|
||||
private var flusherTask: Job? = null
|
||||
private val initialFlush = AtomicBoolean(true)
|
||||
@@ -122,8 +121,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
storage = InMemoryChangeListStorage()
|
||||
}
|
||||
facade = LocalHistoryFacade(ChangeList(storage))
|
||||
gateway = IdeaGateway()
|
||||
eventDispatcher = LocalHistoryEventDispatcher(facade!!, gateway!!)
|
||||
eventDispatcher = LocalHistoryEventDispatcher(facade!!, gateway)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
@@ -186,7 +184,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
return Label.NULL_INSTANCE
|
||||
}
|
||||
|
||||
gateway!!.registerUnsavedDocuments(facade!!)
|
||||
gateway.registerUnsavedDocuments(facade!!)
|
||||
return label(facade!!.putSystemLabel(name, getProjectId(project), color))
|
||||
}
|
||||
|
||||
@@ -203,7 +201,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
|
||||
override fun getByteContent(path: String): ByteContent {
|
||||
return ApplicationManager.getApplication().runReadAction(Computable {
|
||||
label.getByteContent(gateway!!.createTransientRootEntryForPath(path, false), path)
|
||||
label.getByteContent(gateway.createTransientRootEntryForPath(path, false), path)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -215,7 +213,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
}
|
||||
|
||||
return ApplicationManager.getApplication().runReadAction(Computable {
|
||||
if (gateway!!.areContentChangesVersioned(virtualFile)) {
|
||||
if (gateway.areContentChangesVersioned(virtualFile)) {
|
||||
ByteContentRetriever(gateway, facade, virtualFile, condition).getResult()
|
||||
}
|
||||
else {
|
||||
@@ -224,13 +222,13 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
})
|
||||
}
|
||||
|
||||
override fun isUnderControl(file: VirtualFile): Boolean = isInitialized() && gateway!!.isVersioned(file)
|
||||
override fun isUnderControl(file: VirtualFile): Boolean = isInitialized() && gateway.isVersioned(file)
|
||||
|
||||
private fun isInitialized(): Boolean = isInitialized.get()
|
||||
|
||||
@Throws(LocalHistoryException::class)
|
||||
private fun revertToLabel(project: Project, f: VirtualFile, label: LabelImpl) {
|
||||
val path = gateway!!.getPathOrUrl(f)
|
||||
val path = gateway.getPathOrUrl(f)
|
||||
|
||||
var targetChangeSet: ChangeSet? = null
|
||||
var targetChange: Change? = null
|
||||
@@ -248,7 +246,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
throw LocalHistoryException("Couldn't find label")
|
||||
}
|
||||
|
||||
val rootEntry = runReadAction { gateway!!.createTransientRootEntryForPaths(targetPaths, true) }
|
||||
val rootEntry = runReadAction { gateway.createTransientRootEntryForPaths(targetPaths, true) }
|
||||
val leftEntry = facade!!.findEntry(rootEntry, RevisionId.ChangeSet(targetChangeSet!!.id), path,
|
||||
/*do not revert the change itself*/false)
|
||||
val rightEntry = rootEntry.findEntry(path)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.history.integration.ui.actions;
|
||||
|
||||
@@ -15,8 +15,6 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public abstract class LocalHistoryAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
@@ -28,9 +26,8 @@ public abstract class LocalHistoryAction extends AnAction implements DumbAware {
|
||||
|
||||
Project project = e.getProject();
|
||||
LocalHistoryFacade vcs = getVcs();
|
||||
IdeaGateway gateway = getGateway();
|
||||
|
||||
e.getPresentation().setEnabled(project != null && vcs != null && gateway != null);
|
||||
e.getPresentation().setEnabled(project != null && vcs != null);
|
||||
e.getPresentation().setVisible(project != null);
|
||||
}
|
||||
|
||||
@@ -43,7 +40,7 @@ public abstract class LocalHistoryAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project == null) return;
|
||||
actionPerformed(project, Objects.requireNonNull(getGateway()), e);
|
||||
actionPerformed(project, getGateway(), e);
|
||||
}
|
||||
|
||||
protected abstract void actionPerformed(@NotNull Project p, @NotNull IdeaGateway gw, @NotNull AnActionEvent e);
|
||||
@@ -52,7 +49,7 @@ public abstract class LocalHistoryAction extends AnAction implements DumbAware {
|
||||
return LocalHistoryImpl.getInstanceImpl().getFacade();
|
||||
}
|
||||
|
||||
protected @Nullable IdeaGateway getGateway() {
|
||||
protected @NotNull IdeaGateway getGateway() {
|
||||
return LocalHistoryImpl.getInstanceImpl().getGateway();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ShowHistoryAction extends LocalHistoryAction {
|
||||
if (presentation.isEnabled()) {
|
||||
IdeaGateway gateway = getGateway();
|
||||
Collection<VirtualFile> files = getFiles(e);
|
||||
presentation.setEnabled(gateway != null && isActionEnabled(gateway, files));
|
||||
presentation.setEnabled(isActionEnabled(gateway, files));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 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.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.command.impl;
|
||||
|
||||
import com.intellij.configurationStore.StorageManagerFileWriteRequestor;
|
||||
@@ -49,7 +49,7 @@ public final class FileUndoProvider implements UndoProvider, BulkFileListener {
|
||||
if (!(localHistory instanceof LocalHistoryImpl)) return;
|
||||
myLocalHistory = ((LocalHistoryImpl)localHistory).getFacade();
|
||||
myGateway = ((LocalHistoryImpl)localHistory).getGateway();
|
||||
if (myLocalHistory == null || myGateway == null) return; // local history was not initialized (e.g. in headless environment)
|
||||
if (myLocalHistory == null) return; // local history was not initialized (e.g. in headless environment)
|
||||
|
||||
((LocalHistoryImpl)localHistory).addVFSListenerAfterLocalHistoryOne(this, project);
|
||||
myLocalHistory.addListener(new LocalHistoryFacade.Listener() {
|
||||
|
||||
@@ -41,7 +41,7 @@ abstract class ChangeSetSelectionAction : DumbAwareAction() {
|
||||
|
||||
val localHistoryImpl = LocalHistoryImpl.getInstanceImpl()
|
||||
val facade = localHistoryImpl.facade ?: return
|
||||
val gateway = localHistoryImpl.gateway ?: return
|
||||
val gateway = localHistoryImpl.gateway
|
||||
|
||||
val selection = activitySelection.toChangeSetSelection() ?: return
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ internal class RevertDifferencesAction : DumbAwareAction() {
|
||||
|
||||
val localHistoryImpl = LocalHistoryImpl.getInstanceImpl()
|
||||
val facade = localHistoryImpl.facade ?: return
|
||||
val gateway = localHistoryImpl.gateway ?: return
|
||||
val gateway = localHistoryImpl.gateway
|
||||
|
||||
LocalHistoryCounter.logActionInvoked(LocalHistoryCounter.ActionKind.RevertChanges, activityScope)
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class CreateIncrementalCompilationBackup : AnAction(KotlinJvmBundle.message("cre
|
||||
private fun createPatches(backupDir: File, project: Project, indicator: ProgressIndicator) {
|
||||
runReadAction {
|
||||
val localHistoryImpl = LocalHistoryImpl.getInstanceImpl()!!
|
||||
val gateway = localHistoryImpl.gateway!!
|
||||
val gateway = localHistoryImpl.gateway
|
||||
val localHistoryFacade = localHistoryImpl.facade
|
||||
|
||||
val revisions = RevisionsCollector.collect(
|
||||
|
||||
Reference in New Issue
Block a user