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( getNewId() );
// Default values
newPartition.setCacheSize( 100 );
newPartition.setEnableOptimizer( true );
newPartition.setSynchronizationOnWrite( true );
List<IndexedAttribute> indexedAttributes = new ArrayList<IndexedAttribute>();
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.1", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.2", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.3", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.4", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.5", 10 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.6", 10 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "1.3.6.1.4.1.18060.0.4.1.2.7", 10 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "dc", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "ou", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "krb5PrincipalName", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "uid", 100 ) ); //$NON-NLS-1$
indexedAttributes.add( new IndexedAttribute( "objectClass", 100 ) ); //$NON-NLS-1$
newPartition.setIndexedAttributes( indexedAttributes );
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();
}