01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.activities;
11:
12: import java.util.Set;
13:
14: import org.eclipse.ui.activities.ActivityManagerEvent;
15: import org.eclipse.ui.activities.IActivity;
16: import org.eclipse.ui.activities.IActivityManager;
17: import org.eclipse.ui.activities.IActivityManagerListener;
18: import org.eclipse.ui.activities.ICategory;
19: import org.eclipse.ui.activities.IIdentifier;
20:
21: public final class ProxyActivityManager extends AbstractActivityManager {
22: private IActivityManager activityManager;
23:
24: public ProxyActivityManager(IActivityManager activityManager) {
25: if (activityManager == null) {
26: throw new NullPointerException();
27: }
28:
29: this .activityManager = activityManager;
30:
31: this .activityManager
32: .addActivityManagerListener(new IActivityManagerListener() {
33: public void activityManagerChanged(
34: ActivityManagerEvent activityManagerEvent) {
35: ActivityManagerEvent proxyActivityManagerEvent = new ActivityManagerEvent(
36: ProxyActivityManager.this ,
37: activityManagerEvent
38: .haveDefinedActivityIdsChanged(),
39: activityManagerEvent
40: .haveDefinedCategoryIdsChanged(),
41: activityManagerEvent
42: .haveEnabledActivityIdsChanged(),
43: activityManagerEvent
44: .getPreviouslyDefinedActivityIds(),
45: activityManagerEvent
46: .getPreviouslyDefinedCategoryIds(),
47: activityManagerEvent
48: .getPreviouslyEnabledActivityIds());
49: fireActivityManagerChanged(proxyActivityManagerEvent);
50: }
51: });
52: }
53:
54: public IActivity getActivity(String activityId) {
55: return activityManager.getActivity(activityId);
56: }
57:
58: public ICategory getCategory(String categoryId) {
59: return activityManager.getCategory(categoryId);
60: }
61:
62: public Set getDefinedActivityIds() {
63: return activityManager.getDefinedActivityIds();
64: }
65:
66: public Set getDefinedCategoryIds() {
67: return activityManager.getDefinedCategoryIds();
68: }
69:
70: public Set getEnabledActivityIds() {
71: return activityManager.getEnabledActivityIds();
72: }
73:
74: public IIdentifier getIdentifier(String identifierId) {
75: return activityManager.getIdentifier(identifierId);
76: }
77: }
|