Rdn rdn = dnBuilderWidget.getRdn();
LdapDN parentDn = dnBuilderWidget.getParentDn();
final LdapDN dn = DnUtils.composeDn( rdn, parentDn );
// check if parent exists
ReadEntryRunnable readEntryRunnable1 = new ReadEntryRunnable( wizard.getSelectedConnection(), parentDn );
RunnableContextRunner.execute( readEntryRunnable1, getContainer(), false );
IEntry parentEntry = readEntryRunnable1.getReadEntry();
if ( parentEntry == null )
{
getShell().getDisplay().syncExec( new Runnable()
{
public void run()
{
MessageDialog.openError( getShell(), "Error", "Parent "
+ dnBuilderWidget.getParentDn().toString() + " doesn't exists" );
}
} );
return null;
}
// check that new entry does not exists yet
ReadEntryRunnable readEntryRunnable2 = new ReadEntryRunnable( wizard.getSelectedConnection(), dn );
RunnableContextRunner.execute( readEntryRunnable2, getContainer(), false );
IEntry entry = readEntryRunnable2.getReadEntry();
if ( entry != null )
{
getShell().getDisplay().syncExec( new Runnable()
{
public void run()
{
MessageDialog.openError( getShell(), "Error", "Entry " + dn.toString() + " already exists" );
}
} );
return null;
}
}
else
{
try
{
final LdapDN dn = new LdapDN( contextEntryDnCombo.getText() );
// check that new entry does not exists yet
ReadEntryRunnable readEntryRunnable2 = new ReadEntryRunnable( wizard.getSelectedConnection(), dn );
RunnableContextRunner.execute( readEntryRunnable2, getContainer(), false );
IEntry entry = readEntryRunnable2.getReadEntry();
if ( entry != null )
{
getShell().getDisplay().syncExec( new Runnable()
{
public void run()