Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Changing focus/cursor position with hyperlink in an XML Editor
Changing focus/cursor position with hyperlink in an XML Editor [message #227651] Wed, 11 February 2009 13:07 Go to next message
Xavier Coulon is currently offline Xavier CoulonFriend
Messages: 58
Registered: July 2009
Member
Hello,

I'm trying to provide custom hyperlinks in an XML Editor.
These hyperlinks should bring the user (focus and/or cursor position) on
another XMLeElement of the current document in the current editor (ie,
just move within the current xml document).

How should I implement the open() method brought by the IHyperlink
interface in my custom Hyperlink class ?
Do you have any example ?

Thank you in advance
Regards,
Xavier
Re: Changing focus/cursor position with hyperlink in an XML Editor [message #227692 is a reply to message #227651] Thu, 12 February 2009 01:46 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Xavier Coulon wrote:
> I'm trying to provide custom hyperlinks in an XML Editor. These
> hyperlinks should bring the user (focus and/or cursor position) on
> another XMLeElement of the current document in the current editor (ie,
> just move within the current xml document).
>
> How should I implement the open() method brought by the IHyperlink
> interface in my custom Hyperlink class ? Do you have any example ?

For the same file, all you should need to do is set the text
viewer's selection to the new Element as an ITextSelection with its
start offset and a length, and possibly call
ITextViewer.revealRange() to make sure it's scrolled to. You should
already have access to the viewer from your implementation of
IHyperlinkDetector.detectHyperlinks(ITextViewer, IRegion, boolean),
so just have your hyperlink object ask it for its ISelectionProvider
and set your new selection through it.

Once you have the basics working, be sure to go back and revisit
ITextViewerExtension5, as you will need to use it to properly work
in situations where the source has been folded.

---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Changing focus/cursor position with hyperlink in an XML Editor [message #227945 is a reply to message #227692] Tue, 17 February 2009 12:20 Go to previous message
Xavier Coulon is currently offline Xavier CoulonFriend
Messages: 58
Registered: July 2009
Member
Thanks a lot and sorry for answering so late...

Regards,
/Xavier
Previous Topic:deploy to apache
Next Topic:Console enhancements
Goto Forum:
  


Current Time: Thu Apr 25 14:49:54 GMT 2024

Powered by FUDForum. Page generated in 0.03236 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top