1 11 12 package org.eclipse.ui.internal.activities; 13 14 import java.util.Set ; 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 (); 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 activityId) { 56 return activityManager.getActivity(activityId); 57 } 58 59 public ICategory getCategory(String categoryId) { 60 return activityManager.getCategory(categoryId); 61 } 62 63 public Set getDefinedActivityIds() { 64 return activityManager.getDefinedActivityIds(); 65 } 66 67 public Set getDefinedCategoryIds() { 68 return activityManager.getDefinedCategoryIds(); 69 } 70 71 public Set getEnabledActivityIds() { 72 return activityManager.getEnabledActivityIds(); 73 } 74 75 public IIdentifier getIdentifier(String identifierId) { 76 return activityManager.getIdentifier(identifierId); 77 } 78 } 79 | Popular Tags |