[296069] [editor] HTML links with special characters not decoded when using Ctrl-click from editor
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/hyperlink/AnchorHyperlinkDetector.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/hyperlink/AnchorHyperlinkDetector.java
index 4d8ab98..e48f0de 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/hyperlink/AnchorHyperlinkDetector.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/hyperlink/AnchorHyperlinkDetector.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2008 IBM Corporation and others.

+ * Copyright (c) 2008, 2011 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

@@ -464,8 +464,22 @@
 							}

 						}

 						if (name != null && value != null) {

-							if (HTML40Namespace.ATTR_NAME_HREF.equalsIgnoreCase(name) && value.indexOf("#") >= 0) { //$NON-NLS-1$

-								return createHyperlinksToAnchorNamed(textViewer, createHyperlinkRegion(documentRegion, valueRegion), element, value, canShowMultipleHyperlinks);

+							int idx = -1;

+							if (HTML40Namespace.ATTR_NAME_HREF.equalsIgnoreCase(name) && (idx = value.indexOf("#")) >= 0) { //$NON-NLS-1$

+								String filename = value.substring(0, idx);

+								final String anchorName = idx < value.length() - 1? value.substring(idx + 1) : null;

+								if (anchorName != null) {

+									final IPath basePath = new Path(((IDOMNode) element).getModel().getBaseLocation());

+									if (basePath.segmentCount() > 1) {

+										if (filename.length() == 0) {

+											filename = basePath.lastSegment();

+										}

+										final IPath resolved = ModuleCoreSupport.resolve(basePath, filename);

+										final IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(resolved);

+										if (targetFile.isAccessible())

+											return createHyperlinksToAnchorNamed(textViewer, createHyperlinkRegion(documentRegion, valueRegion), element, value, canShowMultipleHyperlinks);

+									}

+								}

 							}

 							if (HTML40Namespace.ATTR_NAME_NAME.equalsIgnoreCase(name)||HTML40Namespace.ATTR_NAME_ID.equalsIgnoreCase(name)) {

 								return createReferrerHyperlinks(textViewer, createHyperlinkRegion(documentRegion, valueRegion), element, value, canShowMultipleHyperlinks);