views:

222

answers:

1

I'm writing an eclipse editor plugin for a custom file format and want to offer a way to quickly jump to the definition of an entity from a named reference to it - basically the "open declaration" functionality of the eclipse Java editor.

I know I can do this by registering an editor action and putting it in the context menu, but I'd really like the way all Java identifiers turn into links to their declaration when you press CTRL in the Java editor - how can I do that? I can't find anything about it in the documentation.

+3  A: 

Hello,

I think you are looking for hyper link detectors. Extension point is: org.eclipse.ui.workbench.texteditor.hyperlinkDetectors, Here is snippet from Mylyn plugin.xml:

<extension point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
  <hyperlinkDetector            
        class="org.eclipse.mylyn.internal.tasks.ui.editors.TaskHyperlinkDetector"
        id="org.eclipse.mylyn.tasks.ui.hyperlinks.detectors.task"
        name="%TaskHyperlinkDetector.name"
        targetId="org.eclipse.ui.DefaultTextEditor">
  </hyperlinkDetector>

Also check out AbstractHyperlinkDetector, useful abstract class you can extend to provide your custom detector.

Peter Štibraný