From 8f8ecb19d7823bb2bdbb17acd1651bb60fe89cad Mon Sep 17 00:00:00 2001 From: Roland Kluge Date: Thu, 15 Mar 2018 15:49:18 +0100 Subject: [PATCH] More robust error reporting if file is missing --- .../core/ui/errorhandling/MultiStatusAwareErrorReporter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.moflon.core.ui/src/org/moflon/core/ui/errorhandling/MultiStatusAwareErrorReporter.java b/org.moflon.core.ui/src/org/moflon/core/ui/errorhandling/MultiStatusAwareErrorReporter.java index 9382f16a..2bfd34e4 100644 --- a/org.moflon.core.ui/src/org/moflon/core/ui/errorhandling/MultiStatusAwareErrorReporter.java +++ b/org.moflon.core.ui/src/org/moflon/core/ui/errorhandling/MultiStatusAwareErrorReporter.java @@ -3,6 +3,7 @@ import org.apache.log4j.Logger; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; @@ -57,7 +58,8 @@ public final void report(final IStatus status) { } protected void reportLeafStatus(final IStatus status) throws CoreException { - final IMarker validationMarker = file.createMarker(WorkspaceHelper.MOFLON_PROBLEM_MARKER_ID); + final IResource markedResource = file.exists() ? file : file.getProject(); + final IMarker validationMarker = markedResource.createMarker(WorkspaceHelper.MOFLON_PROBLEM_MARKER_ID); validationMarker.setAttribute(IMarker.MESSAGE, status.getMessage()); validationMarker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); validationMarker.setAttribute(IMarker.SEVERITY,