1 11 package org.eclipse.team.internal.ui.synchronize.actions; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.compare.structuremergeviewer.IDiffElement; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.team.internal.core.subscribers.WorkingSetFilteredSyncInfoCollector; 18 import org.eclipse.team.internal.ui.Utils; 19 import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantPage; 20 import org.eclipse.team.ui.synchronize.*; 21 22 public class RestoreRemovedItemsAction extends SynchronizeModelAction { 23 24 public RestoreRemovedItemsAction(ISynchronizePageConfiguration configuration) { 25 super(null, configuration); 26 Utils.initAction(this, "action.restoreRemovedFromView."); } 28 29 protected SynchronizeModelOperation getSubscriberOperation( 30 ISynchronizePageConfiguration configuration, IDiffElement[] elements) { 31 return new SynchronizeModelOperation(configuration, elements) { 32 public void run(IProgressMonitor monitor) throws InvocationTargetException , InterruptedException { 33 restoreRemovedItems(); 34 } 35 protected boolean canRunAsJob() { 36 return false; 37 } 38 42 private void restoreRemovedItems() { 43 ISynchronizePage page = getConfiguration().getPage(); 44 if (page instanceof SubscriberParticipantPage) { 45 WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector(); 46 collector.reset(); 47 } 48 } 49 }; 50 } 51 52 public boolean isEnabled(){ 53 return true; 54 } 55 56 59 protected boolean needsToSaveDirtyEditors() { 60 return false; 61 } 62 63 } | Popular Tags |