*/
private void editProtectedItem()
{
ProtectedItemWrapper protectedItemWrapper = getSelectedProtectedItemWrapper();
AbstractDialogStringValueEditor valueEditor = protectedItemWrapper.getValueEditor();
if ( valueEditor != null )
{
if ( protectedItemWrapper.isMultivalued() )
{
MultiValuedDialog dialog = new MultiValuedDialog( getShell(), protectedItemWrapper.getDisplayName(),
protectedItemWrapper.getValues(), context, valueEditor );
dialog.open();
refreshTable();
}
else
{
List<String> values = protectedItemWrapper.getValues();
String oldValue = values.isEmpty() ? null : values.get( 0 );
if ( oldValue == null )
{
oldValue = ""; //$NON-NLS-1$
}
try
{
IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
IValue value = new Value( attribute, oldValue ); //$NON-NLS-1$
Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
CellEditor cellEditor = valueEditor.getCellEditor();
cellEditor.setValue( oldRawValue );
cellEditor.activate();
Object newRawValue = cellEditor.getValue();
if ( newRawValue != null )
{
String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
values.clear();
values.add( newValue );
tableViewer.refresh();
}