Search in sources :

Example 16 with SvnWizard

use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard in project subclipse by subclipse.

the class RevertAction method confirmRevert.

/**
 * prompt revert of selected resources.
 */
protected boolean confirmRevert(IResource[] modifiedResources) {
    if (modifiedResources.length == 0) {
        if (showNothingToRevertMessage) {
            MessageDialog.openInformation(Display.getDefault().getActiveShell(), Policy.bind("RevertAction.0"), // $NON-NLS-1$ //$NON-NLS-2$
            Policy.bind("RevertAction.1"));
        }
        return false;
    }
    revertPage = new SvnWizardRevertPage(modifiedResources, url, statusMap, false);
    revertPage.setResourceRemoved(resourcesHidden);
    SvnWizard wizard = new SvnWizard(revertPage);
    SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
    boolean revert = (dialog.open() == SvnWizardDialog.OK);
    url = null;
    resourcesToRevert = revertPage.getSelectedResources();
    return revert;
}
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)

Example 17 with SvnWizard

use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard in project subclipse by subclipse.

the class LockAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        if (getSelectedResources() != null && getSelectedResources().length > 0) {
            final IResource[] resources = getSelectedResources();
            SvnWizardLockPage lockPage = new SvnWizardLockPage(resources);
            SvnWizard wizard = new SvnWizard(lockPage);
            SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
            wizard.setParentDialog(dialog);
            if (dialog.open() == SvnWizardDialog.OK) {
                final String comment = lockPage.getComment();
                final boolean stealLock = lockPage.isStealLock();
                run(new WorkspaceModifyOperation() {

                    protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
                        try {
                            Hashtable table = getProviderMapping(getSelectedResources());
                            Set keySet = table.keySet();
                            Iterator iterator = keySet.iterator();
                            while (iterator.hasNext()) {
                                SVNTeamProvider provider = (SVNTeamProvider) iterator.next();
                                LockResourcesCommand command = new LockResourcesCommand(provider.getSVNWorkspaceRoot(), resources, stealLock, comment);
                                command.run(Policy.subMonitorFor(monitor, 1000));
                            }
                        } catch (TeamException e) {
                            throw new InvocationTargetException(e);
                        } finally {
                            monitor.done();
                        }
                    }
                }, true, /* cancelable */
                PROGRESS_DIALOG);
            }
        }
    }
}
Also used : Set(java.util.Set) WorkspaceModifyOperation(org.eclipse.ui.actions.WorkspaceModifyOperation) Hashtable(java.util.Hashtable) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SvnWizardLockPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardLockPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) SVNTeamProvider(org.tigris.subversion.subclipse.core.SVNTeamProvider) CoreException(org.eclipse.core.runtime.CoreException) LockResourcesCommand(org.tigris.subversion.subclipse.core.commands.LockResourcesCommand) Iterator(java.util.Iterator) IResource(org.eclipse.core.resources.IResource)

Aggregations

SvnWizard (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard)17 SvnWizardDialog (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog)17 IResource (org.eclipse.core.resources.IResource)9 SVNException (org.tigris.subversion.subclipse.core.SVNException)7 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IContainer (org.eclipse.core.resources.IContainer)4 CoreException (org.eclipse.core.runtime.CoreException)4 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)4 Action (org.eclipse.jface.action.Action)3 TeamException (org.eclipse.team.core.TeamException)3 Iterator (java.util.Iterator)2 IFile (org.eclipse.core.resources.IFile)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 WorkspaceModifyOperation (org.eclipse.ui.actions.WorkspaceModifyOperation)2 ISVNRemoteFile (org.tigris.subversion.subclipse.core.ISVNRemoteFile)2 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)2