mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 15:30:09 -08:00
Make reloads go through the Abacus core.
This commit is contained in:
parent
91986112a1
commit
924849bd8b
|
@ -220,12 +220,4 @@ public abstract class Plugin {
|
||||||
*/
|
*/
|
||||||
public abstract void onDisable();
|
public abstract void onDisable();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the variable database.
|
|
||||||
* @return the variable database.
|
|
||||||
*/
|
|
||||||
public final VariableDatabase getVariableDatabase(){
|
|
||||||
return manager.getVariableDatabase();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,11 +423,4 @@ public class PluginManager {
|
||||||
return loadedPluginClasses;
|
return loadedPluginClasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the variable database.
|
|
||||||
* @return the database.
|
|
||||||
*/
|
|
||||||
public VariableDatabase getVariableDatabase(){
|
|
||||||
return abacus.getVariableDatabase();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,6 @@ class Abacus(val configuration: Configuration) {
|
||||||
* The promotion manager used to convert between number implementations.
|
* The promotion manager used to convert between number implementations.
|
||||||
*/
|
*/
|
||||||
val promotionManager = PromotionManager(this)
|
val promotionManager = PromotionManager(this)
|
||||||
/**
|
|
||||||
* The database of variable definitions.
|
|
||||||
*/
|
|
||||||
val variableDatabase = VariableDatabase(this)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hidden, mutable implementation of the context.
|
* The hidden, mutable implementation of the context.
|
||||||
|
@ -65,9 +61,16 @@ class Abacus(val configuration: Configuration) {
|
||||||
pluginManager.addListener(tokenizer)
|
pluginManager.addListener(tokenizer)
|
||||||
pluginManager.addListener(parser)
|
pluginManager.addListener(parser)
|
||||||
pluginManager.addListener(promotionManager)
|
pluginManager.addListener(promotionManager)
|
||||||
pluginManager.addListener(variableDatabase)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun reload(){
|
||||||
|
pluginManager.reload()
|
||||||
|
with(mutableContext) {
|
||||||
|
numberImplementation = pluginManager.numberImplementationFor(configuration.numberImplementation)
|
||||||
|
clearVariables()
|
||||||
|
clearDefinitions()
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Parses a string into a tree structure using the main
|
* Parses a string into a tree structure using the main
|
||||||
* tree builder.
|
* tree builder.
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class CalculationTests {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void prepareTests() {
|
public static void prepareTests() {
|
||||||
abacus.getPluginManager().addInstantiated(new StandardPlugin(abacus.getPluginManager()));
|
abacus.getPluginManager().addInstantiated(new StandardPlugin(abacus.getPluginManager()));
|
||||||
abacus.getPluginManager().load();
|
abacus.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testOutput(String input, String parseOutput, String output) {
|
private void testOutput(String input, String parseOutput, String output) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class TokenizerTests {
|
||||||
public static void prepareTests() {
|
public static void prepareTests() {
|
||||||
abacus.getPluginManager().addListener(lexerTokenizer);
|
abacus.getPluginManager().addListener(lexerTokenizer);
|
||||||
abacus.getPluginManager().addInstantiated(testPlugin);
|
abacus.getPluginManager().addInstantiated(testPlugin);
|
||||||
abacus.getPluginManager().load();
|
abacus.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -320,13 +320,13 @@ public class AbacusController implements PluginListener {
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
abacusPluginManager.reload();
|
abacus.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void performReload() {
|
public void performReload() {
|
||||||
alertIfApplyNeeded(true);
|
alertIfApplyNeeded(true);
|
||||||
abacus.getPluginManager().reload();
|
abacus.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
Loading…
Reference in New Issue
Block a user