KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > activities > ProxyActivityManager


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
12 package org.eclipse.ui.internal.activities;
13
14 import java.util.Set JavaDoc;
15
16 import org.eclipse.ui.activities.ActivityManagerEvent;
17 import org.eclipse.ui.activities.IActivity;
18 import org.eclipse.ui.activities.IActivityManager;
19 import org.eclipse.ui.activities.IActivityManagerListener;
20 import org.eclipse.ui.activities.ICategory;
21 import org.eclipse.ui.activities.IIdentifier;
22
23 public final class ProxyActivityManager extends AbstractActivityManager {
24     private IActivityManager activityManager;
25
26     public ProxyActivityManager(IActivityManager activityManager) {
27         if (activityManager == null) {
28             throw new NullPointerException JavaDoc();
29         }
30
31         this.activityManager = activityManager;
32
33         this.activityManager
34                 .addActivityManagerListener(new IActivityManagerListener() {
35                     public void activityManagerChanged(
36                             ActivityManagerEvent activityManagerEvent) {
37                         ActivityManagerEvent proxyActivityManagerEvent = new ActivityManagerEvent(
38                                 ProxyActivityManager.this, activityManagerEvent
39                                         .haveDefinedActivityIdsChanged(),
40                                 activityManagerEvent
41                                         .haveDefinedCategoryIdsChanged(),
42                                 activityManagerEvent
43                                         .haveEnabledActivityIdsChanged(),
44                                 activityManagerEvent
45                                         .getPreviouslyDefinedActivityIds(),
46                                 activityManagerEvent
47                                         .getPreviouslyDefinedCategoryIds(),
48                                 activityManagerEvent
49                                         .getPreviouslyEnabledActivityIds());
50                         fireActivityManagerChanged(proxyActivityManagerEvent);
51                     }
52                 });
53     }
54
55     public IActivity getActivity(String JavaDoc activityId) {
56         return activityManager.getActivity(activityId);
57     }
58
59     public ICategory getCategory(String JavaDoc categoryId) {
60         return activityManager.getCategory(categoryId);
61     }
62
63     public Set JavaDoc getDefinedActivityIds() {
64         return activityManager.getDefinedActivityIds();
65     }
66
67     public Set JavaDoc getDefinedCategoryIds() {
68         return activityManager.getDefinedCategoryIds();
69     }
70
71     public Set JavaDoc getEnabledActivityIds() {
72         return activityManager.getEnabledActivityIds();
73     }
74
75     public IIdentifier getIdentifier(String JavaDoc identifierId) {
76         return activityManager.getIdentifier(identifierId);
77     }
78 }
79
Popular Tags