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

Method exportMap

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

Export the current Workspace#getAggregatedMappings() aggregated mappings to the given format. @param impl Mapping implementation to use.

(MappingImpl impl)

Source from the content-addressed store, hash-verified

344 * Mapping implementation to use.
345 */
346 private void exportMap(MappingImpl impl) {
347 if (controller.getWorkspace() == null) {
348 return;
349 }
350
351 fcSaveMap.setInitialDirectory(config().getRecentSaveMapDir());
352 File file = fcSaveMap.showSaveDialog(null);
353 if (file != null) {
354 // TODO: Make the Mappings classes do this conversion for their respective format
355 String fullMapping = controller.getWorkspace().getAggregatedMappings().entrySet().stream()
356 .map(e -> e.getKey() + " " + e.getValue())
357 .collect(Collectors.joining("\n"));
358 try {
359 FileUtils.write(file, fullMapping, UTF_8);
360 config().recentSaveMap = file.getAbsolutePath();
361 } catch(IOException ex) {
362 error(ex, "Failed to save simple mapping to file: {}", file.getName());
363 ExceptionAlert.show(ex, "Failed to save simple mapping to file: " + file.getName());
364 }
365
366 }
367 }
368
369 /**
370 * Load a file and apply mappings of the given type.

Callers 1

populateMappingMenusMethod · 0.95

Calls 11

configMethod · 0.95
showMethod · 0.95
getRecentSaveMapDirMethod · 0.80
entrySetMethod · 0.80
getAggregatedMappingsMethod · 0.80
getKeyMethod · 0.80
getNameMethod · 0.65
getWorkspaceMethod · 0.45
mapMethod · 0.45
getValueMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected