|
20 | 20 | import com.intellij.util.download.DownloadableFileService; |
21 | 21 | import com.intellij.util.download.FileDownloader; |
22 | 22 | import com.teamdev.jxbrowser.browser.UnsupportedRenderingModeException; |
23 | | -import com.teamdev.jxbrowser.callback.Callback; |
24 | 23 | import com.teamdev.jxbrowser.engine.RenderingMode; |
25 | 24 | import io.flutter.FlutterInitializer; |
26 | 25 | import io.flutter.settings.FlutterSettings; |
|
31 | 30 | import java.io.File; |
32 | 31 | import java.io.FileNotFoundException; |
33 | 32 | import java.io.IOException; |
| 33 | +import java.nio.file.Path; |
| 34 | +import java.nio.file.Paths; |
34 | 35 | import java.util.ArrayList; |
35 | 36 | import java.util.Collections; |
36 | 37 | import java.util.List; |
@@ -280,6 +281,32 @@ private void loadClasses(String[] fileNames) { |
280 | 281 | installation.complete(JxBrowserStatus.INSTALLED); |
281 | 282 | } |
282 | 283 |
|
| 284 | + private void loadClasses2021(String[] fileNames) { |
| 285 | + List<Path> paths = new ArrayList<>(); |
| 286 | + |
| 287 | + try { |
| 288 | + for (String fileName: fileNames) { |
| 289 | + paths.add(Paths.get(getFilePath(fileName))); |
| 290 | + } |
| 291 | + FileUtils.getInstance().loadPaths(this.getClass().getClassLoader(), paths); |
| 292 | + } catch (Exception ex) { |
| 293 | + LOG.info("Failed to load JxBrowser file", ex); |
| 294 | + setStatusFailed("classLoadFailed"); |
| 295 | + return; |
| 296 | + } |
| 297 | + |
| 298 | + try { |
| 299 | + final UnsupportedRenderingModeException test = new UnsupportedRenderingModeException(RenderingMode.HARDWARE_ACCELERATED); |
| 300 | + } catch (NoClassDefFoundError e) { |
| 301 | + LOG.info("Failed to find JxBrowser class"); |
| 302 | + setStatusFailed("NoClassDefFoundError"); |
| 303 | + return; |
| 304 | + } |
| 305 | + FlutterInitializer.getAnalytics().sendEvent(ANALYTICS_CATEGORY, "installed"); |
| 306 | + status.set(JxBrowserStatus.INSTALLED); |
| 307 | + installation.complete(JxBrowserStatus.INSTALLED); |
| 308 | + } |
| 309 | + |
283 | 310 | private String getFilePath(String fileName) { |
284 | 311 | return DOWNLOAD_PATH + File.separatorChar + fileName; |
285 | 312 | } |
|
0 commit comments