use of com.teamdev.jxbrowser.browser.UnsupportedRenderingModeException in project flutter-intellij by flutter.
the class JxBrowserManager method loadClasses.
private void loadClasses(@NotNull String[] fileNames) {
final List<Path> paths = new ArrayList<>();
final ClassLoader current = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
for (String fileName : fileNames) {
assert fileName != null;
paths.add(Paths.get(getFilePath(fileName)));
}
// noinspection ConstantConditions
fileUtils.loadPaths(this.getClass().getClassLoader(), paths);
} catch (Exception ex) {
LOG.info("Failed to load JxBrowser file", ex);
setStatusFailed(new InstallationFailedReason(FailureType.CLASS_LOAD_FAILED));
return;
}
LOG.info("Loaded JxBrowser files successfully: " + paths);
try {
final Class<?> clazz = Class.forName("com.teamdev.jxbrowser.browser.UnsupportedRenderingModeException");
final Constructor<?> constructor = clazz.getConstructor(RenderingMode.class);
constructor.newInstance(RenderingMode.HARDWARE_ACCELERATED);
// noinspection ThrowableNotThrown
final UnsupportedRenderingModeException test = new UnsupportedRenderingModeException(RenderingMode.HARDWARE_ACCELERATED);
} catch (NoClassDefFoundError | ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
LOG.info("Failed to find JxBrowser class: ", e);
setStatusFailed(new InstallationFailedReason(FailureType.CLASS_NOT_FOUND));
return;
}
} finally {
Thread.currentThread().setContextClassLoader(current);
}
analytics.sendEvent(ANALYTICS_CATEGORY, "installed");
status.set(JxBrowserStatus.INSTALLED);
installation.complete(JxBrowserStatus.INSTALLED);
}
Aggregations