mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use long for delay intervals
This commit is contained in:
@@ -32,17 +32,17 @@ public class DiffTaskQueue {
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
public void executeAndTryWait(@NotNull final Function<ProgressIndicator, Runnable> backgroundTask,
|
||||
@Nullable final Runnable onSlowAction,
|
||||
final int waitMillis) {
|
||||
public void executeAndTryWait(@NotNull Function<ProgressIndicator, Runnable> backgroundTask,
|
||||
@Nullable Runnable onSlowAction,
|
||||
long waitMillis) {
|
||||
executeAndTryWait(backgroundTask, onSlowAction, waitMillis, false);
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
public void executeAndTryWait(@NotNull final Function<ProgressIndicator, Runnable> backgroundTask,
|
||||
@Nullable final Runnable onSlowAction,
|
||||
final int waitMillis,
|
||||
final boolean forceEDT) {
|
||||
public void executeAndTryWait(@NotNull Function<ProgressIndicator, Runnable> backgroundTask,
|
||||
@Nullable Runnable onSlowAction,
|
||||
long waitMillis,
|
||||
boolean forceEDT) {
|
||||
abort();
|
||||
myProgressIndicator = BackgroundTaskUtil.executeAndTryWait(backgroundTask, onSlowAction, waitMillis, forceEDT);
|
||||
}
|
||||
|
||||
+6
-6
@@ -66,7 +66,7 @@ public class BackgroundTaskUtil {
|
||||
@CalledInAwt
|
||||
public static ProgressIndicator executeAndTryWait(@NotNull Function<ProgressIndicator, /*@NotNull*/ Runnable> backgroundTask,
|
||||
@Nullable Runnable onSlowAction,
|
||||
int waitMillis) {
|
||||
long waitMillis) {
|
||||
return executeAndTryWait(backgroundTask, onSlowAction, waitMillis, false);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BackgroundTaskUtil {
|
||||
@CalledInAwt
|
||||
public static ProgressIndicator executeAndTryWait(@NotNull Function<ProgressIndicator, /*@NotNull*/ Runnable> backgroundTask,
|
||||
@Nullable Runnable onSlowAction,
|
||||
int waitMillis,
|
||||
long waitMillis,
|
||||
boolean forceEDT) {
|
||||
ModalityState modality = ModalityState.current();
|
||||
|
||||
@@ -131,7 +131,7 @@ public class BackgroundTaskUtil {
|
||||
@Nullable
|
||||
@CalledInAwt
|
||||
public static <T> T tryComputeFast(@NotNull Function<ProgressIndicator, T> backgroundTask,
|
||||
int waitMillis) {
|
||||
long waitMillis) {
|
||||
Pair<T, ProgressIndicator> pair = computeInBackgroundAndTryWait(
|
||||
backgroundTask,
|
||||
(result, indicator) -> {
|
||||
@@ -150,7 +150,7 @@ public class BackgroundTaskUtil {
|
||||
@CalledInAny
|
||||
public static <T> T computeInBackgroundAndTryWait(@NotNull Computable<T> computable,
|
||||
@NotNull Consumer<T> asyncCallback,
|
||||
int waitMillis) {
|
||||
long waitMillis) {
|
||||
Pair<T, ProgressIndicator> pair = computeInBackgroundAndTryWait(
|
||||
indicator -> computable.compute(),
|
||||
(result, indicator) -> asyncCallback.consume(result),
|
||||
@@ -173,7 +173,7 @@ public class BackgroundTaskUtil {
|
||||
public static <T> Pair<T, ProgressIndicator> computeInBackgroundAndTryWait(@NotNull Function<ProgressIndicator, T> task,
|
||||
@NotNull PairConsumer<T, ProgressIndicator> asyncCallback,
|
||||
@NotNull ModalityState modality,
|
||||
int waitMillis) {
|
||||
long waitMillis) {
|
||||
ProgressIndicator indicator = new EmptyProgressIndicator(modality);
|
||||
|
||||
Helper<T> helper = new Helper<>();
|
||||
@@ -266,7 +266,7 @@ public class BackgroundTaskUtil {
|
||||
/**
|
||||
* @return true if computation was fast, and callback should be handled by current thread
|
||||
*/
|
||||
public boolean await(int waitMillis) {
|
||||
public boolean await(long waitMillis) {
|
||||
try {
|
||||
mySemaphore.tryAcquire(waitMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user