mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
added a stacktrace line to the warning
This commit is contained in:
+11
-1
@@ -38,6 +38,8 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class AbstractProgressIndicatorBase extends UserDataHolderBase implements ProgressIndicatorStacked {
|
||||
@@ -181,7 +183,15 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements
|
||||
@Override
|
||||
public void setFraction(final double fraction) {
|
||||
if (isIndeterminate()) {
|
||||
LOG.warn("This progress indicator is indeterminate, this may lead to visual inconsistency. Please call setIndeterminate(false) before you start progress.");
|
||||
StackTraceElement[] trace = new Throwable().getStackTrace();
|
||||
Optional<StackTraceElement> first =
|
||||
Arrays.stream(trace).filter(element -> !element.getClassName().startsWith("com.intellij.openapi.progress.util")).findFirst();
|
||||
String message = "This progress indicator is indeterminate, this may lead to visual inconsistency. " +
|
||||
"Please call setIndeterminate(false) before you start progress.";
|
||||
if (first.isPresent()) {
|
||||
message += "\n" + first.get();
|
||||
}
|
||||
LOG.warn(message);
|
||||
setIndeterminate(false);
|
||||
}
|
||||
myFraction = fraction;
|
||||
|
||||
Reference in New Issue
Block a user