1 11 package org.eclipse.team.internal.core.subscribers; 12 13 import org.eclipse.core.resources.IWorkspaceRunnable; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener; 16 import org.eclipse.team.core.synchronize.SyncInfoTree; 17 import org.eclipse.team.internal.core.Policy; 18 19 33 public class SubscriberSyncInfoSet extends SyncInfoTree { 34 35 protected SubscriberEventHandler handler; 36 37 public SubscriberSyncInfoSet(SubscriberEventHandler handler) { 38 this.handler = handler; 39 } 40 41 44 public void connect(ISyncInfoSetChangeListener listener, IProgressMonitor monitor) { 45 if (handler == null) { 46 super.connect(listener, monitor); 47 } else { 48 connect(listener); 49 } 50 } 51 52 58 public void connect(final ISyncInfoSetChangeListener listener) { 59 if (handler == null) { 60 throw new UnsupportedOperationException (); 62 } else { 63 handler.run(new IWorkspaceRunnable() { 64 public void run(IProgressMonitor monitor) { 65 try { 66 beginInput(); 67 monitor.beginTask(null, 100); 68 removeSyncSetChangedListener(listener); 69 addSyncSetChangedListener(listener); 70 listener.syncInfoSetReset(SubscriberSyncInfoSet.this, Policy.subMonitorFor(monitor, 95)); 71 } finally { 72 endInput(Policy.subMonitorFor(monitor, 5)); 73 monitor.done(); 74 } 75 } 76 }, true ); 77 } 78 } 79 } 80 | Popular Tags |