MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
SWT.YES | SWT.NO | SWT.ICON_QUESTION );
int count = selection.size();
if ( count == 1 )
{
ProjectWrapper wrapper = ( ProjectWrapper ) selection.getFirstElement();
messageBox.setMessage( "Are you sure you want to delete project '" + wrapper.getProject().getName()
+ "'?" );
}
else
{
messageBox.setMessage( "Are you sure you want to delete these " + count + " projects?" );
}
if ( messageBox.open() == SWT.YES )
{
for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext(); )
{
ProjectWrapper wrapper = ( ProjectWrapper ) iterator.next();
Project project = wrapper.getProject();
if ( project.getState() == ProjectState.OPEN )
{
// Closing the project before removing it.
projectsHandler.closeProject( project );