1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-12-22 07:20:09 -08:00

Load definitions after Abacus finishes loading.

This commit is contained in:
Danila Fedorin 2017-11-23 23:00:33 -08:00
parent 4188c83a66
commit 0b6798e28d

View File

@ -329,9 +329,11 @@ public class AbacusController implements PluginListener {
abacus.applyToContext(result.getResultingContext()); abacus.applyToContext(result.getResultingContext());
} }
} catch (AbacusException abacusError) { } catch (AbacusException abacusError) {
outputText.setText(ERR_DEFINITION + "(" + abacusError.getMessage() + ")"); outputText.setText(ERR_DEFINITION + " (" + abacusError.getMessage() + ")");
abacusError.printStackTrace();
} catch (RuntimeException runtime) { } catch (RuntimeException runtime) {
outputText.setText(ERR_DEFINITION + "(" + ERR_EXCEPTION + ")"); outputText.setText(ERR_DEFINITION + " (" + ERR_EXCEPTION + ")");
runtime.printStackTrace();
} catch (FileNotFoundException ignored) {} } catch (FileNotFoundException ignored) {}
} }
@ -345,13 +347,13 @@ public class AbacusController implements PluginListener {
} catch (IOException | ClassNotFoundException e) { } catch (IOException | ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
abacus.reload(); reloadAbacus();
} }
@FXML @FXML
public void performReload() { public void performReload() {
alertIfApplyNeeded(true); alertIfApplyNeeded(true);
abacus.reload(); reloadAbacus();
} }
@FXML @FXML
@ -391,6 +393,13 @@ public class AbacusController implements PluginListener {
changesMade = true; changesMade = true;
} }
private void reloadAbacus(){
abacus.reload();
for(String file : definitionFiles){
loadDefinitionFile(file);
}
}
@Override @Override
public void onLoad(PluginManager manager) { public void onLoad(PluginManager manager) {
ExtendedConfiguration configuration = (ExtendedConfiguration) abacus.getConfiguration(); ExtendedConfiguration configuration = (ExtendedConfiguration) abacus.getConfiguration();
@ -420,9 +429,6 @@ public class AbacusController implements PluginListener {
}).collect(Collectors.toCollection(ArrayList::new))); }).collect(Collectors.toCollection(ArrayList::new)));
functionList.sort(Comparator.comparing(Documentation::getCodeName)); functionList.sort(Comparator.comparing(Documentation::getCodeName));
definitionFiles.addAll(configuration.getDefinitionFiles()); definitionFiles.addAll(configuration.getDefinitionFiles());
for(String file : definitionFiles){
loadDefinitionFile(file);
}
} }
@Override @Override