mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-171936 IllegalStateException occurs and Settings doesn't open on selecting 'Configure Gutter Icons' options in Remote Development mode
GitOrigin-RevId: fea22ff451fc5cad10a4d5c2668478852dfdca36
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a4d95522a2
commit
e89ffc1cc2
@@ -256,6 +256,11 @@ public interface Configurable extends UnnamedConfigurable {
|
||||
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
interface ClassCastChecker {
|
||||
<T> boolean tryToCast(@NotNull Class<T> type);
|
||||
}
|
||||
|
||||
interface TopComponentController {
|
||||
TopComponentController EMPTY = new TopComponentController() {
|
||||
@Override
|
||||
|
||||
@@ -145,9 +145,10 @@ open class ShowSettingsUtilImpl : ShowSettingsUtil() {
|
||||
additionalConfiguration: Consumer<in T>?,
|
||||
) {
|
||||
assert(Configurable::class.java.isAssignableFrom(configurableClass)) { "Not a configurable: " + configurableClass.name }
|
||||
showSettingsDialog(project, { it: Configurable? -> ConfigurableWrapper.cast(configurableClass, it) != null }) { it: Configurable ->
|
||||
showSettingsDialog(project, { it: Configurable? -> ConfigurableWrapper.tryToCast(configurableClass, it) }) { it: Configurable ->
|
||||
if (additionalConfiguration != null) {
|
||||
val toConfigure = ConfigurableWrapper.cast(configurableClass, it) ?: error("Wrong configurable found: " + it.javaClass)
|
||||
val toConfigure = ConfigurableWrapper.cast(configurableClass, it)
|
||||
?: error("Wrong configurable found: " + it.javaClass + " but expected: " + configurableClass)
|
||||
additionalConfiguration.accept(toConfigure)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,17 @@ public class ConfigurableWrapper implements SearchableConfigurable, Weighted, Hi
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static <T> boolean tryToCast(@NotNull Class<T> type, @Nullable UnnamedConfigurable configurable) {
|
||||
if (cast(type, configurable) != null) {
|
||||
return true;
|
||||
}
|
||||
if (configurable instanceof ClassCastChecker checker) {
|
||||
return checker.tryToCast(type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static @Nullable <T> T cast(@NotNull Class<T> type, @Nullable UnnamedConfigurable configurable) {
|
||||
if (configurable instanceof ConfigurableWrapper wrapper) {
|
||||
if (wrapper.myConfigurable == null) {
|
||||
|
||||
Reference in New Issue
Block a user