MCPcopy Index your code
hub / github.com/OpenSourcePhysics/osp / loadIntoEditor

Method loadIntoEditor

src/test/LoaderTest.java:294–322  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

292 }
293
294 private boolean loadIntoEditor(String path) {
295 Map<String, ZipEntry> contents = ResourceLoader.getZipContents(path, true);
296 // extract the zip file contents
297 xmlFiles.clear();
298 otherFiles.clear();
299 for (String next : contents.keySet()) {
300 String s = ResourceLoader.getURIPath(path + "!/" + next);
301 if (next.endsWith(".trk")
302 || next.endsWith(".xml")
303 || next.endsWith(".ejss")) {
304 xmlFiles.add(s);
305 } else {
306 otherFiles.add(s);
307 }
308 }
309 contents = null;
310 if (xmlFiles.isEmpty()) {
311 String msg = XML.getName(path)+ " contains no editable xml files.";
312 JOptionPane.showMessageDialog(frame, msg, "No Editable Content", JOptionPane.WARNING_MESSAGE);
313 return false;
314 }
315 // remove file that will be edited so the original
316 // will not be included in the output zip
317 editedFilePath = xmlFiles.remove(0);
318 String text = ResourceLoader.getString(editedFilePath);
319 setEditorText(text);
320 libraryBrowser.setVisible(false);
321 return true;
322 }
323
324 private boolean isZip(String path) {
325 return path.toLowerCase().endsWith(".zip")

Callers 1

dropMethod · 0.95

Calls 11

getZipContentsMethod · 0.95
getURIPathMethod · 0.95
getNameMethod · 0.95
getStringMethod · 0.95
setEditorTextMethod · 0.95
showMessageDialogMethod · 0.80
clearMethod · 0.65
removeMethod · 0.65
setVisibleMethod · 0.65
addMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected