Пример #1
0
 static {
   Class<?> aClass = null;
   Set<String> files = null;
   try {
     aClass = Class.forName("java.io.DeleteOnExitHook");
     files = ReflectionUtil.getField(aClass, null, Set.class, "files");
   } catch (Exception ignored) {
   }
   DELETE_ON_EXIT_HOOK_CLASS = aClass;
   DELETE_ON_EXIT_HOOK_DOT_FILES = files;
 }
 @NotNull
 private static ConfigImportSettings getConfigImportSettings() {
   try {
     @SuppressWarnings("unchecked")
     Class<ConfigImportSettings> customProviderClass =
         (Class<ConfigImportSettings>)
             Class.forName(
                 "com.intellij.openapi.application."
                     + PlatformUtils.getPlatformPrefix()
                     + "ConfigImportSettings");
     if (ConfigImportSettings.class.isAssignableFrom(customProviderClass)) {
       return ReflectionUtil.newInstance(customProviderClass);
     }
   } catch (ClassNotFoundException ignored) {
   } catch (RuntimeException ignored) {
   }
   return new ConfigImportSettings();
 }
Пример #3
0
 @Nullable
 public static Image loadFromResource(@NonNls @NotNull String s) {
   Class callerClass = ReflectionUtil.getGrandCallerClass();
   if (callerClass == null) return null;
   return loadFromResource(s, callerClass);
 }