Search in sources :

Example 1 with SVNConflictResolver

use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.

the class SwitchOperation method execute.

protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
    monitor.beginTask("Switch to Branch/Tag", resources.length);
    try {
        final List<IProject> projectList = new ArrayList<IProject>();
        for (int i = 0; i < resources.length; i++) {
            monitor.subTask("Switching " + resources[i].getName() + ". . .");
            SVNUrl svnUrl = (SVNUrl) urlMap.get(resources[i]);
            if (conflictResolver != null && conflictResolver instanceof SVNConflictResolver) {
                ((SVNConflictResolver) conflictResolver).setPart(getPart());
            }
            SVNWorkspaceSubscriber.getInstance().updateRemote(resources);
            SwitchToUrlCommand command = new SwitchToUrlCommand(provider.getSVNWorkspaceRoot(), resources[i], svnUrl, svnRevision);
            command.setDepth(depth);
            command.setSetDepth(setDepth);
            command.setIgnoreExternals(ignoreExternals);
            command.setForce(force);
            command.setIgnoreAncestry(ignoreAncestry);
            command.setConflictResolver(conflictResolver);
            command.run(monitor);
            monitor.worked(1);
            if (resources[i].getProject() != null && !projectList.contains(resources[i].getProject())) {
                projectList.add(resources[i].getProject());
            }
        }
        // Trigger lightweight refresh of decorators for project.  This is needed because refreshLocal
        // is not triggering a refresh for unchanged
        // resources in Project Explorer.
        Display.getDefault().asyncExec(new Runnable() {

            public void run() {
                SVNLightweightDecorator decorator = (SVNLightweightDecorator) SVNUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getBaseLabelProvider(SVNUIPlugin.DECORATOR_ID);
                for (IProject project : projectList) {
                    decorator.refresh(project);
                }
            }
        });
    } catch (SVNException e) {
        if (e.operationInterrupted()) {
            showCancelledMessage();
        } else {
            collectStatus(e.getStatus());
        }
    } catch (TeamException e) {
        collectStatus(e.getStatus());
    } finally {
        monitor.done();
    }
}
Also used : TeamException(org.eclipse.team.core.TeamException) SwitchToUrlCommand(org.tigris.subversion.subclipse.core.commands.SwitchToUrlCommand) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ArrayList(java.util.ArrayList) SVNException(org.tigris.subversion.subclipse.core.SVNException) IProject(org.eclipse.core.resources.IProject) ISVNConflictResolver(org.tigris.subversion.svnclientadapter.ISVNConflictResolver) SVNConflictResolver(org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver) SVNLightweightDecorator(org.tigris.subversion.subclipse.ui.decorator.SVNLightweightDecorator)

Example 2 with SVNConflictResolver

use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.

the class SvnWizardSwitchPage method performFinish.

public boolean performFinish() {
    try {
        if (showUrl) {
            urlCombo.saveUrl();
            if (urlStrings.length > 1) {
                urls = new SVNUrl[switchResources.length];
                for (int i = 0; i < switchResources.length; i++) {
                    if (// $NON-NLS-1$
                    urlCombo.getText().endsWith("/"))
                        urls[i] = new SVNUrl(urlCombo.getText() + switchResources[i].getPartialPath());
                    else
                        urls[i] = new SVNUrl(urlCombo.getText() + "/" + // $NON-NLS-1$
                        switchResources[i].getPartialPath());
                }
            } else {
                urls = new SVNUrl[1];
                urls[0] = new SVNUrl(urlCombo.getText());
            }
            if (headButton.getSelection())
                revision = SVNRevision.HEAD;
            else {
                try {
                    revision = SVNRevision.getRevision(revisionText.getText().trim());
                } catch (ParseException e1) {
                    MessageDialog.openError(getShell(), Policy.bind("SwitchDialog.title"), // $NON-NLS-1$ //$NON-NLS-2$
                    Policy.bind("SwitchDialog.invalid"));
                    return false;
                }
            }
        }
        setDepth = setDepthButton.getSelection();
        ignoreExternals = ignoreExternalsButton.getSelection();
        force = forceButton.getSelection();
        ignoreAncestry = ignoreAncestryButton.getSelection();
        depth = DepthComboHelper.getDepth(depthCombo);
        conflictResolver = new SVNConflictResolver(resources[0], getTextConflictHandling(), getBinaryConflictHandling(), getPropertyConflictHandling(), getTreeConflictHandling());
    } catch (MalformedURLException e) {
        MessageDialog.openError(getShell(), Policy.bind("SwitchDialog.title"), // $NON-NLS-1$
        e.getMessage());
        return false;
    }
    return true;
}
Also used : MalformedURLException(java.net.MalformedURLException) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ParseException(java.text.ParseException) SVNConflictResolver(org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver) ISVNConflictResolver(org.tigris.subversion.svnclientadapter.ISVNConflictResolver)

Example 3 with SVNConflictResolver

use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.

the class SvnWizardUpdatePage method performFinish.

public boolean performFinish() {
    if (headButton.getSelection())
        revision = SVNRevision.HEAD;
    else {
        try {
            revision = SVNRevision.getRevision(revisionText.getText().trim());
        } catch (ParseException e1) {
            MessageDialog.openError(getShell(), Policy.bind("UpdateDialog.title"), // $NON-NLS-1$ //$NON-NLS-2$
            Policy.bind("UpdateDialog.invalid"));
            return false;
        }
    }
    setDepth = setDepthButton.getSelection();
    ignoreExternals = ignoreExternalsButton.getSelection();
    force = forceButton.getSelection();
    depth = DepthComboHelper.getDepth(depthCombo);
    conflictResolver = new SVNConflictResolver(resources[0], getTextConflictHandling(), getBinaryConflictHandling(), getPropertyConflictHandling(), getTreeConflictHandling());
    return true;
}
Also used : ParseException(java.text.ParseException) SVNConflictResolver(org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver) ISVNConflictResolver(org.tigris.subversion.svnclientadapter.ISVNConflictResolver)

Example 4 with SVNConflictResolver

use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.

the class UpdateAction method execute.

/*
   * @see IActionDelegate#run(IAction)
   */
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        IPreferenceStore store = SVNUIPlugin.getPlugin().getPreferenceStore();
        IResource[] resources = getSelectedResources();
        SVNConflictResolver conflictResolver = new SVNConflictResolver(resources[0], store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_TEXT_FILES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_BINARY_FILES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_PROPERTIES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_TREE_CONFLICTS));
        UpdateOperation updateOperation = new UpdateOperation(getTargetPart(), resources, SVNRevision.HEAD);
        updateOperation.setDepth(depth);
        updateOperation.setSetDepth(setDepth);
        updateOperation.setForce(store.getBoolean(ISVNUIConstants.PREF_UPDATE_TO_HEAD_ALLOW_UNVERSIONED_OBSTRUCTIONS));
        updateOperation.setIgnoreExternals(store.getBoolean(ISVNUIConstants.PREF_UPDATE_TO_HEAD_IGNORE_EXTERNALS));
        updateOperation.setCanRunAsJob(canRunAsJob);
        updateOperation.setConflictResolver(conflictResolver);
        updateOperation.run();
    }
}
Also used : UpdateOperation(org.tigris.subversion.subclipse.ui.operations.UpdateOperation) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IResource(org.eclipse.core.resources.IResource) SVNConflictResolver(org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver)

Example 5 with SVNConflictResolver

use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.

the class UpdateSynchronizeOperation method doUpdate.

private void doUpdate(SVNTeamProvider provider, IProgressMonitor monitor, IResource[] resourceArray, SVNRevision revision) {
    try {
        SVNWorkspaceSubscriber.getInstance().updateRemote(resourceArray);
        if (changeSetSelected) {
            List<IResource> existingResources = new ArrayList<IResource>();
            for (IResource resource : resourceArray) {
                if (resource.exists()) {
                    existingResources.add(resource);
                } else {
                    UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), new IResource[] { resource }, revision);
                    command.setConflictResolver(new SVNConflictResolver());
                    command.run(Policy.subMonitorFor(monitor, 100));
                }
            }
            if (!existingResources.isEmpty()) {
                IResource[] existingResourceArray = new IResource[existingResources.size()];
                existingResources.toArray(existingResourceArray);
                UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), existingResourceArray, revision);
                command.setDepth(Depth.empty);
                command.setSetDepth(false);
                command.setConflictResolver(new SVNConflictResolver());
                command.run(Policy.subMonitorFor(monitor, 100));
            }
        } else {
            UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), resourceArray, revision);
            command.setConflictResolver(new SVNConflictResolver());
            command.run(Policy.subMonitorFor(monitor, 100));
        }
    } catch (SVNException e) {
        if (!e.operationInterrupted()) {
            collectStatus(e.getStatus());
        }
    } catch (TeamException e) {
        collectStatus(e.getStatus());
    } finally {
        monitor.done();
    }
}
Also used : TeamException(org.eclipse.team.core.TeamException) ArrayList(java.util.ArrayList) UpdateResourcesCommand(org.tigris.subversion.subclipse.core.commands.UpdateResourcesCommand) SVNException(org.tigris.subversion.subclipse.core.SVNException) IResource(org.eclipse.core.resources.IResource) SVNConflictResolver(org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver)

Aggregations

SVNConflictResolver (org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver)7 TeamException (org.eclipse.team.core.TeamException)4 SVNException (org.tigris.subversion.subclipse.core.SVNException)4 ISVNConflictResolver (org.tigris.subversion.svnclientadapter.ISVNConflictResolver)4 ArrayList (java.util.ArrayList)3 IResource (org.eclipse.core.resources.IResource)3 UpdateResourcesCommand (org.tigris.subversion.subclipse.core.commands.UpdateResourcesCommand)3 ParseException (java.text.ParseException)2 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)2 MalformedURLException (java.net.MalformedURLException)1 IProject (org.eclipse.core.resources.IProject)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 RevertResourcesCommand (org.tigris.subversion.subclipse.core.commands.RevertResourcesCommand)1 SwitchToUrlCommand (org.tigris.subversion.subclipse.core.commands.SwitchToUrlCommand)1 SVNLightweightDecorator (org.tigris.subversion.subclipse.ui.decorator.SVNLightweightDecorator)1 UpdateOperation (org.tigris.subversion.subclipse.ui.operations.UpdateOperation)1 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)1