[Bug 542946] CancellationException in NestedProjectsLabelProvider

Change-Id: Ib5211507a168230baaadde7a1a167003f4db91be
Signed-off-by: Mickael Istria <mistria@redhat.com>
diff --git a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/nested/NestedProjectsLabelProvider.java b/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/nested/NestedProjectsLabelProvider.java
index 67b478a..b582a84 100644
--- a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/nested/NestedProjectsLabelProvider.java
+++ b/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/nested/NestedProjectsLabelProvider.java
@@ -38,6 +38,8 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages;
 import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin;
 import org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionLabelProvider;
 import org.eclipse.ui.navigator.ICommonContentExtensionSite;
@@ -66,7 +68,11 @@
 					for (IMarkerDelta markerDelta : markerDeltas) {
 						if (markerManager.isSubtype(markerDelta.getType(), IMarker.PROBLEM)) {
 							if (severities != null && !severities.isDone()) {
-								severities.cancel(true);
+								try {
+									severities.cancel(true);
+								} catch (CancellationException ex) {
+									// expected exception
+								}
 								severities = null;
 								return false;
 							}
@@ -237,7 +243,8 @@
 		IProject project = (IProject)element;
 		IPath location = project.getLocation();
 		if (location != null && !location.lastSegment().equals(project.getName())) {
-			return input + " (in " + location.lastSegment() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+			return NLS.bind(WorkbenchNavigatorMessages.NestedProjectLabelProvider_nestedProjectLabel, input,
+					location.lastSegment());
 		}
 		return input;
 	}
diff --git a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorMessages.java b/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorMessages.java
index 62ce95c..2e77790 100644
--- a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorMessages.java
+++ b/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorMessages.java
@@ -74,6 +74,8 @@
 
 	public static String SelectProjectForFolderAction_SelectProject;
 
+	public static String NestedProjectLabelProvider_nestedProjectLabel;
+
 	public static String workingSet_others;
 
 
diff --git a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/messages.properties b/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/messages.properties
index 932e22b..9440bb0 100644
--- a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/messages.properties
+++ b/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/messages.properties
@@ -47,4 +47,5 @@
 OpenProjectAction_OpenExistingProject=Impor&t as Project
 OpenProjectAction_OpenExistingProject_desc=Imports this existing Project into Workspace
 SelectProjectForFolderAction_SelectProject=&Go to project ''{0}''
+NestedProjectLabelProvider_nestedProjectLabel={0} (in {1})
 workingSet_others=Other Projects
\ No newline at end of file