throws CoreException
{
LdifRecord[] records = getLdifModel().getRecords();
if ( records.length != 1 || !( records[0] instanceof LdifContentRecord ) )
{
throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, Messages
.getString( "LdifEntryEditorDocumentProvider.InvalidRecordType" ) ) ); //$NON-NLS-1$
}
if ( !records[0].isValid() )
{
throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, NLS.bind( Messages
.getString( "LdifEntryEditorDocumentProvider.InvalidLdif" ), records[0].getInvalidString() ) ) ); //$NON-NLS-1$
}
for ( LdifContainer ldifContainer : getLdifModel().getContainers() )
{
if ( ldifContainer instanceof LdifInvalidContainer )
{
LdifInvalidContainer cont = ( LdifInvalidContainer ) ldifContainer;
throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, NLS.bind( Messages
.getString( "LdifEntryEditorDocumentProvider.InvalidLdif" ), cont.getInvalidString() ) ) ); //$NON-NLS-1$
}
}
EntryEditorInput input = getEntryEditorInput( element );
try
{
LdapDN newDN = new LdapDN( records[0].getDnLine().getValueAsString() );
if ( !newDN.equals( input.getResolvedEntry().getDn() ) )
{
throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, NLS.bind( Messages
.getString( "LdifEntryEditorDocumentProvider.ModDnNotSupported" ), records[0].getInvalidString() ) ) ); //$NON-NLS-1$
}
}
catch ( InvalidNameException e )
{
throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID, Messages
.getString( "LdifEntryEditorDocumentProvider.InvalidDN" ) ) ); //$NON-NLS-1$
}
IStatus status = input.saveSharedWorkingCopy( false, editor );
if ( status != null && !status.isOK() )
{
BrowserUIPlugin.getDefault().getLog().log( status );
throw new CoreException( status );
}
}