Search in sources :

Example 1 with UnlockResourcesCommand

use of org.tigris.subversion.subclipse.core.commands.UnlockResourcesCommand in project subclipse by subclipse.

the class UnlockAction 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();
            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();
                            UnlockResourcesCommand command = new UnlockResourcesCommand(provider.getSVNWorkspaceRoot(), resources, false);
                            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) UnlockResourcesCommand(org.tigris.subversion.subclipse.core.commands.UnlockResourcesCommand) 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) Iterator(java.util.Iterator) IResource(org.eclipse.core.resources.IResource)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 IResource (org.eclipse.core.resources.IResource)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 TeamException (org.eclipse.team.core.TeamException)1 WorkspaceModifyOperation (org.eclipse.ui.actions.WorkspaceModifyOperation)1 SVNTeamProvider (org.tigris.subversion.subclipse.core.SVNTeamProvider)1 UnlockResourcesCommand (org.tigris.subversion.subclipse.core.commands.UnlockResourcesCommand)1