1 11 package org.eclipse.team.internal.ccvs.ui.mappings; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.runtime.IProgressMonitor; 16 import org.eclipse.team.core.mapping.ISynchronizationScopeManager; 17 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; 18 import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; 19 import org.eclipse.team.ui.synchronize.ModelParticipantMergeOperation; 20 import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant; 21 import org.eclipse.ui.IWorkbenchPart; 22 23 public abstract class AbstractModelMergeOperation extends ModelParticipantMergeOperation { 24 25 private boolean ownsManager = false; 26 27 public AbstractModelMergeOperation(IWorkbenchPart part, ISynchronizationScopeManager manager, boolean ownsManager) { 28 super(part, manager); 29 this.ownsManager = ownsManager; 30 } 31 32 35 protected boolean canRunAsJob() { 36 return true; 37 } 38 39 42 protected boolean isPreviewInDialog() { 43 return CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PREVIEW).equals(ICVSUIConstants.PREF_UPDATE_PREVIEW_IN_DIALOG); 44 } 45 46 protected void endOperation(IProgressMonitor monitor) throws InvocationTargetException { 47 if (ownsManager) { 48 ISynchronizationScopeManager manager = getScopeManager(); 49 manager.dispose(); 50 } 51 super.endOperation(monitor); 52 } 53 54 protected ModelSynchronizeParticipant createParticipant() { 55 ModelSynchronizeParticipant participant = super.createParticipant(); 56 setOwnsManager(false); 58 return participant; 59 } 60 61 public boolean isOwnsManager() { 62 return ownsManager; 63 } 64 65 public void setOwnsManager(boolean ownsManager) { 66 this.ownsManager = ownsManager; 67 } 68 69 } 70 | Popular Tags |