{
StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
if ( !selection.isEmpty() )
{
MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
SWT.YES | SWT.NO | SWT.ICON_QUESTION );
int count = selection.size();
if ( count == 1 )
{
Object firstElement = selection.getFirstElement();
if ( firstElement instanceof AttributeTypeWrapper )
{
messageBox.setMessage( Messages.getString( "DeleteSchemaElementAction.SureToDeleteAttributeType" ) ); //$NON-NLS-1$
}
else if ( firstElement instanceof ObjectClassWrapper )
{
messageBox.setMessage( Messages.getString( "DeleteSchemaElementAction.SureToDeleteObjectClass" ) ); //$NON-NLS-1$
}
else if ( firstElement instanceof SchemaWrapper )
{
messageBox.setMessage( Messages.getString( "DeleteSchemaElementAction.SureToDeleteSchema" ) ); //$NON-NLS-1$
}
else
{
messageBox.setMessage( Messages.getString( "DeleteSchemaElementAction.SureToDeleteItem" ) ); //$NON-NLS-1$
}
}
else
{
messageBox.setMessage( NLS.bind(
Messages.getString( "DeleteSchemaElementAction.SureToDeleteItems" ), new Object[] { count } ) ); //$NON-NLS-1$
}
if ( messageBox.open() == SWT.YES )
{
Map<String, Schema> schemasMap = new HashMap<String, Schema>();
List<SchemaObject> schemaObjectsList = new ArrayList<SchemaObject>();