MCPcopy
hub / github.com/Col-E/Recaf / addLibrary

Method addLibrary

src/main/java/me/coley/recaf/ui/MainMenu.java:291–314  ·  view source on GitHub ↗

Adds a selected resource to the current workspace.

()

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 14

configMethod · 0.95
ofMethod · 0.95
getLibrariesMethod · 0.95
showMethod · 0.95
getRecentLoadDirMethod · 0.80
toPathMethod · 0.80
getNavigatorMethod · 0.80
getMainWindowMethod · 0.80
windowsMethod · 0.80
getNameMethod · 0.65
getWorkspaceMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected