MCPcopy Create free account
hub / github.com/boazy/TWEditorEnhanced / loadSave

Method loadSave

src/main/java/MainWindow.java:239–277  ·  view source on GitHub ↗
(File file)

Source from the content-addressed store, hash-verified

237 }
238
239 private void loadSave(File file)
240 {
241 String saveName = file.getName();
242 int sep = saveName.lastIndexOf('.');
243 if (sep > 0) {
244 saveName = saveName.substring(0, sep);
245 }
246
247 ProgressDialog dialog = new ProgressDialog(this, "Loading " + saveName);
248 LoadFile task = new LoadFile(dialog, file);
249 task.start();
250 boolean success = dialog.showDialog();
251
252 if (success)
253 try {
254 Main.dataChanging = true;
255
256 DBList list = (DBList)Main.database.getTopLevelStruct().getValue();
257 list = (DBList)list.getElement("Mod_PlayerList").getValue();
258 list = (DBList)list.getElement(0).getValue();
259 this.statsPanel.setFields(list);
260 this.attributesPanel.setFields(list);
261 this.signsPanel.setFields(list);
262 this.stylesPanel.setFields(list);
263 this.equipPanel.setFields(list);
264 this.inventoryPanel.setFields(list);
265 this.questsPanel.setFields(list);
266
267 this.tabbedPane.setSelectedIndex(0);
268 this.tabbedPane.setVisible(true);
269
270 Main.dataChanging = false;
271 Main.dataModified = false;
272 } catch (DBException exc) {
273 Main.logException("Database format is not valid", exc);
274 } catch (IOException exc) {
275 Main.logException("I/O error while building tabbed panes", exc);
276 }
277 }
278
279 private boolean saveFile()
280 {

Callers 2

openFileMethod · 0.95
packSaveMethod · 0.95

Calls 7

showDialogMethod · 0.95
getElementMethod · 0.95
logExceptionMethod · 0.95
getTopLevelStructMethod · 0.80
getNameMethod · 0.45
getValueMethod · 0.45
setFieldsMethod · 0.45

Tested by

no test coverage detected