{
ISelection sel = HandlerUtil.getCurrentSelection(event);
final ECPProject project = (ECPProject) ((StructuredSelection) sel).getFirstElement();
final Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
final ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell);
progressDialog.open();
progressDialog.getProgressMonitor().beginTask("Cleaning up project...", 10);
Callable<Void> call = new Callable<Void>()
{
@Override
public Void call() throws Exception
{
Activator.getAccessLayer().invalidateCache(project);
Activator.getProjectCleaner().cleanUpRuleOrphans(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().cleanUpLinkTypeOrphans(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().cleanUpViolationTypeOrphans(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().cleanUpChangeTypeOrphans(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().updateLinkTypeCatalogs(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().updateViolationTypeCatalogs(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().updateRuleCatalogs(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().updateChangeTypeCatalogs(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().updateLinkContainer(project);
progressDialog.getProgressMonitor().worked(1);
Activator.getProjectCleaner().updateReportContainer(project);
progressDialog.getProgressMonitor().worked(1);
return null;
}
};
RunESCommand.run(call);
progressDialog.getProgressMonitor().done();
progressDialog.close();
return null;
}