mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
[platform cleanup] simplify enum values' names of CanISilentlyChange.Result
UH_HUH, UH_UH are not very common words, let's use YES and NO instead. GitOrigin-RevId: 994a97928c3d2c4a2836f908162ba1b2d97129aa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
22eb80d15b
commit
56ca3fc2ef
@@ -51,12 +51,13 @@ final class CanISilentlyChange {
|
||||
}
|
||||
|
||||
enum Result {
|
||||
UH_HUH, UH_UH, ONLY_WHEN_IN_CONTENT;
|
||||
YES, NO, ONLY_WHEN_IN_CONTENT;
|
||||
|
||||
// can call from any thread
|
||||
boolean canIReally(boolean isInContent, @NotNull ThreeState extensionsAllowToChangeFileSilently) {
|
||||
return switch (this) {
|
||||
case UH_HUH -> extensionsAllowToChangeFileSilently != ThreeState.NO;
|
||||
case UH_UH -> false;
|
||||
case YES -> extensionsAllowToChangeFileSilently != ThreeState.NO;
|
||||
case NO -> false;
|
||||
case ONLY_WHEN_IN_CONTENT -> extensionsAllowToChangeFileSilently != ThreeState.NO && isInContent;
|
||||
};
|
||||
}
|
||||
@@ -67,14 +68,14 @@ final class CanISilentlyChange {
|
||||
Project project = file.getProject();
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile == null) {
|
||||
return Result.UH_UH;
|
||||
return Result.NO;
|
||||
}
|
||||
if (file instanceof PsiCodeFragment) {
|
||||
return Result.UH_HUH;
|
||||
return Result.YES;
|
||||
}
|
||||
if (ScratchUtil.isScratch(virtualFile)) {
|
||||
return canUndo(virtualFile, project) ? Result.UH_HUH : Result.UH_UH;
|
||||
return canUndo(virtualFile, project) ? Result.YES : Result.NO;
|
||||
}
|
||||
return canUndo(virtualFile, project) ? Result.ONLY_WHEN_IN_CONTENT : Result.UH_UH;
|
||||
return canUndo(virtualFile, project) ? Result.ONLY_WHEN_IN_CONTENT : Result.NO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class HighlightingSessionImpl implements HighlightingSession {
|
||||
Map<PsiFile, HighlightingSession> map = progressIndicator.getUserData(HIGHLIGHTING_SESSION);
|
||||
HighlightingSession session = map == null ? null : map.get(psiFile);
|
||||
if (session == null) {
|
||||
createHighlightingSession(psiFile, progressIndicator, null, visibleRange, CanISilentlyChange.Result.UH_UH, 0);
|
||||
createHighlightingSession(psiFile, progressIndicator, null, visibleRange, CanISilentlyChange.Result.NO, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,8 +162,8 @@ public final class HighlightingSessionImpl implements HighlightingSession {
|
||||
ApplicationManager.getApplication().assertIsNonDispatchThread();
|
||||
DaemonProgressIndicator indicator = GlobalInspectionContextBase.assertUnderDaemonProgress();
|
||||
HighlightingSessionImpl session = createHighlightingSession(file, indicator, editorColorsScheme, visibleRange, canChangeFileSilently
|
||||
? CanISilentlyChange.Result.UH_HUH
|
||||
: CanISilentlyChange.Result.UH_UH,
|
||||
? CanISilentlyChange.Result.YES
|
||||
: CanISilentlyChange.Result.NO,
|
||||
0);
|
||||
try {
|
||||
session.additionalSetupFromBackground(file);
|
||||
@@ -187,8 +187,8 @@ public final class HighlightingSessionImpl implements HighlightingSession {
|
||||
}
|
||||
DaemonProgressIndicator indicator = GlobalInspectionContextBase.assertUnderDaemonProgress();
|
||||
HighlightingSessionImpl session = createHighlightingSession(file, indicator, editorColorsScheme, visibleRange, canChangeFileSilently
|
||||
? CanISilentlyChange.Result.UH_HUH
|
||||
: CanISilentlyChange.Result.UH_UH,
|
||||
? CanISilentlyChange.Result.YES
|
||||
: CanISilentlyChange.Result.NO,
|
||||
0);
|
||||
session.myInContent = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user