1 package org
.spearce
.egit
.ui
.internal
.actions
;
3 import java
.util
.Iterator
;
5 import org
.eclipse
.core
.resources
.IProject
;
6 import org
.eclipse
.jface
.action
.IAction
;
7 import org
.eclipse
.jface
.viewers
.ISelection
;
8 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
9 import org
.eclipse
.team
.core
.RepositoryProvider
;
10 import org
.eclipse
.team
.core
.TeamException
;
11 import org
.eclipse
.ui
.IObjectActionDelegate
;
12 import org
.eclipse
.ui
.IWorkbenchPart
;
13 import org
.spearce
.egit
.ui
.GitUIPlugin
;
15 public class Disconnect
implements IObjectActionDelegate
{
16 private ISelection selection
;
18 public void selectionChanged(final IAction act
, final ISelection sel
) {
22 public void setActivePart(final IAction act
, final IWorkbenchPart part
) {
25 public void run(final IAction act
) {
26 if (selection
instanceof IStructuredSelection
&& !selection
.isEmpty()) {
27 final IStructuredSelection ssel
= (IStructuredSelection
) selection
;
28 final Iterator it
= ssel
.iterator();
29 while (it
.hasNext()) {
30 final IProject project
= (IProject
) it
.next();
32 RepositoryProvider
.unmap(project
);
33 } catch (TeamException err
) {
34 GitUIPlugin
.log("Unmap project " + project
.getName(), err
);