Search in sources :

Example 1 with ReflectionError

use of org.fest.reflect.exception.ReflectionError in project intellij-community by JetBrains.

the class IdeaDialogFixture method getDialogWrapperFrom.

@Nullable
protected static <T extends DialogWrapper> T getDialogWrapperFrom(@NotNull JDialog dialog, Class<T> dialogWrapperType) {
    try {
        WeakReference<DialogWrapper> dialogWrapperRef = field("myDialogWrapper").ofType(new TypeRef<WeakReference<DialogWrapper>>() {
        }).in(dialog).get();
        assertNotNull(dialogWrapperRef);
        DialogWrapper wrapper = dialogWrapperRef.get();
        if (dialogWrapperType.isInstance(wrapper)) {
            return dialogWrapperType.cast(wrapper);
        }
    } catch (ReflectionError ignored) {
    }
    return null;
}
Also used : ReflectionError(org.fest.reflect.exception.ReflectionError) WeakReference(java.lang.ref.WeakReference) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 WeakReference (java.lang.ref.WeakReference)1 ReflectionError (org.fest.reflect.exception.ReflectionError)1 Nullable (org.jetbrains.annotations.Nullable)1