IndirectModelComponentCreator.registerResourceLoader(resourceLoader, "Am2900Loader");
IndirectModelComponentCreator.loadStandardComponentIDs(Am2900Loader.class.getResourceAsStream("standardComponentIDMapping.json"));
MachineLoader.setup();
-// System.out.println("SETUP DONE"); // TODO: Debug
}
}
ClassLoaderBasedResourceLoader resourceLoader = ClassLoaderBasedResourceLoader.create(MachineLoader.class.getClassLoader());
IndirectModelComponentCreator.registerResourceLoader(resourceLoader, "MachineLoader");
IndirectModelComponentCreator.loadStandardComponentIDs(MachineLoader.class.getResourceAsStream("standardComponentIDMapping.json"));
-// System.out.println("SETUP DONE"); // TODO: Debug
}
}
package net.mograsim.machine;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
{
installedMachines.clear();
IExtensionRegistry registry = Platform.getExtensionRegistry();
- System.out.println(Arrays.toString(registry.getExtensionPoints("net.mograsim.machine")));
IConfigurationElement[] config = registry.getConfigurationElementsFor(MACHINE_EXT_ID);
try
{
for (IConfigurationElement e : config)
{
- System.out.println(e.getNamespaceIdentifier());
- System.out.println(Arrays.toString(e.getAttributeNames()));
final Object o = e.createExecutableExtension("class");
final String id = e.getAttribute("unique_id");
if (o instanceof MachineDefinition)
{
- System.out.println("Found " + id);
MachineDefinition md = (MachineDefinition) o;
if (Objects.equals(id, md.getId()))
installedMachines.put(id, md);
}
catch (CoreException ex)
{
- System.out.println(ex.getMessage());
+ System.err.println("An error occurred reloading the machines:");
+ ex.printStackTrace();
}
notifyListeners();
}
package net.mograsim.plugin.nature;
-import static net.mograsim.plugin.nature.MachineContextStatus.*;
+import static net.mograsim.plugin.nature.MachineContextStatus.ACTIVE;
+import static net.mograsim.plugin.nature.MachineContextStatus.ACTIVE_CHANGED;
+import static net.mograsim.plugin.nature.MachineContextStatus.BROKEN;
+import static net.mograsim.plugin.nature.MachineContextStatus.CLOSED;
+import static net.mograsim.plugin.nature.MachineContextStatus.DEAD;
+import static net.mograsim.plugin.nature.MachineContextStatus.INTACT;
+import static net.mograsim.plugin.nature.MachineContextStatus.READY;
+import static net.mograsim.plugin.nature.MachineContextStatus.UNKOWN;
import java.io.IOException;
import java.util.HashSet;
if (status == ACTIVE)
return true;
machineDefinition.ifPresent(md -> setActiveMachine(md.createNew()));
- if (activeMachine.isPresent())
- System.out.format("Created new machine %s for project %s%n", activeMachine.get().getDefinition().getId(), owner.getName());
updateStatus();
return isActive();
}
if (oldStatus == newStatus)
return;
status = newStatus;
- System.out.format("Project %s context status: %s -> %s%n", owner.getName(), oldStatus, newStatus);
doPostStatusChangedAction();
notifyMachineContextStatusListeners(oldStatus);
}
{
if ((status == DEAD || status == CLOSED) && activeMachine.isPresent())
{
- System.out.format("Removed machine %s for project %s%n", activeMachine.get().getDefinition().getId(), owner.getName());
activeMachine = Optional.empty();
notifyActiveMachineListeners();
}
private static void resourceChanged(IResourceChangeEvent event)
{
-// System.out.println(((ResourceChangeEvent) event).toDebugString());
// We try to do as many cheap tests first as possible, because this listener is not limited to plain project actions.
if (event.getResource() == null)
return;