{
LdifPart[] parts = getSelectedLdifParts();
if ( parts.length == 1 && ( parts[0] instanceof LdifValueLineBase ) )
{
LdifValueLineBase line = ( LdifValueLineBase ) parts[0];
String attributeDescription = getAttributeDescription();
Object rawValue = getValueEditorRawValue();
if ( valueEditor instanceof AbstractDialogValueEditor )
{
AbstractDialogValueEditor cellEditor = ( AbstractDialogValueEditor ) valueEditor;
cellEditor.setValue( rawValue );
cellEditor.activate();
Object newValue = cellEditor.getValue();
if ( newValue != null && newValue instanceof String || newValue instanceof byte[] )
{
IDocument document = editor.getDocumentProvider().getDocument( editor.getEditorInput() );
LdifValueLineBase newLine;
if ( line instanceof LdifControlLine )
{
LdifControlLine oldControlLine = ( LdifControlLine ) line;
if ( newValue instanceof String )
{
newLine = LdifControlLine.create( oldControlLine.getUnfoldedOid(), oldControlLine
.getUnfoldedCriticality(), ( String ) newValue );
}
else
{
newLine = LdifControlLine.create( oldControlLine.getUnfoldedOid(), oldControlLine
.getUnfoldedCriticality(), ( byte[] ) newValue );
}
}
else
{
if ( newValue instanceof String )
{
newLine = LdifAttrValLine.create( attributeDescription, ( String ) newValue );
}
else
{
newLine = LdifAttrValLine.create( attributeDescription, ( byte[] ) newValue );
}
}
try
{
document.replace( line.getOffset(), line.getLength(), newLine.toFormattedString( Utils
.getLdifFormatParameters() ) );
}
catch ( BadLocationException e )
{
e.printStackTrace();