From: Christian Femers Date: Tue, 24 Sep 2019 04:24:18 +0000 (+0200) Subject: Fixed detection problems with ProjectMachineContext X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=f6de59ab09a6d119603268152dd154d077bc4917;p=Mograsim.git Fixed detection problems with ProjectMachineContext Other problems still remain; e.g. PRE-CLOSE et al. makes the listeners unable to detect a closed project, because it was not yet marked as such. There should also be a register of open, but currently unused projects. --- diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/ProjectMachineContext.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/ProjectMachineContext.java index cf727af2..86b9df6f 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/ProjectMachineContext.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/ProjectMachineContext.java @@ -124,15 +124,16 @@ public class ProjectMachineContext private static void resourceChanged(IResourceChangeEvent event) { +// System.out.println(((ResourceChangeEvent) event).toDebugString()); ProjectContextEventType eventType = ProjectContextEventType.ofResourceChangeEvent(event.getType()); if (eventType == null) return; - IProject p = event.getResource().getProject(); - if (p == null) + if (event.getResource() == null || event.getResource().getProject() == null) return; - MachineContext mc = projectMachineContexts.get(p); + MachineContext mc = projectMachineContexts.get(event.getResource().getProject()); if (mc == null) return; +// System.out.println(" " + eventType + " - " + mc.getProject()); notifyListeners(new ProjectContextEvent(mc, eventType)); } }