KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > base > HelpProvider


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.help.internal.base;
12
13 import java.io.IOException JavaDoc;
14 import java.io.InputStream JavaDoc;
15 import java.net.URL JavaDoc;
16
17 import org.eclipse.help.internal.HelpPlugin.IHelpProvider;
18 import org.eclipse.help.internal.protocols.HelpURLStreamHandler;
19
20 /*
21  * Provides help document content via the internal application server.
22  * The org.eclipse.help plugin should not make any assumptions about
23  * where the content comes from.
24  */

25 public class HelpProvider implements IHelpProvider {
26
27     /* (non-Javadoc)
28      * @see org.eclipse.help.internal.HelpPlugin.IHelpProvider#getHelpContent(java.lang.String, java.lang.String)
29      */

30     public InputStream JavaDoc getHelpContent(String JavaDoc href, String JavaDoc locale) {
31         try {
32             URL JavaDoc helpURL = new URL JavaDoc("help", //$NON-NLS-1$
33
null, -1, href + "?lang=" + locale, HelpURLStreamHandler.getDefault()); //$NON-NLS-1$
34
return helpURL.openStream();
35         } catch (IOException JavaDoc ioe) {
36             return null;
37         }
38     }
39 }
40
Popular Tags