Search in sources :

Example 1 with RevertOperation

use of org.tigris.subversion.subclipse.ui.operations.RevertOperation in project subclipse by subclipse.

the class RevertSynchronizeOperation method run.

protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    if (prompted)
        return;
    prompted = true;
    getShell().getDisplay().syncExec(new Runnable() {

        public void run() {
            if (resources == null || resources.length == 0) {
                revert = false;
                return;
            }
            revertPage = new SvnWizardRevertPage(resources, url, statusMap, true);
            revertPage.setResourceRemoved(SVNProviderPlugin.getPlugin().getPluginPreferences().getBoolean(ISVNCoreConstants.PREF_IGNORE_HIDDEN_CHANGES));
            SvnWizard wizard = new SvnWizard(revertPage);
            SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
            revert = (dialog.open() == SvnWizardDialog.OK);
            if (revert)
                resourcesToRevert = revertPage.getSelectedResources();
        }
    });
    if (revert) {
        boolean includesExternals = false;
        if (revertPage != null && !revertPage.isResourceRemoved()) {
            for (IResource resource : resourcesToRevert) {
                if (isExternal(resource)) {
                    includesExternals = true;
                    break;
                }
            }
        }
        RevertOperation revertOperation = null;
        if (revertPage != null && !revertPage.isResourceRemoved() && !includesExternals) {
            revertOperation = new RevertOperation(getPart(), selectedResources);
            revertOperation.setRecurse(true);
            revertOperation.setResourcesToRevert(resourcesToRevert);
        } else {
            revertOperation = new RevertOperation(getPart(), resourcesToRevert);
        }
        revertOperation.run();
    }
}
Also used : SvnWizardRevertPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardRevertPage) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) RevertOperation(org.tigris.subversion.subclipse.ui.operations.RevertOperation) IResource(org.eclipse.core.resources.IResource)

Example 2 with RevertOperation

use of org.tigris.subversion.subclipse.ui.operations.RevertOperation in project subclipse by subclipse.

the class RevertAction method execute.

protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
    statusMap = new HashMap();
    includesExternals = false;
    resourcesHidden = false;
    final IResource[] resources = getSelectedResources();
    try {
        IResource[] modifiedResources = getModifiedResources(resources, new NullProgressMonitor());
        if (!confirmRevert(modifiedResources))
            return;
        RevertOperation revertOperation = null;
        if (revertPage != null && !revertPage.isResourceRemoved() && !includesExternals) {
            revertOperation = new RevertOperation(getTargetPart(), resources);
            revertOperation.setRecurse(true);
            revertOperation.setResourcesToRevert(resourcesToRevert);
        } else {
            revertOperation = new RevertOperation(getTargetPart(), resourcesToRevert);
        }
        revertOperation.setCanRunAsJob(canRunAsJob);
        revertOperation.run();
    } catch (SVNException e) {
        if (!e.operationInterrupted()) {
            throw new InvocationTargetException(e);
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) HashMap(java.util.HashMap) SVNException(org.tigris.subversion.subclipse.core.SVNException) RevertOperation(org.tigris.subversion.subclipse.ui.operations.RevertOperation) IResource(org.eclipse.core.resources.IResource) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IResource (org.eclipse.core.resources.IResource)2 RevertOperation (org.tigris.subversion.subclipse.ui.operations.RevertOperation)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 SvnWizard (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard)1 SvnWizardDialog (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog)1 SvnWizardRevertPage (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardRevertPage)1