Adds a selected resource to the current workspace.
()
| 289 | * Adds a selected resource to the current workspace. |
| 290 | */ |
| 291 | private void addLibrary() { |
| 292 | final Workspace workspace = controller.getWorkspace(); |
| 293 | |
| 294 | if (workspace == null) |
| 295 | return; |
| 296 | |
| 297 | fcLoadApp.setInitialDirectory(config().getRecentLoadDir()); |
| 298 | List<File> files = fcLoadApp.showOpenMultipleDialog(null); |
| 299 | |
| 300 | if (files != null) { |
| 301 | |
| 302 | for (File file : files) { |
| 303 | try { |
| 304 | JavaResource resource = FileSystemResource.of(file.toPath()); |
| 305 | |
| 306 | workspace.getLibraries().add(resource); |
| 307 | controller.windows().getMainWindow().getNavigator().refresh(); |
| 308 | } catch(Exception ex) { |
| 309 | error(ex, "Failed to add library: {}", file.getName()); |
| 310 | ExceptionAlert.show(ex, "Failed to add library: " + file.getName()); |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Save the current application to a file. |
nothing calls this directly
no test coverage detected