1 11 12 package org.eclipse.ui.internal.contexts; 13 14 import java.util.SortedSet ; 15 16 import org.eclipse.ui.contexts.ContextManagerEvent; 17 import org.eclipse.ui.contexts.IContext; 18 import org.eclipse.ui.contexts.IContextManager; 19 import org.eclipse.ui.contexts.IContextManagerListener; 20 21 public final class ProxyContextManager extends AbstractContextManager { 22 private IContextManager contextManager; 23 24 public ProxyContextManager(IContextManager contextManager) { 25 if (contextManager == null) 26 throw new NullPointerException (); 27 28 this.contextManager = contextManager; 29 30 this 31 .contextManager 32 .addContextManagerListener(new IContextManagerListener() { 33 public void contextManagerChanged(ContextManagerEvent contextManagerEvent) { 34 ContextManagerEvent proxyContextManagerEvent = 35 new ContextManagerEvent( 36 ProxyContextManager.this, 37 contextManagerEvent.haveDefinedContextIdsChanged(), 38 contextManagerEvent.haveEnabledContextIdsChanged(), 39 contextManagerEvent.getPreviouslyDefinedContextIds(), 40 contextManagerEvent.getPreviouslyEnabledContextIds()); 41 fireContextManagerChanged(proxyContextManagerEvent); 42 } 43 }); 44 } 45 46 public IContext getContext(String contextId) { 47 return contextManager.getContext(contextId); 48 } 49 50 public SortedSet getDefinedContextIds() { 51 return contextManager.getDefinedContextIds(); 52 } 53 54 public SortedSet getEnabledContextIds() { 55 return contextManager.getEnabledContextIds(); 56 } 57 } 58 | Popular Tags |