@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); IProject[] selectedProjects = getSelectedProjects(selection); Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); for (IProject project : selectedProjects) { if (repository.isConnected(project)) { repository.removeProject(project); } } return null; }
@Override public void setEnabled(Object evaluationContext) { if (evaluationContext instanceof IEvaluationContext) { IEvaluationContext evalContext = (IEvaluationContext) evaluationContext; Object selection = evalContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME); if (selection instanceof ISelection) { IProject[] selectedProjects = getSelectedProjects((ISelection) selection); Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); for (IProject project : selectedProjects) { if (repository.isConnected(project)) { setBaseEnabled(true); return; } } } } setBaseEnabled(false); }