KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > webapp > servlet > WebappWorkingSetManager


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.servlet;
12
13 import java.io.*;
14
15 import javax.servlet.http.*;
16
17 import org.eclipse.help.internal.base.*;
18 import org.eclipse.help.internal.workingset.*;
19
20 /**
21  * Proxy for WorkingSetManager or InfocenterWorkingSetManager.
22  *
23  * @since 3.0
24  */

25 public class WebappWorkingSetManager implements IHelpWorkingSetManager {
26     IHelpWorkingSetManager wSetManager;
27     // for keeping track if working set synchronized with working sets in UI
28
//private static boolean workingSetsSynchronized = false;
29
//private static final Object workingSetsSyncLock = new Object();
30

31     /**
32      * Constructor
33      *
34      * @param locale
35      */

36     public WebappWorkingSetManager(HttpServletRequest request,
37             HttpServletResponse response, String JavaDoc locale) {
38         if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
39             wSetManager = new InfocenterWorkingSetManager(request, response,
40                     locale);
41         } else {
42             wSetManager = BaseHelpSystem.getWorkingSetManager();
43         }
44     }
45
46     public AdaptableTocsArray getRoot() {
47         return wSetManager.getRoot();
48     }
49     /**
50      * Adds a new working set and saves it
51      */

52     public void addWorkingSet(WorkingSet workingSet) throws IOException {
53         wSetManager.addWorkingSet(workingSet);
54     }
55
56     /**
57      * Creates a new working set
58      */

59     public WorkingSet createWorkingSet(String JavaDoc name,
60             AdaptableHelpResource[] elements) {
61         return wSetManager.createWorkingSet(name, elements);
62     }
63
64     /**
65      * Returns a working set by name
66      *
67      */

68     public WorkingSet getWorkingSet(String JavaDoc name) {
69         return wSetManager.getWorkingSet(name);
70     }
71     /**
72      * Implements IWorkingSetManager.
73      *
74      * @see org.eclipse.ui.IWorkingSetManager#getWorkingSets()
75      */

76     public WorkingSet[] getWorkingSets() {
77         return wSetManager.getWorkingSets();
78     }
79     /**
80      * Removes specified working set
81      */

82     public void removeWorkingSet(WorkingSet workingSet) {
83         wSetManager.removeWorkingSet(workingSet);
84     }
85
86     /**
87      * Persists all working sets. Should only be called by the webapp working
88      * set dialog.
89      *
90      * @param changedWorkingSet
91      * the working set that has changed
92      */

93     public void workingSetChanged(WorkingSet changedWorkingSet)
94             throws IOException {
95         wSetManager.workingSetChanged(changedWorkingSet);
96     }
97
98     public AdaptableToc getAdaptableToc(String JavaDoc href) {
99         return wSetManager.getAdaptableToc(href);
100     }
101
102     public AdaptableTopic getAdaptableTopic(String JavaDoc id) {
103         return wSetManager.getAdaptableTopic(id);
104     }
105
106     public String JavaDoc getCurrentWorkingSet() {
107         return wSetManager.getCurrentWorkingSet();
108     }
109
110     public void setCurrentWorkingSet(String JavaDoc scope) {
111         wSetManager.setCurrentWorkingSet(scope);
112     }
113
114 }
115
Popular Tags