KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > webapp > data > WebappPreferences


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.webapp.data;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.help.internal.base.*;
15 import org.eclipse.help.internal.util.ProductPreferences;
16
17 /**
18  * Preferences for availiable to webapp
19  */

20 public class WebappPreferences {
21     Preferences prefs;
22     /**
23      * Constructor.
24      */

25     public WebappPreferences() {
26         prefs = HelpBasePlugin.getDefault().getPluginPreferences();
27     }
28     /**
29      * @return String - URL of banner page or null
30      */

31     public String JavaDoc getBanner() {
32         return prefs.getString("banner"); //$NON-NLS-1$
33
}
34
35     public String JavaDoc getBannerHeight() {
36         return prefs.getString("banner_height"); //$NON-NLS-1$
37
}
38
39     public String JavaDoc getHelpHome() {
40         return prefs.getString("help_home"); //$NON-NLS-1$
41
}
42
43     public boolean isIndexView() {
44         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "indexView"); //$NON-NLS-1$
45
}
46
47     public boolean isBookmarksView() {
48         return BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER
49                 && ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "bookmarksView"); //$NON-NLS-1$
50
}
51
52     public boolean isBookmarksAction() {
53         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "bookmarksView"); //$NON-NLS-1$
54
}
55
56     public boolean isLinksView() {
57         // only show links view if user requested infopops
58
boolean winfopop = prefs.getBoolean(IHelpBaseConstants.P_KEY_WINDOW_INFOPOP);
59         boolean dinfopop = prefs.getBoolean(IHelpBaseConstants.P_KEY_DIALOG_INFOPOP);
60         return BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER
61                 && ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "linksView") //$NON-NLS-1$
62
&& (winfopop || dinfopop);
63     }
64
65     public String JavaDoc getImagesDirectory() {
66         String JavaDoc imagesDirectory = prefs.getString("imagesDirectory"); //$NON-NLS-1$
67
if (imagesDirectory != null && imagesDirectory.startsWith("/")) //$NON-NLS-1$
68
imagesDirectory = UrlUtil.getHelpURL(imagesDirectory);
69         return imagesDirectory;
70
71     }
72
73     public String JavaDoc getToolbarBackground() {
74         return prefs.getString("advanced.toolbarBackground"); //$NON-NLS-1$
75
}
76
77     public String JavaDoc getBasicToolbarBackground() {
78         return prefs.getString("basic.toolbarBackground"); //$NON-NLS-1$
79
}
80
81     public String JavaDoc getToolbarFont() {
82         return prefs.getString("advanced.toolbarFont"); //$NON-NLS-1$
83
}
84
85     public String JavaDoc getViewBackground() {
86         return prefs.getString("advanced.viewBackground"); //$NON-NLS-1$
87
}
88
89     public String JavaDoc getBasicViewBackground() {
90         return prefs.getString("basic.viewBackground"); //$NON-NLS-1$
91
}
92
93     public String JavaDoc getViewFont() {
94         return prefs.getString("advanced.viewFont"); //$NON-NLS-1$
95
}
96
97     public int getBookAtOnceLimit() {
98         return prefs.getInt("loadBookAtOnceLimit"); //$NON-NLS-1$
99
}
100
101     public int getLoadDepth() {
102         int value = prefs.getInt("dynamicLoadDepthsHint"); //$NON-NLS-1$
103
if (value < 1) {
104             return 1;
105         }
106         return value;
107     }
108     public boolean isWindowTitlePrefix() {
109         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "windowTitlePrefix"); //$NON-NLS-1$
110
}
111     public boolean isDontConfirmShowAll() {
112         return prefs.getBoolean("dontConfirmShowAll"); //$NON-NLS-1$
113
}
114     public void setDontConfirmShowAll(boolean dontconfirm) {
115         prefs.setValue("dontConfirmShowAll", dontconfirm); //$NON-NLS-1$
116
}
117     public boolean isActiveHelp() {
118         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "activeHelp"); //$NON-NLS-1$
119
}
120
121     public boolean isIndexInstruction() {
122         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "indexInstruction"); //$NON-NLS-1$
123
}
124
125     public boolean isIndexButton() {
126         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "indexButton"); //$NON-NLS-1$
127
}
128
129     public boolean isIndexPlusMinus() {
130         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "indexPlusMinus"); //$NON-NLS-1$
131
}
132
133     public boolean isIndexExpandAll() {
134         return ProductPreferences.getBoolean(HelpBasePlugin.getDefault(), "indexExpandAll"); //$NON-NLS-1$
135
}
136     public boolean isHighlightDefault() {
137         return prefs.getBoolean("default_highlight"); //$NON-NLS-1$
138
}
139     public void setHighlightDefault(boolean highlight) {
140         prefs.setValue("default_highlight", highlight); //$NON-NLS-1$
141
}
142     
143     public boolean useNewTocView() {
144         return prefs.getBoolean("newTocView"); //$NON-NLS-1$
145
}
146 }
147
Popular Tags