Merge remote-tracking branch 'origin/R4_7_maintenance' into BETA_JUNIT5
diff --git a/org.eclipse.jdt.ui/plugin.properties b/org.eclipse.jdt.ui/plugin.properties
index 964ecb7..04ca256 100644
--- a/org.eclipse.jdt.ui/plugin.properties
+++ b/org.eclipse.jdt.ui/plugin.properties
@@ -91,7 +91,7 @@
 javadocLocationPageName=Javadoc Location
 javaCompilerPageName=Java Compiler
 
-preferenceKeywords.general=Java package explorer call type hierarchy refactoring rename editor search
+preferenceKeywords.general=Java package explorer call type hierarchy refactoring rename editor search index
 preferenceKeywords.appearance=Java appearance package explorer browsing compress show method return types categories members
 preferenceKeywords.sortorder=Java member sort order appearance
 preferenceKeywords.typefilter=Java type filter ignore package appearance content assist
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/CorrectionMarkerResolutionGenerator.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/CorrectionMarkerResolutionGenerator.java
index c3a749b..d0af6f4 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/CorrectionMarkerResolutionGenerator.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/CorrectionMarkerResolutionGenerator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -37,6 +37,7 @@
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IMarkerResolution;
 import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.eclipse.ui.IMarkerResolutionRelevance;
 import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
 
 import org.eclipse.ui.texteditor.ITextEditor;
@@ -67,7 +68,7 @@
 
 public class CorrectionMarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
 
-	public static class CorrectionMarkerResolution extends WorkbenchMarkerResolution {
+	public static class CorrectionMarkerResolution extends WorkbenchMarkerResolution implements IMarkerResolutionRelevance {
 
 		private static final IMarker[] NO_MARKERS= new IMarker[0];
 
@@ -193,6 +194,13 @@
 		}
 
 		@Override
+		public int getRelevanceForResolution() {
+			if (fProposal != null)
+				return fProposal.getRelevance();
+			return 0;
+		}
+
+		@Override
 		public IMarker[] findOtherMarkers(IMarker[] markers) {
 			if (!(fProposal instanceof FixCorrectionProposal))
 				return NO_MARKERS;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/ProblemsLabelDecorator.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/ProblemsLabelDecorator.java
index 67691aa..788303b 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/ProblemsLabelDecorator.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/ProblemsLabelDecorator.java
@@ -327,13 +327,13 @@
 		}
 		
 		// markers on package itself (e.g. missing @NonNullByDefault)
-		int severity= res.findMaxProblemSeverity(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
+		int severity= findMaxProblemSeverity(res, IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
 		if (severity == IMarker.SEVERITY_ERROR)
 			return ERRORTICK_ERROR;
 		
 		// markers on CUs
 		for (ICompilationUnit cu : pack.getCompilationUnits()) {
-			severity= Math.max(severity, cu.getResource().findMaxProblemSeverity(IMarker.PROBLEM, true, IResource.DEPTH_ZERO));
+			severity= Math.max(severity, findMaxProblemSeverity(cu.getResource(), IMarker.PROBLEM, true, IResource.DEPTH_ZERO));
 			if (severity == IMarker.SEVERITY_ERROR)
 				return ERRORTICK_ERROR;
 		}
@@ -342,7 +342,7 @@
 		for (Object object : pack.getNonJavaResources()) {
 			if (object instanceof IResource) {
 				IResource resource= (IResource) object;
-				severity= Math.max(severity, resource.findMaxProblemSeverity(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE));
+				severity= Math.max(severity, findMaxProblemSeverity(resource, IMarker.PROBLEM, true, IResource.DEPTH_INFINITE));
 				if (severity == IMarker.SEVERITY_ERROR)
 					return ERRORTICK_ERROR;
 			}
@@ -357,6 +357,18 @@
 		}
 		return 0;
 	}
+	
+	private int findMaxProblemSeverity (IResource res, String type, boolean includeSubtypes, int depth) throws CoreException {
+		try {
+			return res.findMaxProblemSeverity(type, includeSubtypes, depth);
+		} catch (CoreException e) {
+			if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
+				// Ignore failure in the case of concurrent deletion
+				return -1;
+			}
+			throw e;
+		}
+	}
 
 	private boolean isMarkerInRange(IMarker marker, ISourceReference sourceElement) throws CoreException {
 		if (marker.isSubtypeOf(IMarker.TEXT)) {