Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320668

Summary: [Help] Indicators for Remote UA enablement
Product: [Eclipse Project] Platform Reporter: Chris Austin <ChrisAustin>
Component: User AssistanceAssignee: Rupesh Kumar <rukumar2>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: cgold, rukumar2
Version: 3.7   
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for the Remote UA enablement
cgold: iplog+
Revised Patch
none
Revised patch with improved doc changes none

Description Chris Austin CLA 2010-07-22 17:01:03 EDT
Provide an API call to determine whether a given topic (or perhaps toc entry) is being served up remotely.  The API could be used by clients wishing to put an indicator on a page to describe its origin.
Comment 1 Rupesh Kumar CLA 2011-01-21 01:17:53 EST
I made the fix in such a way that HelpURLConnection.getInputStream() method will return the object of the type RemoteHelpInputStream for the remote docs, which will help in the InjectionFilter to determine when do we need to insert the remote_css in the page. 

Working will be something like this, for the remote_css=/org.eclipse.help.base/doc/remote.css, a css (<link rel="stylesheet" href="../../../content/org.eclipse.help.base/doc/remote.css" type="text/css"></link>) will be inserted inside the <head> of the page.


I have added the patch. Please have a look.
Comment 2 Rupesh Kumar CLA 2011-01-21 01:23:10 EST
Created attachment 187258 [details]
Patch for the Remote UA enablement

I made the fix in such a way that HelpURLConnection.getInputStream() method will return the object of the type RemoteHelpInputStream for the remote docs, which will help in the InjectionFilter to determine when do we need to insert the remote_css in the page. 

Working is something like this, for the remote_css=/org.eclipse.help.base/doc/remote.css, a css (<link rel="stylesheet" href="../../../content/org.eclipse.help.base/doc/remote.css" type="text/css"></link>) will be inserted inside the <head> of the page.
Comment 3 Chris Goldthorpe CLA 2011-01-21 13:49:53 EST
I tested the patch and it worked. There are a few things that need to change, I will work with Chris Austin to fix these up so we can commit the patch today.

1. Copyrights need to be updated to 2011
2. .fbprefs should be removed from the patch
3. In preferences.ini the default for remoteHelpOn should not change
4. The preference remote_css defaults to /org.eclipse.help.base/doc/remote.css, but that file does not exist. For now we can set the default to be empty.
5. EclipseConnector is reentrant and setting a switch in the shared EclipseConnector object is not thread safe.

I will create an updated patch and attach it.
Comment 4 Chris Goldthorpe CLA 2011-01-21 13:57:10 EST
One more thing - RemoteHelpInputStream is a thin wrapper around an InputStream which supports the read() method. Are we certain that none of the other methods in InputStream ever get called? It would be easier to support all 9 methods in InputStream than to do the analysis to determine that these methods are never called.
Comment 5 Chris Goldthorpe CLA 2011-01-21 14:54:53 EST
Created attachment 187319 [details]
Revised Patch

I have made the changes described in Comment 3 and Comment 4. There was not a reentrancy issue since a new InjectionFilter object is created for the remote stream, I modified InjectionFilter to add isRemote to the constructor so it is more obvious that the value is not allowed to change. I also update the documentation.
Comment 6 Chris Goldthorpe CLA 2011-01-21 15:21:37 EST
Created attachment 187322 [details]
Revised patch with improved doc changes
Comment 7 Chris Goldthorpe CLA 2011-01-21 15:22:01 EST
Revised patch with improved doc changes committed to HEAD