summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Peterson2013-08-23 12:37:03 (EDT)
committerChris Jaun2013-08-28 17:03:17 (EDT)
commit2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c (patch)
treede23a44acd5255d8e8fa44ced0caa7c0e5ee8dab
parent4d8db7521fd517f688a98ef11f4d0c1a6b0c73f1 (diff)
downloadwebtools.sourceediting-2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c.zip
webtools.sourceediting-2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c.tar.gz
webtools.sourceediting-2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c.tar.bz2
[415768] Opening hyperlink on workspace html file only works for editorsv201308282108R3_5_1
that are instanceof ITextEditor Signed-off-by: Jason Peterson <jasonpet@us.ibm.com>
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/WorkspaceFileHyperlink.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/WorkspaceFileHyperlink.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/WorkspaceFileHyperlink.java
index ea48fbb..22773ce 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/WorkspaceFileHyperlink.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/WorkspaceFileHyperlink.java
@@ -23,6 +23,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.html.ui.internal.HTMLUIMessages;
import org.eclipse.wst.jsdt.web.ui.internal.Logger;
+
class WorkspaceFileHyperlink implements IHyperlink {
// copies of this class exist in:
// org.eclipse.wst.xml.ui.internal.hyperlink
@@ -76,8 +77,16 @@ class WorkspaceFileHyperlink implements IHyperlink {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editor = IDE.openEditor(page, fFile, true);
// highlight range in editor if possible
- if (fHighlightRange != null && editor instanceof ITextEditor) {
- ((ITextEditor) editor).selectAndReveal(fHighlightRange.getOffset(), fHighlightRange.getLength());
+ if (fHighlightRange != null && editor != null) {
+ ITextEditor textEditor = null;
+ if (editor instanceof ITextEditor) {
+ textEditor = (ITextEditor) editor;
+ } else {
+ textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
+ }
+ if (textEditor != null) {
+ textEditor.selectAndReveal(fHighlightRange.getOffset(), fHighlightRange.getLength());
+ }
}
} catch (PartInitException pie) {
Logger.log(Logger.WARNING_DEBUG, pie.getMessage(), pie);