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( NLS
.bind(
Messages.getString( "DeleteProjectAction.SureToDeleteProject" ), new String[] { wrapper.getProject().getName() } ) ); //$NON-NLS-1$
}
else
{
messageBox.setMessage( NLS.bind(
Messages.getString( "DeleteProjectAction.SureToDeleteProjects" ), new Object[] { count } ) ); //$NON-NLS-1$
}
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 );