[spelling] Deprecated BaseSplitter.checkCancelled

ProgressManager#checkCanceled() must be used instead

GitOrigin-RevId: 5bb2faf5e77b4492a0c43e6409fde48cf712cf44
This commit is contained in:
Yuriy Artamonov
2024-07-30 10:28:32 +02:00
committed by intellij-monorepo-bot
parent ab436d1387
commit 04e9be386c
2 changed files with 9 additions and 3 deletions

View File

@@ -78,10 +78,12 @@ public abstract class BaseSplitter implements Splitter {
int from = range.getStartOffset();
int till;
boolean addLast = true;
try {
Matcher matcher = toExclude.matcher(newBombedCharSequence(text, range));
while (matcher.find()) {
checkCancelled();
ProgressManager.checkCanceled();
TextRange found = matcherRange(range, matcher);
till = found.getStartOffset();
if (range.getEndOffset() - found.getEndOffset() < MIN_RANGE_LENGTH) {
@@ -138,6 +140,10 @@ public abstract class BaseSplitter implements Splitter {
};
}
/**
* @deprecated Use {@link ProgressManager#checkCanceled()}.
*/
@Deprecated(forRemoval = true)
public static void checkCancelled() {
if (ApplicationManager.getApplication() != null) {
ProgressIndicatorProvider.checkCanceled();

View File

@@ -1,7 +1,7 @@
// 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.spellchecker.inspections;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
@@ -74,7 +74,7 @@ public class PlainTextSplitter extends BaseSplitter {
matcher = SPLIT_PATTERN.matcher(newBombedCharSequence(text, range));
while (true) {
checkCancelled();
ProgressManager.checkCanceled();
List<TextRange> toCheck;
TextRange wRange;