diff --git a/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/marker/MarkerFactory.java b/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/marker/MarkerFactory.java index 8931862a..fea75458 100644 --- a/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/marker/MarkerFactory.java +++ b/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/marker/MarkerFactory.java @@ -68,16 +68,23 @@ private MarkerFactory() { public static void validationErrorOnStepDefinition(final IResource resource, Map errors, boolean persistent) { if (errors == null || errors.isEmpty()) { + mark(resource, new IMarkerBuilder() { + + @Override + public void build() throws CoreException { + deleteStepValidationErrors(resource); + } + + + + }); return; } mark(resource, new IMarkerBuilder() { @Override public void build() throws CoreException { - IMarker[] markers = resource.findMarkers(STEPDEF_VALIDATION_ERROR, true, IResource.DEPTH_INFINITE); - for (IMarker marker : markers) { - marker.delete(); - } + deleteStepValidationErrors(resource); for (Entry entry : errors.entrySet()) { IMarker marker = resource.createMarker(STEPDEF_VALIDATION_ERROR); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); @@ -94,6 +101,13 @@ public void syntaxErrorOnStepDefinition(IResource stepDefinitionResource, Except syntaxErrorOnStepDefinition(stepDefinitionResource, e, 0); } + private static void deleteStepValidationErrors(final IResource resource) throws CoreException { + IMarker[] markers = resource.findMarkers(STEPDEF_VALIDATION_ERROR, true, IResource.DEPTH_INFINITE); + for (IMarker marker : markers) { + marker.delete(); + } + } + // public void unmatchedStep(final IDocument gherkinDocument, final GherkinStepWrapper gherkinStepWrapper) { // // final IResource gherkinFile = gherkinStepWrapper.getSource();