View | Details | Raw Unified | Return to bug 89303 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/help/AbstractHelpUI.java (+35 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.help;
11
package org.eclipse.ui.help;
12
12
13
import java.net.URL;
14
13
import org.eclipse.help.IContext;
15
import org.eclipse.help.IContext;
14
16
15
/**
17
/**
Lines 69-74 Link Here
69
    public void search(String expression) {
71
    public void search(String expression) {
70
        // do nothing
72
        // do nothing
71
    }
73
    }
74
	/**
75
	 * Resolves the help resource href according to the
76
	 * help system implementation. 
77
	 * For backward compatibility, the default implementation
78
	 * returns <code>null</code>. Implementors are expected
79
	 * to provide a non-trivial implementation.
80
	 * 
81
	 * @param href the help resource
82
	 * @param documentOnly if <code>true</code>, the resulting URL must point
83
	 * at the document referenced by href. Otherwise, it can be a URL that
84
	 * contains additional elements like navigation that the help system
85
	 * adds to the document.
86
	 * @return <code>null</code>
87
	 * @since 3.1
88
	 */
89
	public URL resolve(String href, boolean documentOnly) {
90
		return null;
91
	}
92
	/**
93
	 * Restores the original help resource previously resolved
94
	 * using the <code>resolve</code> method.
95
	 * For backward compatibility, the default implementation
96
	 * returns the source url. Implementors are expected
97
	 * to provide a non-trivial implementation.
98
	 * 
99
	 * @param url the url to unresolve
100
	 * @return the unchanged source url
101
	 * 
102
	 * @since 3.1
103
	 */
104
	public String unresolve(URL url) {
105
		return url.toString();
106
	}
72
107
73
    /**
108
    /**
74
     * Displays context-sensitive help for the given context.
109
     * Displays context-sensitive help for the given context.
(-)Eclipse UI/org/eclipse/ui/help/IWorkbenchHelpSystem.java (-8 / +42 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.help;
11
package org.eclipse.ui.help;
12
12
13
import java.net.URL;
14
13
import org.eclipse.help.IContext;
15
import org.eclipse.help.IContext;
14
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.action.IAction;
15
import org.eclipse.swt.widgets.Control;
17
import org.eclipse.swt.widgets.Control;
Lines 24-29 Link Here
24
 * <p>
26
 * <p>
25
 * This interface is not intended to be implemented by clients.
27
 * This interface is not intended to be implemented by clients.
26
 * </p>
28
 * </p>
29
 * 
27
 * @since 3.1
30
 * @since 3.1
28
 */
31
 */
29
public interface IWorkbenchHelpSystem {
32
public interface IWorkbenchHelpSystem {
Lines 34-40 Link Here
34
	 * @return whether there is a UI help system installed
37
	 * @return whether there is a UI help system installed
35
	 */
38
	 */
36
	boolean hasHelpUI();
39
	boolean hasHelpUI();
37
	
40
38
	/**
41
	/**
39
	 * Displays the entire help bookshelf.
42
	 * Displays the entire help bookshelf.
40
	 * <p>
43
	 * <p>
Lines 42-48 Link Here
42
	 * </p>
45
	 * </p>
43
	 */
46
	 */
44
	void displayHelp();
47
	void displayHelp();
45
	
48
46
	/**
49
	/**
47
	 * Displays the help search system.
50
	 * Displays the help search system.
48
	 * <p>
51
	 * <p>
Lines 50-59 Link Here
50
	 * </p>
53
	 * </p>
51
	 */
54
	 */
52
	void displaySearch();
55
	void displaySearch();
53
	
56
54
	/**
57
	/**
55
	 * Displays the dynamic help for the 
58
	 * Displays the dynamic help for the current UI context.
56
	 * current UI context. 
57
	 * <p>
59
	 * <p>
58
	 * Ignored if no help UI is available.
60
	 * Ignored if no help UI is available.
59
	 * </p>
61
	 * </p>
Lines 65-72 Link Here
65
	 * <p>
67
	 * <p>
66
	 * Ignored if no help UI is available.
68
	 * Ignored if no help UI is available.
67
	 * </p>
69
	 * </p>
68
	 * @param expression the search expression
70
	 * 
69
	 */	
71
	 * @param expression
72
	 *            the search expression
73
	 */
70
	void search(String expression);
74
	void search(String expression);
71
75
72
	/**
76
	/**
Lines 185-188 Link Here
185
	 *            the context id to use when F1 help is invoked
189
	 *            the context id to use when F1 help is invoked
186
	 */
190
	 */
187
	void setHelp(MenuItem item, String contextId);
191
	void setHelp(MenuItem item, String contextId);
188
}
192
193
	/**
194
	 * Resolves the help resource href by converting it into a legitimate URL
195
	 * according to the implementation of the help system. Help resources that
196
	 * already have a protocol will be unchanged.
197
	 * 
198
	 * @param href
199
	 * @param documentOnly if <code>true</code>, the resulting URL must point
200
	 * at the document referenced by href. Otherwise, it can be a URL that
201
	 * contains additional elements like navigation that the help system
202
	 * adds to the document.
203
	 * @return the resolved URL or <code>null</code> if no help UI is
204
	 *         available.
205
	 */
206
	URL resolve(String href, boolean documentOnly);
207
208
	/**
209
	 * Ensures a roundtrip by restoring the original href previously resolved
210
	 * into a URL in the <code>resolve</code> method. The method can also
211
	 * unresolve other legitimate URLs but successful resolution is only
212
	 * guaranteed with the URLs created by the <code>resolve</code> method.
213
	 * <p>
214
	 * If the source url does not start with an expected prefix, it will be
215
	 * returned unchanged.
216
	 * 
217
	 * @param url
218
	 *            the URL that needs to be unresolved into an href.
219
	 * @return the unresolved href or the source url if no help UI is available.
220
	 */
221
	String unresolve(URL url);
222
}
(-)Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java (+24 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.internal.help;
11
package org.eclipse.ui.internal.help;
12
12
13
import java.net.URL;
14
13
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IConfigurationElement;
16
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.core.runtime.IExtension;
17
import org.eclipse.core.runtime.IExtension;
Lines 809-814 Link Here
809
			helpUI.search(expression);
811
			helpUI.search(expression);
810
		}
812
		}
811
	}
813
	}
814
	
815
	/* (non-Javadoc)
816
	 * @see org.eclipse.ui.help.IWorkbenchHelpSystem#resolve(java.lang.String, boolean)
817
	 */
818
	public URL resolve(String href, boolean documentOnly) {
819
		AbstractHelpUI helpUI = getHelpUI();
820
		if (helpUI != null) {
821
			return helpUI.resolve(href, documentOnly);
822
		}
823
		return null;
824
	}
825
	
826
	/* (non-Javadoc)
827
	 * @see org.eclipse.ui.help.IWorkbenchHelpSystem#unresolve(java.net.URL)
828
	 */
829
	public String unresolve(URL url) {
830
		AbstractHelpUI helpUI = getHelpUI();
831
		if (helpUI != null) {
832
			return helpUI.unresolve(url);
833
		}
834
		return url.toString();
835
	}
812
836
813
	/*
837
	/*
814
	 * (non-Javadoc)
838
	 * (non-Javadoc)

Return to bug 89303