From f4c2b2357f708fce0b1a15d7d9de32fbf509e0eb Mon Sep 17 00:00:00 2001 From: Christian Femers Date: Mon, 23 Sep 2019 16:53:05 +0200 Subject: [PATCH] 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. --- .../src/net/mograsim/plugin/nature/MachineContext.java | 1 + 1 file changed, 1 insertion(+) 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) -- 2.17.1