KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > context > ContextsFile


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.context;
12 import java.io.*;
13
14 import org.eclipse.core.runtime.*;
15 import org.eclipse.help.internal.util.*;
16
17 public class ContextsFile {
18     protected String JavaDoc href;
19     protected String JavaDoc definingPluginID;
20     protected String JavaDoc pluginID;
21     /**
22      * Contexts File Constructor
23      */

24     public ContextsFile(String JavaDoc definingPlugin, String JavaDoc href, String JavaDoc plugin) {
25         this.href = href;
26         this.definingPluginID = definingPlugin;
27         this.pluginID = plugin;
28     }
29     /**
30      * Gets the href
31      *
32      * @return Returns a String
33      */

34     public String JavaDoc getHref() {
35         return href;
36     }
37     protected InputStream getInputStream() {
38         InputStream stream = null;
39         try {
40             if (definingPluginID != null)
41                 stream = ResourceLocator.openFromPlugin(definingPluginID, href,
42                         Platform.getNL());
43             else
44                 stream = new FileInputStream(href);
45         } catch (IOException e) {
46         }
47         return stream;
48     }
49     /**
50      * Gets the definingPluginID.
51      *
52      * @return Returns a String
53      */

54     public String JavaDoc getDefiningPluginID() {
55         return definingPluginID;
56     }
57     /**
58      * Gets the plugin ID.
59      *
60      * @return Returns a String
61      */

62     public String JavaDoc getPluginID() {
63         return pluginID;
64     }
65     public void build(ContextsBuilder builder) {
66         builder.build(this);
67     }
68 }
69
Popular Tags