diff options
author | Jason Peterson | 2013-08-23 16:37:03 +0000 |
---|---|---|
committer | Chris Jaun | 2013-08-28 21:03:17 +0000 |
commit | 2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c (patch) | |
tree | de23a44acd5255d8e8fa44ced0caa7c0e5ee8dab | |
parent | 4d8db7521fd517f688a98ef11f4d0c1a6b0c73f1 (diff) | |
download | webtools.sourceediting-2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c.tar.gz webtools.sourceediting-2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c.tar.xz webtools.sourceediting-2166d4eaa552d84a9fbf0390d6fdeb3f3d12a40c.zip |
[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.java | 13 |
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 ea48fbb941..22773ce51b 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); |