From: Christian Femers Date: Mon, 23 Sep 2019 14:53:05 +0000 (+0200) Subject: Create a new machine when a MachineContext is used and has a definition. X-Git-Url: https://mograsim.net/gitweb/?p=Mograsim.git;a=commitdiff_plain;h=f4c2b2357f708fce0b1a15d7d9de32fbf509e0eb Create a new machine when a MachineContext is used and has a definition. This might be refined in future to a somewhat more lazy creation, but for now it fixes the bug that a machine context has no machine at the start, and it is not clear, when else it should be created. --- diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/MachineContext.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/MachineContext.java index b1708482..c65a95e1 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/MachineContext.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/MachineContext.java @@ -112,6 +112,7 @@ public class MachineContext final void updateDefinition() { machineDefinition = machineId.map(MachineRegistry::getMachine); + machineDefinition.ifPresent(md -> setActiveMachine(md.createNew())); } private void preferenceListener(PropertyChangeEvent changeEvent)