add rebuild index action without restart

GitOrigin-RevId: 3ebc5c4265dbfe4dd702a33b6fffc60c29c4a788
This commit is contained in:
Dmitry Batkovich
2021-07-30 14:29:55 +00:00
committed by intellij-monorepo-bot
parent 33ce598718
commit 6f345132e2
4 changed files with 23 additions and 0 deletions
@@ -16,6 +16,7 @@ import kotlin.io.path.deleteExisting
internal object CorruptionMarker {
private const val CORRUPTION_MARKER_NAME = "corruption.marker"
private const val MARKED_AS_DIRTY_REASON = "Indexes marked as dirty (IDE is expected to be work)"
private const val FORCE_REBUILD_REASON = "Indexes were forcibly marked as corrupted"
private const val EXPLICIT_INVALIDATION_REASON = "Explicit index invalidation"
private val corruptionMarker
@@ -0,0 +1,20 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.util.indexing;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NotNull;
final class ForceIndexRebuildAction extends DumbAwareAction {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
FileBasedIndexTumbler tumbler = new FileBasedIndexTumbler();
tumbler.turnOff();
try {
CorruptionMarker.requestInvalidation();
}
finally {
tumbler.turnOn();
}
}
}
@@ -2483,3 +2483,4 @@ action.RunToolbarPauseAction.text=Pause
action.RunToolbarHotSwapAction.text=HotSwap
action.ForceIndexRescanning.text=Synchronize Indexes
action.ForceIndexRebuild.text=Rebuild Indexes
@@ -1592,5 +1592,6 @@
use-shortcut-of="GotoDeclaration" />
<action id="ForceIndexRescanning" internal="true" class="com.intellij.util.indexing.ForceIndexRescanningAction" icon="AllIcons.Actions.Refresh"/>
<action id="ForceIndexRebuild" internal="true" class="com.intellij.util.indexing.ForceIndexRebuildAction" icon="AllIcons.Actions.Refresh"/>
</actions>
</idea-plugin>