Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (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 08:07 Go to next message
Xavier Coulon is currently offline Xavier Coulon
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] Wed, 11 February 2009 20:46 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2251
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 WTP, IBM
Re: Changing focus/cursor position with hyperlink in an XML Editor [message #227945 is a reply to message #227692] Tue, 17 February 2009 07:20 Go to previous message
Xavier Coulon is currently offline Xavier Coulon
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 Aug 28 05:13:05 EDT 2014

Powered by FUDForum. Page generated in 0.01652 seconds