MCPcopy Create free account
hub / github.com/PCGen/pcgen / loadSourcesThenCharacter

Method loadSourcesThenCharacter

code/src/java/pcgen/gui2/PCGenFrame.java:1153–1191  ·  view source on GitHub ↗

Asynchronously load the sources required for a character and then load the character. @param pcgFile The character to be loaded.

(final File pcgFile)

Source from the content-addressed store, hash-verified

1151 * @param pcgFile The character to be loaded.
1152 */
1153 private void loadSourcesThenCharacter(final File pcgFile)
1154 {
1155 new Thread(() -> {
1156 try
1157 {
1158 sourceLoader.join();
1159 SwingUtilities.invokeAndWait(() -> {
1160 final String msg =
1161 LanguageBundle.getFormattedString("in_loadPcLoadingFile", pcgFile.getName());
1162 statusBar.startShowingProgress(msg, false);
1163 statusBar.getProgressBar().getModel().setRangeProperties(0, 1, 0, 2, false);
1164 statusBar.getProgressBar().setString(LanguageBundle.getString("in_loadPcOpening"));
1165 });
1166 SwingUtilities.invokeLater(() -> {
1167 try
1168 {
1169 CharacterManager.openCharacter(pcgFile, PCGenFrame.this, currentDataSetRef.get());
1170 statusBar.getProgressBar().getModel().setRangeProperties(1, 1, 0, 2, false);
1171 }
1172 catch (Exception e)
1173 {
1174 Logging.errorPrint("Error loading character: " + pcgFile.getName(), e);
1175 }
1176 finally
1177 {
1178 statusBar.endShowingProgress();
1179 }
1180 });
1181 }
1182 catch (InterruptedException ex)
1183 {
1184 //Do nothing
1185 }
1186 catch (InvocationTargetException e1)
1187 {
1188 Logging.errorPrint("Error showing progress bar.", e1);
1189 }
1190 }).start();
1191 }
1192
1193 public void loadPartyFromFile(final File pcpFile)
1194 {

Callers 1

loadCharacterFromFileMethod · 0.95

Calls 13

getFormattedStringMethod · 0.95
getStringMethod · 0.95
openCharacterMethod · 0.95
errorPrintMethod · 0.95
joinMethod · 0.80
startShowingProgressMethod · 0.80
endShowingProgressMethod · 0.80
startMethod · 0.65
getNameMethod · 0.65
getMethod · 0.65
getModelMethod · 0.45
getProgressBarMethod · 0.45

Tested by

no test coverage detected