KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > toc > TocFile


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.toc;
12
13 import java.io.FileInputStream JavaDoc;
14 import java.io.IOException JavaDoc;
15 import java.io.InputStream JavaDoc;
16
17 import org.eclipse.help.internal.util.ResourceLocator;
18
19 /*
20  * A TocFile represents an XML toc file contributed via the toc extension point.
21  */

22 public class TocFile {
23
24     private String JavaDoc pluginId;
25     private String JavaDoc file;
26     private boolean isPrimary;
27     private String JavaDoc locale;
28     private String JavaDoc extraDir;
29     private String JavaDoc category;
30     
31     public TocFile(String JavaDoc pluginId, String JavaDoc file, boolean isPrimary, String JavaDoc locale, String JavaDoc extradir, String JavaDoc category) {
32         this.pluginId = pluginId;
33         this.file = file;
34         this.isPrimary = isPrimary;
35         this.locale = locale;
36         this.extraDir = extradir;
37         this.category = category;
38     }
39     
40     public String JavaDoc getCategory() {
41         return category;
42     }
43
44     public String JavaDoc getExtraDir() {
45         return extraDir;
46     }
47
48     public String JavaDoc getFile() {
49         return file;
50     }
51
52     public InputStream JavaDoc getInputStream() throws IOException JavaDoc {
53         if (pluginId != null) {
54             return ResourceLocator.openFromPlugin(pluginId, file, locale);
55         }
56         else {
57             return new FileInputStream JavaDoc(file);
58         }
59     }
60     
61     public String JavaDoc getLocale() {
62         return locale;
63     }
64
65     public String JavaDoc getPluginId() {
66         return pluginId;
67     }
68
69     public boolean isPrimary() {
70         return isPrimary;
71     }
72 }
73
Popular Tags