Bug 89303 - [Help] Add support for resolving hrefs in the workbench help system
Summary: [Help] Add support for resolving hrefs in the workbench help system
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2005-03-28 18:14 EST by Dejan Glozic CLA
Modified: 2005-03-29 17:42 EST (History)
5 users (show)

See Also:


Attachments
Added support for resolving help resource hrefs into URLs (6.61 KB, patch)
2005-03-28 18:15 EST, Dejan Glozic CLA
no flags Details | Diff
Fixed Javadoc and returning 'null' for unresolve by default. (9.98 KB, patch)
2005-03-28 21:36 EST, Dejan Glozic CLA
no flags Details | Diff
Modified patch with 'unresolve' removed. (10.94 KB, patch)
2005-03-28 21:41 EST, Dejan Glozic CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dejan Glozic CLA 2005-03-28 18:14:44 EST
There are several use cases where a help resource href needs to be resolved 
into a URL so that it can be manipulated (opened, shown in a browser etc.). 
This task is dependent on the help system plugged in. I have added two methods 
to IWorkbenchHelpSystem: resolve and unresolve. The former takes a String href 
and returns a resolved URL according to the active help system. The later 
takes a URL and returns the original href if the first part of the URL matches 
the base URL. 

The changes I made are backward-compatible in that AbstractHelpSystem has 
default implementations of the methods. Our own help implementation 
(DefaultHelpSystem) implements these methods in a non-trivial way.

Please release the attached patch because Intro needs it in order to be able 
to embed help documents inside Intro pages.
Comment 1 Dejan Glozic CLA 2005-03-28 18:15:12 EST
Created attachment 19251 [details]
Added support for resolving help resource hrefs into URLs
Comment 2 Nick Edgar CLA 2005-03-28 20:17:00 EST
What's the use case for unresolve?
Comment 3 Nick Edgar CLA 2005-03-28 20:22:10 EST
The @return tags for AbstractHelpUI.resolve and unresolve should spell out the
general contract, not the behaviour of the default implementation.  The default
implementation can be described in the body of the Javadoc comment (it already
is), and "For backward compatibility," should be omitted.

Also need to spell out the expected behaviour for non-web-app based Help UIs
that may not be able to convert to/from URLs.
Comment 4 Nick Edgar CLA 2005-03-28 20:24:55 EST
Rather than returning the original URL (as a string), unresolve should return
null if it can't convert back, or throw an exception.

Comment 5 Nick Edgar CLA 2005-03-28 20:26:45 EST
I've released the patch as-is, but am leaving this open to address the issues
above (ideally before M6).
Comment 6 Dejan Glozic CLA 2005-03-28 21:14:18 EST
Every help UI implementation can resolve href - returning a 'file:' protocol 
is perfectly acceptable.

'unresolve' is used by the dynamic help in situations where an absolute URL 
received from a link in a browser need to be converted back into href. It is 
fairly easy to implement - the same prefix added to href to resolve it is 
compared to the URL and if matched, removed from the URL to get href.

I will make other recommended changes.
Comment 7 Dejan Glozic CLA 2005-03-28 21:36:30 EST
Created attachment 19259 [details]
Fixed Javadoc and returning 'null' for unresolve by default.
Comment 8 Dejan Glozic CLA 2005-03-28 21:41:38 EST
Created attachment 19260 [details]
Modified patch with 'unresolve' removed.

I had a change of heart regarding 'unresolve' method - I will call it directly
inside help system for dynamic help view. The 'outside' users only need
'resolve' so no need to expose 'unresolve' for the general public.
Comment 9 Nick Edgar CLA 2005-03-28 22:04:40 EST
Doug has done the submission for tonight, but I'll review the last patch tomorrow.
Comment 10 Nick Edgar CLA 2005-03-29 11:26:24 EST
Patch reviewed and applied.
Comment 11 Nick Edgar CLA 2005-03-29 11:26:44 EST
Closing.  Dejan, could you please verify in the test candidate?
Comment 12 Dejan Glozic CLA 2005-03-29 14:25:25 EST
Negative - the build candidate still has IWorkbenchHelpSystem with 
the 'resolve' method.
Comment 13 Dejan Glozic CLA 2005-03-29 14:25:45 EST
Meant to say 'unresolve'.
Comment 14 Dejan Glozic CLA 2005-03-29 14:32:38 EST
I just checked out org.eclipse.ui.workbench from HEAD and the code looks good 
there. So it is probably just a versioning issue.
Comment 15 Nick Edgar CLA 2005-03-29 17:42:32 EST
Yes, the changes only went into the 16:00 build.