+ /**
+ * Tries to activate the associated machine. This will not succeed if the project is not {@link MachineContextStatus#READY}. If the
+ * status is {@link MachineContextStatus#ACTIVE}, this method has no effect.
+ *
+ * @return true if the activation was successful
+ */
+ @Deprecated(forRemoval = true)
+ public final boolean activateMachine()
+ {
+ if (status == ACTIVE)
+ return true;
+ machineDefinition.ifPresent(md -> setActiveMachine(md.createNew()));
+ updateStatus();
+ return isActive();
+ }
+
+ /**
+ * This changes the internal status to a newly evaluated one and calls the {@link MachineContextStatusListener}s if this caused the
+ * status to change.
+ *
+ * @see #reevaluateStatus()
+ * @see #getStatus()
+ */
+ public final void updateStatus()
+ {
+ MachineContextStatus newStatus = reevaluateStatus();
+ forceUpdateStatus(newStatus);
+ }
+
+ final void forceUpdateStatus(MachineContextStatus newStatus)
+ {
+ MachineContextStatus oldStatus = status;
+ if (oldStatus == newStatus)
+ return;
+ status = newStatus;
+ doPostStatusChangedAction();
+ notifyMachineContextStatusListeners(oldStatus);
+ }
+
+ /**
+ * This method reevaluates the status <b>but does not change/update it</b>.<br>
+ * To update the status of the {@link MachineContext}, use {@link #updateStatus()}.
+ *
+ * @return the raw status of the project at the time of the call.
+ */
+ @SuppressWarnings("removal")
+ public final MachineContextStatus reevaluateStatus()
+ {
+ if (!owner.exists())
+ return DEAD;
+ if (!owner.isOpen())
+ return CLOSED;
+ if (hasInvaildMograsimProject())
+ return BROKEN;
+ if (machineDefinition.isEmpty())
+ return INTACT;
+ if (activeMachine.isEmpty())
+ return READY;
+ if (!activeMachine.get().getDefinition().getId().equals(machineDefinition.get().getId()))
+ return ACTIVE_CHANGED;
+ return ACTIVE;
+ }
+
+ @Deprecated(forRemoval = true)
+ private void doPostStatusChangedAction()