1 11 package org.eclipse.team.internal.core; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.runtime.ListenerList; 15 import org.eclipse.team.core.RepositoryProvider; 16 17 public class RepositoryProviderManager implements IRepositoryProviderListener { 18 19 private static RepositoryProviderManager instance; 20 private ListenerList listeners = new ListenerList(); 21 22 public static synchronized RepositoryProviderManager getInstance() { 23 if (instance == null) { 24 instance = new RepositoryProviderManager(); 25 } 26 return instance; 27 } 28 29 32 public void providerMapped(RepositoryProvider provider) { 33 Object [] allListeners = listeners.getListeners(); 34 for (int i = 0; i < allListeners.length; i++) { 35 IRepositoryProviderListener listener = (IRepositoryProviderListener)allListeners[i]; 36 listener.providerMapped(provider); 37 } 38 } 39 40 43 public void providerUnmapped(IProject project) { 44 Object [] allListeners = listeners.getListeners(); 45 for (int i = 0; i < allListeners.length; i++) { 46 IRepositoryProviderListener listener = (IRepositoryProviderListener)allListeners[i]; 47 listener.providerUnmapped(project); 48 } 49 } 50 51 public void addListener(IRepositoryProviderListener listener) { 52 listeners.add(listener); 53 } 54 55 public void removeListener(IRepositoryProviderListener listener) { 56 listeners.remove(listener); 57 } 58 59 60 } 61 | Popular Tags |