deleteButton.setEnabled( !event.getSelection().isEmpty() );
StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
if ( !selection.isEmpty() )
{
Partition partition = ( Partition ) selection.getFirstElement();
if ( partition.isSystemPartition() )
{
deleteButton.setEnabled( false );
}
}
}
} );
addButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
{
Partition newPartition = new Partition( getNewName() );
partitions.add( newPartition );
viewer.refresh();
viewer.setSelection( new StructuredSelection( newPartition ) );
setEditorDirty();
}
} );
deleteButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
{
StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
if ( !selection.isEmpty() )
{
Partition partition = ( Partition ) selection.getFirstElement();
if ( !partition.isSystemPartition() )
{
partitions.remove( partition );
viewer.refresh();
setEditorDirty();
}