KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > ui > internal > workingset > HelpWorkingSet


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

11 package org.eclipse.help.ui.internal.workingset;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.help.internal.base.*;
15 import org.eclipse.help.internal.workingset.*;
16 import org.eclipse.ui.*;
17
18 /**
19  * A working set for help elements.
20  */

21 public class HelpWorkingSet {
22
23     private WorkingSet workingSet;
24     private IWorkingSet iworkingSet;
25
26     /**
27      * Constructor for HelpWorkingSet.
28      *
29      * @param name
30      * @param elements
31      */

32     public HelpWorkingSet(String JavaDoc name, IAdaptable[] elements) {
33         this(BaseHelpSystem.getWorkingSetManager().createWorkingSet(name,
34                 (AdaptableHelpResource[]) elements));
35     }
36
37     public HelpWorkingSet(WorkingSet ws) {
38         this.workingSet = ws;
39         this.iworkingSet = PlatformUI.getWorkbench().getWorkingSetManager()
40                 .createWorkingSet(ws.getName(), ws.getElements());
41
42         iworkingSet.setId(HelpWorkingSetPage.PAGE_ID);
43
44         //HelpSystem.getWorkingSetManager().addWorkingSet(workingSet);
45
//PlatformUI.getWorkbench().getWorkingSetManager().addWorkingSet(iworkingSet);
46
}
47
48     public HelpWorkingSet(IWorkingSet iws) {
49         this.iworkingSet = iws;
50         AdaptableHelpResource[] elements = new AdaptableHelpResource[iws
51                 .getElements().length];
52         System.arraycopy(iws.getElements(), 0, elements, 0, elements.length);
53         this.workingSet = BaseHelpSystem.getWorkingSetManager()
54                 .createWorkingSet(iws.getName(), elements);
55
56         //HelpSystem.getWorkingSetManager().addWorkingSet(workingSet);
57
//PlatformUI.getWorkbench().getWorkingSetManager().addWorkingSet(iworkingSet);
58
}
59
60     public HelpWorkingSet(WorkingSet ws, IWorkingSet iws) {
61         this.workingSet = ws;
62         this.iworkingSet = iws;
63     }
64
65     public IWorkingSet getIWorkingSet() {
66         return iworkingSet;
67     }
68
69     public WorkingSet getWorkingSet() {
70         return workingSet;
71     }
72
73     /**
74      * Tests the receiver and the object for equality
75      *
76      * @param object
77      * object to compare the receiver to
78      * @return true=the object equals the receiver, the name is the same. false
79      * otherwise
80      */

81     public boolean equals(Object JavaDoc object) {
82         if (this == object) {
83             return true;
84         }
85         if (object instanceof HelpWorkingSet) {
86             HelpWorkingSet ws = (HelpWorkingSet) object;
87             return this.workingSet == ws.workingSet;
88         } else
89             return false;
90     }
91
92 }
93
Popular Tags