public Object execute(ExecutionEvent event) throws ExecutionException {
final IPath[] sel = getSelectedLocations(event);
if (sel.length == 0)
return null;
final RemoveFromIndexOperation removeOperation = new RemoveFromIndexOperation(Arrays.asList(sel));
Job job = new Job(UIText.RemoveFromIndexAction_removingFiles) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
removeOperation.execute(monitor);
} catch (CoreException e) {
return Activator.createErrorStatus(e.getStatus()
.getMessage(), e);
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
@Override
public boolean belongsTo(Object family) {
if (JobFamilies.REMOVE_FROM_INDEX.equals(family))
return true;
return super.belongsTo(family);
}
};
job.setUser(true);
job.setRule(removeOperation.getSchedulingRule());
job.schedule();
return null;
}