diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java index a23484157..838639e01 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java @@ -39,21 +39,21 @@ import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.ui.IWorkbenchPart; public class MergeWizard extends Wizard { - MergeWizardPage page; + MergeWizardPage page; IResource[] resources; - private final IWorkbenchPart part; - private final ResourceMapping[] mappings; - + private final IWorkbenchPart part; + private final ResourceMapping[] mappings; + public MergeWizard(IWorkbenchPart part, IResource[] resources, ResourceMapping[] mappings) { - this.part = part; - this.resources = resources; - this.mappings = mappings; - } + this.part = part; + this.resources = resources; + this.mappings = mappings; + } @Override public void addPages() { - setNeedsProgressMonitor(true); - TagSource tagSource = TagSource.create(resources); + setNeedsProgressMonitor(true); + TagSource tagSource = TagSource.create(resources); setWindowTitle(CVSUIMessages.MergeWizard_title); ImageDescriptor mergeImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE); page = new MergeWizardPage("mergePage", CVSUIMessages.MergeWizard_0, mergeImage, CVSUIMessages.MergeWizard_1, tagSource); //$NON-NLS-1$ @@ -67,21 +67,21 @@ public class MergeWizard extends Wizard { CVSTag endTag = page.getEndTag(); if (startTag == null || !page.isPreview()) { - // Perform the update (merge) in the background - UpdateOperation op = new UpdateOperation(getPart(), mappings, getLocalOptions(startTag, endTag), null); - try { - op.run(); - } catch (InvocationTargetException e) { - CVSUIPlugin.openError(getShell(), null, null, e); - } catch (InterruptedException e) { - // Ignore - } + // Perform the update (merge) in the background + UpdateOperation op = new UpdateOperation(getPart(), mappings, getLocalOptions(startTag, endTag), null); + try { + op.run(); + } catch (InvocationTargetException e) { + CVSUIPlugin.openError(getShell(), null, null, e); + } catch (InterruptedException e) { + // Ignore + } } else { if (isShowModelSync()) { ModelMergeParticipant participant = ModelMergeParticipant.getMatchingParticipant(mappings, startTag, endTag); if(participant == null) { - CVSMergeSubscriber s = new CVSMergeSubscriber(getProjects(resources), startTag, endTag, true); - try { + CVSMergeSubscriber s = new CVSMergeSubscriber(getProjects(resources), startTag, endTag, true); + try { new ModelMergeOperation(getPart(), mappings, s, page.isOnlyPreviewConflicts()).run(); } catch (InvocationTargetException e) { CVSUIPlugin.log(IStatus.ERROR, "Internal error", e.getTargetException()); //$NON-NLS-1$ @@ -93,12 +93,12 @@ public class MergeWizard extends Wizard { } } else { // First check if there is an existing matching participant, if so then re-use it - try { - resources = getAllResources(startTag, endTag); - } catch (InvocationTargetException e) { - // Log and continue with the original resources - CVSUIPlugin.log(IStatus.ERROR, "An error occurred while determining if extra resources should be included in the merge", e.getTargetException()); //$NON-NLS-1$ - } + try { + resources = getAllResources(startTag, endTag); + } catch (InvocationTargetException e) { + // Log and continue with the original resources + CVSUIPlugin.log(IStatus.ERROR, "An error occurred while determining if extra resources should be included in the merge", e.getTargetException()); //$NON-NLS-1$ + } MergeSynchronizeParticipant participant = MergeSynchronizeParticipant.getMatchingParticipant(resources, startTag, endTag); if(participant == null) { CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag, false); @@ -113,19 +113,19 @@ public class MergeWizard extends Wizard { } private IResource[] getAllResources(CVSTag startTag, CVSTag endTag) throws InvocationTargetException { - // Only do the extra work if the model is a logical model (i.e. not IResource) - if (!WorkspaceTraversalAction.isLogicalModel(mappings)) - return resources; - CVSMergeSubscriber s = new CVSMergeSubscriber(WorkspaceTraversalAction.getProjects(resources), startTag, endTag, false); - IResource[] allResources = WorkspaceTraversalAction.getResourcesToCompare(mappings, s); - s.cancel(); - return allResources; - } + // Only do the extra work if the model is a logical model (i.e. not IResource) + if (!WorkspaceTraversalAction.isLogicalModel(mappings)) + return resources; + CVSMergeSubscriber s = new CVSMergeSubscriber(WorkspaceTraversalAction.getProjects(resources), startTag, endTag, false); + IResource[] allResources = WorkspaceTraversalAction.getResourcesToCompare(mappings, s); + s.cancel(); + return allResources; + } - public static boolean isShowModelSync() { + public static boolean isShowModelSync() { return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC); } - + private IResource[] getProjects(IResource[] resources) { Set<IProject> projects = new HashSet<>(); for (int i = 0; i < resources.length; i++) { @@ -135,16 +135,16 @@ public class MergeWizard extends Wizard { return projects.toArray(new IResource[projects.size()]); } - private Command.LocalOption[] getLocalOptions(CVSTag startTag, CVSTag endTag) { + private Command.LocalOption[] getLocalOptions(CVSTag startTag, CVSTag endTag) { List<LocalOption> options = new ArrayList<>(); - if (startTag != null) { - options.add(Command.makeArgumentOption(Update.JOIN, startTag.getName())); - } - options.add(Command.makeArgumentOption(Update.JOIN, endTag.getName())); - return options.toArray(new Command.LocalOption[options.size()]); - } + if (startTag != null) { + options.add(Command.makeArgumentOption(Update.JOIN, startTag.getName())); + } + options.add(Command.makeArgumentOption(Update.JOIN, endTag.getName())); + return options.toArray(new Command.LocalOption[options.size()]); + } - private IWorkbenchPart getPart() { - return part; - } + private IWorkbenchPart getPart() { + return part; + } } |