[195462] [validation] Claim that referenced file contains errors, but it doesn't
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java
index 2398980..9a48579 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java
@@ -18,7 +18,6 @@
 import java.util.Locale;
 
 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.IProgressMonitor;
@@ -48,10 +47,8 @@
   // Locally used, non-UI strings.
   private static final String REFERENCED_FILE_ERROR_OPEN = "referencedFileError("; //$NON-NLS-1$
   private static final String REFERENCED_FILE_ERROR_CLOSE = ")"; //$NON-NLS-1$
-  private static final String REFERENCED_FILE_ERROR = "referencedFileError"; //$NON-NLS-1$
   private static final String FILE_PROTOCOL_NO_SLASH = "file:"; //$NON-NLS-1$
   private static final String FILE_PROTOCOL = "file:///"; //$NON-NLS-1$
-  private static final String GROUP_NAME = "groupName"; //$NON-NLS-1$
   private final String GET_FILE = "getFile"; //$NON-NLS-1$
   private final String GET_PROJECT_FILES = "getAllFiles"; //$NON-NLS-1$
   private final String GET_INPUTSTREAM = "inputStream"; //$NON-NLS-1$
@@ -413,30 +410,6 @@
       reporter.addMessage(this, message);
 	      
     }
-    try
-    {
-      IMarker[] markers = iFile.findMarkers(null, true, IResource.DEPTH_INFINITE);
-      for (int i = 0; i < markers.length; i++)
-      {
-        IMarker marker = markers[i];
-        String groupName = null;
-        try
-        {
-          groupName = (String) marker.getAttribute(GROUP_NAME);
-        }
-        catch (Exception e)
-        {
-        }
-        if (groupName != null && groupName.startsWith(REFERENCED_FILE_ERROR))
-        {
-          marker.setAttribute(IMarker.DONE, true);
-        }
-      }
-    }
-    catch (CoreException e)
-    {
-      e.printStackTrace();
-    }
   }
 	  
   /**
diff --git a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
index 323ead9..cea04ef 100644
--- a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
@@ -57,5 +57,5 @@
  org.eclipse.wst.validation;bundle-version="[1.2.0,1.3.0)",
  com.ibm.icu;bundle-version="[3.8.1,4.0.0)",
  org.eclipse.core.expressions;bundle-version="[3.3.0,4.0.0)"
-Bundle-ActivationPolicy: lazy
+Bundle-ActivationPolicy: lazy; exclude:="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo"
 Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.xml b/bundles/org.eclipse.wst.xml.ui/plugin.xml
index 2db1765..06124df 100644
--- a/bundles/org.eclipse.wst.xml.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xml.ui/plugin.xml
@@ -519,31 +519,61 @@
 		</viewerContribution>
 	</extension>
 
-	<!-- ====================================================== -->
-	<!-- An extension for creating nested validation messages.  -->
-	<!-- This extension should be moved when the referenced     -->
-	<!-- files dialog is moved to another plugin.               -->
-	<!-- ====================================================== -->
-	<extension point="org.eclipse.ui.popupMenus">
-		<objectContribution
-			objectClass="org.eclipse.core.resources.IMarker"
-			id="org.eclipse.wst.xml.ui.internal.validation.nestederrorlist"
-			nameFilter="*">
-			<filter
-				name="done"
-				value="true">
-			</filter>
-			<filter
-				name="type"
-				value="org.eclipse.wst.validation.problemmarker">
-			</filter>
-			<action
-				label="%_UI_REF_FILE_SHOW_DETAILS"
-				class="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo.ReferencedFileErrorActionDelegate"
-				id="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo.ReferencedFileErrorActionDelegate">
-			</action>
-		</objectContribution>
+	<!--======================================================================================-->
+	<!-- Pop-up menu and associated command/handler for nested validation messages.           -->
+	<!--======================================================================================-->
+
+	<extension point="org.eclipse.ui.menus">
+      <menuContribution locationURI="popup:org.eclipse.ui.ide.MarkersView">
+          <command commandId="org.eclipse.wst.xml.ui.referencedFileErrors">
+             <visibleWhen checkEnabled="false">
+				<reference definitionId="org.eclipse.wst.xml.ui.referencedFileErrors" />
+             </visibleWhen>
+         </command>
+      </menuContribution>
 	</extension>
+	
+	<extension point="org.eclipse.ui.commands">
+		<command
+			description="%_UI_REF_FILE_SHOW_DETAILS"
+			id="org.eclipse.wst.xml.ui.referencedFileErrors" 
+			name="%_UI_REF_FILE_SHOW_DETAILS" />
+	</extension>
+	
+    <extension point="org.eclipse.ui.handlers">
+       <handler
+             class="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo.ReferencedFileErrorsHandler"
+             commandId="org.eclipse.wst.xml.ui.referencedFileErrors">
+             <enabledWhen>
+				<reference definitionId="org.eclipse.wst.xml.ui.referencedFileErrors" />
+             </enabledWhen>
+       </handler>
+	</extension>
+	
+	<extension point="org.eclipse.core.expressions.propertyTesters">
+	   <propertyTester
+	         class="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo.GroupNamePropertyTester"
+	         id="org.eclipse.wst.xml.ui.markerGroupNamePropertyTester"
+	         namespace="org.eclipse.wst.xml.ui"
+	         properties="groupNamePrefix"
+	         type="org.eclipse.core.resources.IMarker">
+	   </propertyTester>
+	</extension>
+	 
+	<extension point="org.eclipse.core.expressions.definitions">
+		<definition id="org.eclipse.wst.xml.ui.referencedFileErrors">
+                <and>
+                   <count value="1" />
+                   <with variable="selection">
+                   		<iterate operator="or">
+                      		<adapt type="org.eclipse.core.resources.IMarker">
+                            	<test property="org.eclipse.wst.xml.ui.groupNamePrefix" value="referencedFileError" forcePluginActivation="true" />
+                      		</adapt>
+                   		</iterate>
+                	</with>
+                </and>
+		</definition>
+	</extension>	 
 
 <!--	
 	<extension point="org.eclipse.ui.editorActions">
diff --git a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/GroupNamePropertyTester.java b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/GroupNamePropertyTester.java
new file mode 100644
index 0000000..7c3e9bc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/GroupNamePropertyTester.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.validation.core.errorinfo;
+
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IMarker;
+
+
+/**
+ * Custom property tester used to determine if the groupName attribute is
+ * present on a marker and that its value starts with a given expected value.
+ */
+public class GroupNamePropertyTester extends PropertyTester
+{
+  /**
+   * The group name prefix property name.
+   */
+  private static final String GROUP_NAME_PREFIX = "groupNamePrefix"; //$NON-NLS-1$  
+
+  /**
+   * The group name marker attribute.
+   */
+  private static final String GROUP_NAME = "groupName"; //$NON-NLS-1$
+
+  public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
+  {
+    if (GROUP_NAME_PREFIX.equals(property))
+    {
+      if (receiver instanceof IMarker)
+      {
+        IMarker marker = (IMarker)receiver;
+
+        String groupName = marker.getAttribute(GROUP_NAME, null);
+
+        boolean testValue = groupName != null && expectedValue instanceof String && groupName.startsWith((String)expectedValue);
+        return testValue;
+      }
+    }
+
+    return false;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorActionDelegate.java b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorActionDelegate.java
deleted file mode 100644
index 44fb87b..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorActionDelegate.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.validation.core.errorinfo;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionDelegate;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
-import org.eclipse.wst.xml.ui.internal.validation.XMLValidationUIMessages;
-
-public class ReferencedFileErrorActionDelegate extends ActionDelegate implements IObjectActionDelegate {
-	protected IMarker selectedMarker;
-
-	/**
-	 * 
-	 */
-	public ReferencedFileErrorActionDelegate() {
-		super();
-	}
-
-	public void run(IAction action) {
-		if (selectedMarker != null) {
-			try {
-
-				Map map = (Map) selectedMarker.getResource().getSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME);
-				if (map == null) {
-					String infoUnavailable = XMLValidationUIMessages._UI_DETAILS_INFORMATION_UNAVAILABLE;
-					String revalidateToRegenerateErrors = XMLValidationUIMessages._UI_DETAILS_INFO_REVALIDATE_TO_REGENERATE;
-					MessageDialog.openInformation(Display.getCurrent().getActiveShell(), infoUnavailable, revalidateToRegenerateErrors);
-				}
-				else {
-					String uri = null;
-
-					String groupName = (String) selectedMarker.getAttribute("groupName"); //$NON-NLS-1$
-					if (groupName.startsWith("referencedFileError")) //$NON-NLS-1$
-					{
-						int index1 = groupName.indexOf("("); //$NON-NLS-1$
-						int index2 = groupName.lastIndexOf(")"); //$NON-NLS-1$
-						if ((index1 != -1) && (index2 > index1)) {
-							uri = groupName.substring(index1 + 1, index2);
-						}
-					}
-
-					if (uri != null) {
-						List list = Collections.EMPTY_LIST;
-
-						ValidationMessage message = (ValidationMessage) map.get(uri);
-						if (message != null) {
-							list = message.getNestedMessages();
-						}
-
-						String validatedFileURI = selectedMarker.getResource().getLocation().toOSString();// URIHelper.normalize(selectedMarker.getResource().getLocation().toOSString());
-						validatedFileURI = "file:/" + validatedFileURI; //$NON-NLS-1$
-
-						ReferencedFileErrorDialog dialog = new ReferencedFileErrorDialog(Display.getCurrent().getActiveShell(), list, validatedFileURI, uri);
-						dialog.createAndOpen();
-					}
-				}
-			}
-			catch (CoreException e) {
-				// Do nothing.
-			}
-		}
-	}
-
-	public void selectionChanged(IAction action, ISelection selection) {
-		super.selectionChanged(action, selection);
-		selectedMarker = null;
-		if (selection instanceof IStructuredSelection) {
-			try {
-				Object first = ((IStructuredSelection) selection).getFirstElement();
-
-				IMarker marker = (IMarker) first;
-				selectedMarker = marker;
-				// String groupName = (String)
-				// marker.getAttribute("groupName");
-				// if (groupName.startsWith("referencedFileError"))
-				// {
-				// selectedMarker = marker;
-				// }
-			}
-			catch (Exception e) {
-				// Do nothing.
-			}
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
-	 *      org.eclipse.ui.IWorkbenchPart)
-	 */
-	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-		// dw int i = 0;
-	}
-}
-
-/*
- * private static void printMap(Map map) { for (Iterator i =
- * map.keySet().iterator(); i.hasNext();) { String key = (String) i.next();
- * System.out.println("entry : " + key + " = " + map.get(key)); } }
- * 
- * private void printErrorMap(Map map) { for (Iterator i =
- * map.keySet().iterator(); i.hasNext();) { String key = (String) i.next();
- * ErrorMessage message = (ErrorMessage) map.get(key); if (message != null) {
- * printErrorMessage(message); } } }
- * 
- * private void printErrorMessage(ErrorMessage errorMessage) {
- * System.out.println(errorMessage.getText()); for (Iterator i =
- * errorMessage.getNestedErrors().iterator(); i.hasNext();) {
- * printErrorMessage((ErrorMessage) i.next()); } }
- */
diff --git a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorUtility.java b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorUtility.java
index be74372..378ee89 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorUtility.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorUtility.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 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
@@ -16,19 +16,21 @@
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.content.IContentType;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IEditorDescriptor;
 import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorRegistry;
 import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.editors.text.TextEditor;
 import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.wst.xml.core.internal.validation.core.logging.LoggerFactory;
-import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
 
 
 public class ReferencedFileErrorUtility {
@@ -46,41 +48,44 @@
 						{
 							path = path.setDevice(device.substring(1));
 						}
-						IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
-						if ((file != null) && file.exists()) {
-							// WorkbenchUtility.openEditor(file);
+						final IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+						if ((iFile != null) && iFile.exists()) {
 							// Open the editor for this file.
-							final IFile iFile = file;
-							IWorkbench workbench = XMLUIPlugin.getInstance().getWorkbench();
+							final IWorkbench workbench = PlatformUI.getWorkbench();
 							final IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
 
 							Display.getDefault().asyncExec(new Runnable() {
 								public void run() {
 									try {
-										IEditorDescriptor descriptor = XMLUIPlugin.getInstance().getWorkbench().getEditorRegistry().getDefaultEditor(iFile.getName());
+										IContentType contentType = iFile.getContentDescription().getContentType();
+										IEditorRegistry editorRegistry = workbench.getEditorRegistry();
+										String fileName = iFile.getName();
+										IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(fileName, contentType);
 										String editorId;
 										if (descriptor != null) {
 											editorId = descriptor.getId();
 										}
 										else {
-											editorId = XMLUIPlugin.getInstance().getWorkbench().getEditorRegistry().getDefaultEditor(iFile.getName() + ".txt").getId(); //$NON-NLS-1$
+											descriptor = editorRegistry.getDefaultEditor(fileName + ".txt"); //$NON-NLS-1$
+											editorId = descriptor.getId(); 
 										}
-										workbenchWindow.getActivePage().openEditor(new FileEditorInput(iFile), editorId);
+										
+										if (editorId != null)
+										{
+										  FileEditorInput editorInput = new FileEditorInput(iFile);
+										  IWorkbenchPage activePage = workbenchWindow.getActivePage();
+										  activePage.openEditor(editorInput, editorId);
+										}
 									}
-									catch (PartInitException ex) {
+									catch (Exception ex) {
 										LoggerFactory.getLoggerInstance().logError("Exception encountered when attempting to open file: " + iFile + "\n\n", ex); //$NON-NLS-1$ //$NON-NLS-2$
-										// B2BGUIPlugin.getPlugin().getMsgLogger().write("Exception
-										// encountered when attempting to open
-										// file: " + iFile + "\n\n" + ex);
 									}
 								}
 							});
 
 							Runnable runnable = new Runnable() {
 								public void run() {
-									// IEditorPart editorPart =
-									// WorkbenchUtility.getActiveEditor();
-									IEditorPart editorPart = XMLUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+									IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
 									gotoError(editorPart, line, column);
 								}
 							};
diff --git a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorsHandler.java b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorsHandler.java
new file mode 100644
index 0000000..3db6243
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/core/errorinfo/ReferencedFileErrorsHandler.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.validation.core.errorinfo;
+
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.views.markers.MarkerViewHandler;
+import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
+import org.eclipse.wst.xml.ui.internal.validation.XMLValidationUIMessages;
+
+
+/**
+ * Handler for the referenced file errors command. This class replaces the old
+ * ReferencedFileErrorActionDelegate.
+ */
+public class ReferencedFileErrorsHandler extends MarkerViewHandler
+{
+  public Object execute(ExecutionEvent event) throws ExecutionException
+  {
+    final IMarker[] selectedMarkers = getSelectedMarkers(event);
+
+    IMarker selectedMarker = selectedMarkers[0];
+
+    if (selectedMarker != null)
+    {
+      try
+      {
+
+        IResource resource = selectedMarker.getResource();
+        Map map = (Map)resource.getSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME);
+        if (map == null)
+        {
+          String infoUnavailable = XMLValidationUIMessages._UI_DETAILS_INFORMATION_UNAVAILABLE;
+          String revalidateToRegenerateErrors = XMLValidationUIMessages._UI_DETAILS_INFO_REVALIDATE_TO_REGENERATE;
+          MessageDialog.openInformation(Display.getCurrent().getActiveShell(), infoUnavailable, revalidateToRegenerateErrors);
+        }
+        else
+        {
+          String uri = null;
+
+          String groupName = (String)selectedMarker.getAttribute("groupName"); //$NON-NLS-1$
+          if (groupName.startsWith("referencedFileError")) //$NON-NLS-1$
+          {
+            int index1 = groupName.indexOf("("); //$NON-NLS-1$
+            int index2 = groupName.lastIndexOf(")"); //$NON-NLS-1$
+            if ((index1 != -1) && (index2 > index1))
+            {
+              uri = groupName.substring(index1 + 1, index2);
+            }
+          }
+
+          if (uri != null)
+          {
+            List list = Collections.EMPTY_LIST;
+
+            ValidationMessage message = (ValidationMessage)map.get(uri);
+            if (message != null)
+            {
+              list = message.getNestedMessages();
+            }
+
+            IPath resourceLocation = resource.getLocation();
+            
+            if (resourceLocation != null)
+            {
+              String validatedFileURI = resourceLocation.toOSString();
+              validatedFileURI = "file:/" + validatedFileURI; //$NON-NLS-1$
+
+              ReferencedFileErrorDialog dialog = new ReferencedFileErrorDialog(
+                HandlerUtil.getActiveShell(event),
+                list,
+                validatedFileURI,
+                uri);
+              dialog.createAndOpen();
+            }
+          }
+        }
+      }
+      catch (CoreException e)
+      {
+        // Do nothing.
+      }
+    }
+
+    return this;
+  }
+}
\ No newline at end of file