Bug 392779 - [navigation] Need ability to change order of hyperlink resolvers
Summary: [navigation] Need ability to change order of hyperlink resolvers
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P5 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-24 14:31 EDT by Tor Norbye CLA
Modified: 2012-10-26 07:28 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Norbye CLA 2012-10-24 14:31:52 EDT
The Android plugin for Eclipse adds a hyperlink resolver for Java files, to make Go To Declaration work for generated resources.

(Brief Android background: If you have an XML resource such as "res/layout/foo.xml", this will create a field in the special class "R" called "R.layout.foo", and Java code will refer to this R.layout.foo field to name the resource.)

We add our own hyperlink resolver, via the org.eclipse.ui.workbench.texteditor.hyperlinkDetectors extension point. This resolver makes it possible to jump from "R.layout.foo" straight into the XML file.

However, the Java plugin already has a hyperlink resolver which makes the jump go to the (generated) R class. 

We would like to be able to mark our hyperlink resolver have a higher priority, such that if *it* computes a target, it should be preferred (and be used for the "Open Declaration" (F3) command). It should also sort to the top of all the alternatives shown when you ctrl-hover over identifiers in the editor.

Unfortunately, it looks like the Java editor's builtin hyperlink resolver is always first. 

It would be really great if we could find some way to give our own resolver a higher priority for this (or alternatively, to replace it and delegate to it as appropriate.)

I couldn't find a way to do this with the existing support, so I apologize if it's possible and would really appreciate learning how to do it.
Comment 1 Jay Arthanareeswaran CLA 2012-10-26 06:37:24 EDT
I am not sure if it's a JDT/Core bug or even JDT/UI bug for that matter.
 
Markus,
Please feel free to move it back or to the right component if found appropriate.
Comment 2 Dani Megert CLA 2012-10-26 07:28:24 EDT
The hyperlink feature and F3 ('Open Declaration' action/command) are not the same thing. Since 3.7 there is an 'Open Hyperlink' command which does the same as Ctrl+Click. So, I'm treating this bug to be against the hyperlink support and ignore F3 here. There are not plans to make F3 customizable.


Allowing to specify the order (either via XML or in the UI) could be offered but stop processing/offering other detectors if the previous one has a result is against the Eclipse way of adding contributions without disabling/removing other ones. This is not something we'd support.


As a workaround/hack you could try to disable the JDT hyperlinks (via preference store) and then have your hyperlink delegate to those if needed.