You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2009/02/08 17:52:11 UTC
svn commit: r742128 - in /directory/studio/trunk:
ldapbrowser-common/resources/icons/
ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/
ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widge...
Author: seelmann
Date: Sun Feb 8 16:52:10 2009
New Revision: 742128
URL: http://svn.apache.org/viewvc?rev=742128&view=rev
Log:
DIRSTUDIO-234, DIRSTUDIO-457, DIRSTUDIO-115: Enabled edit actions for all attributes. Added warning message when trying to edit non-modifiable attributes.
Added:
directory/studio/trunk/ldapbrowser-common/resources/icons/rename.gif (with props)
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/RenameValueEditor.java
Modified:
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages.properties
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages_de.properties
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages.properties
directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages_de.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/OpenBestEditorAction.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages_de.properties
Added: directory/studio/trunk/ldapbrowser-common/resources/icons/rename.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/resources/icons/rename.gif?rev=742128&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/rename.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java Sun Feb 8 16:52:10 2009
@@ -168,6 +168,7 @@
public static final String IMG_TOP = "resources/icons/top.gif"; //$NON-NLS-1$
public static final String IMG_NEXT = "resources/icons/next.gif"; //$NON-NLS-1$
public static final String IMG_PREVIOUS = "resources/icons/previous.gif"; //$NON-NLS-1$
+ public static final String IMG_RENAME = "resources/icons/rename.gif"; //$NON-NLS-1$
public static final String CMD_ADD_ATTRIBUTE = BrowserCommonActivator.getDefault().getPluginProperties().getString(
"Cmd_AddAttribute_id" ); //$NON-NLS-1$
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java Sun Feb 8 16:52:10 2009
@@ -130,7 +130,7 @@
openBestValueEditorActionProxy = new EntryEditorActionProxy( viewer, new OpenBestEditorAction( viewer,
configuration.getValueEditorManager( viewer ), this ) );
openDefaultValueEditorActionProxy = new EntryEditorActionProxy( viewer, new OpenDefaultEditorAction( viewer,
- openBestValueEditorActionProxy, false ) );
+ openBestValueEditorActionProxy ) );
IValueEditor[] valueEditors = configuration.getValueEditorManager( viewer ).getAllValueEditors();
openValueEditorActionProxies = new EntryEditorActionProxy[valueEditors.length];
for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java Sun Feb 8 16:52:10 2009
@@ -22,7 +22,6 @@
import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
import org.apache.directory.studio.valueeditors.ValueEditorManager;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.swt.widgets.Item;
@@ -71,14 +70,6 @@
{
IValue attributeValue = ( IValue ) element;
- if ( !SchemaUtils.isModifiable( attributeValue.getAttribute().getAttributeTypeDescription() ) )
- {
- return false;
- }
- if ( attributeValue.isRdnPart() )
- {
- return false;
- }
if ( EntryEditorWidgetTableMetadata.KEY_COLUMN_NAME.equals( property ) )
{
return false;
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java Sun Feb 8 16:52:10 2009
@@ -21,10 +21,15 @@
package org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
import org.apache.directory.studio.valueeditors.IValueEditor;
import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osgi.util.NLS;
/**
@@ -123,5 +128,38 @@
return false;
}
}
+
+ @Override
+ public void run()
+ {
+ boolean ok = true;
+
+ // validate non-modifiable attributes
+ if ( getSelectedValues().length == 1 && getSelectedAttributes().length == 0 )
+ {
+ IValue value = getSelectedValues()[0];
+ StringBuffer message = new StringBuffer();
+ if ( !value.isEmpty() && !SchemaUtils.isModifiable( value.getAttribute().getAttributeTypeDescription() ) )
+ {
+ message
+ .append( NLS
+ .bind(
+ Messages.getString( "OpenBestEditorAction.EditValueNotModifiable" ), value.getAttribute().getDescription() ) ); //$NON-NLS-1$
+ message.append( BrowserCoreConstants.LINE_SEPARATOR );
+ message.append( BrowserCoreConstants.LINE_SEPARATOR );
+ }
+
+ if ( message.length() > 0 )
+ {
+ message.append( Messages.getString( "OpenBestEditorAction.EditValueQuestion" ) ); //$NON-NLS-1$
+ ok = MessageDialog.openConfirm( getShell(), getText(), message.toString() );
+ }
+ }
+
+ if ( ok )
+ {
+ super.run();
+ }
+ }
}
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java Sun Feb 8 16:52:10 2009
@@ -23,7 +23,6 @@
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
-import org.apache.directory.studio.ldapbrowser.common.actions.RenameAction;
import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreeViewer;
@@ -43,9 +42,6 @@
/** The best value editor proxy. */
private EntryEditorActionProxy bestValueEditorProxy;
- /** The rename proxy. */
- private EntryEditorActionProxy renameProxy;
-
/**
* Creates a new instance of OpenDefaultEditorAction.
@@ -54,11 +50,9 @@
* @param bestValueEditorProxy the best value editor proxy
* @param enableRenameAction true to enable rename action
*/
- public OpenDefaultEditorAction( TreeViewer viewer, EntryEditorActionProxy bestValueEditorProxy,
- boolean enableRenameAction )
+ public OpenDefaultEditorAction( TreeViewer viewer, EntryEditorActionProxy bestValueEditorProxy )
{
this.bestValueEditorProxy = bestValueEditorProxy;
- this.renameProxy = enableRenameAction ? new EntryEditorActionProxy( viewer, new RenameAction() ) : null;
}
@@ -68,8 +62,6 @@
public void dispose()
{
bestValueEditorProxy = null;
- renameProxy = null;
-
super.dispose();
}
@@ -92,10 +84,6 @@
{
return bestValueEditorProxy.getImageDescriptor();
}
- else if ( renameProxy != null )
- {
- return renameProxy.getImageDescriptor();
- }
else
{
return null;
@@ -108,7 +96,7 @@
*/
public String getText()
{
- return Messages.getString("OpenDefaultEditorAction.EditValue"); //$NON-NLS-1$
+ return Messages.getString( "OpenDefaultEditorAction.EditValue" ); //$NON-NLS-1$
}
@@ -117,15 +105,7 @@
*/
public boolean isEnabled()
{
- if ( bestValueEditorProxy != null && renameProxy != null )
- {
- return bestValueEditorProxy.isEnabled() || renameProxy.isEnabled();
- }
- else if ( renameProxy != null )
- {
- return renameProxy.isEnabled();
- }
- else if ( bestValueEditorProxy != null )
+ if ( bestValueEditorProxy != null )
{
return bestValueEditorProxy.isEnabled();
}
@@ -145,10 +125,6 @@
{
bestValueEditorProxy.run();
}
- else if ( renameProxy != null && renameProxy.isEnabled() )
- {
- renameProxy.run();
- }
}
}
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages.properties?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages.properties (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages.properties Sun Feb 8 16:52:10 2009
@@ -35,6 +35,8 @@
EntryEditorWidgetSorterDialog.Value=Value
EntryEditorWidgetTableMetadata.AttributeDescription=Attribute Description
EntryEditorWidgetTableMetadata.Value=Value
+OpenBestEditorAction.EditValueNotModifiable=Warning\! According to the schema attribute {0} is not modifiable\!
+OpenBestEditorAction.EditValueQuestion=Do you still want to edit this value?
OpenDefaultEditorAction.EditValue=Edit Value
OpenSortDialogAction.Sorting=Sorting...
ShowQuickFilterAction.ShowQuickFilter=Show Quick Filter
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages_de.properties?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/messages_de.properties Sun Feb 8 16:52:10 2009
@@ -35,6 +35,8 @@
EntryEditorWidgetSorterDialog.Value=Wert
EntryEditorWidgetTableMetadata.AttributeDescription=Attributbeschreibung
EntryEditorWidgetTableMetadata.Value=Wert
+OpenBestEditorAction.EditValueNotModifiable=Warnung\! Gemäß dem Schema ist das Attribut {0} nicht änderbar\!
+OpenBestEditorAction.EditValueQuestion=Wollen Sie trotzem den Wert bearbeiten?
OpenDefaultEditorAction.EditValue=Wert bearbeiten
OpenSortDialogAction.Sorting=Sortierung...
ShowQuickFilterAction.ShowQuickFilter=Schnell-Filer anzeigen
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java Sun Feb 8 16:52:10 2009
@@ -125,7 +125,7 @@
/**
* {@inheritDoc}
*
- * Opens the MulitvaluedDialog. Expects that an AttributeHierarchy
+ * Opens the EditEntryWizard. Expects that an IEntry
* object is in value member.
*/
public void activate()
Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/RenameValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/RenameValueEditor.java?rev=742128&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/RenameValueEditor.java (added)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/RenameValueEditor.java Sun Feb 8 16:52:10 2009
@@ -0,0 +1,301 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.valueeditors;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.RenameEntryDialog;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.SimulateRenameDialogImpl;
+import org.apache.directory.studio.ldapbrowser.core.jobs.RenameEntryJob;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Special ValueEditor to rename an entry using the {@link RenameEntryDialog}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RenameValueEditor extends CellEditor implements IValueEditor
+{
+
+ /** The value to handle */
+ private Object value;
+
+ /** The parent composite, used to instantiate a new control */
+ private Composite parent;
+
+ /** The name of this value editor */
+ private String name;
+
+ /** The image of this value editor */
+ private ImageDescriptor imageDescriptor;
+
+ /** The value editor manager, used to get proper value editors */
+ protected ValueEditorManager valueEditorManager;
+
+
+ /**
+ * Creates a new instance of RenameValueEditor.
+ *
+ * @param parent the parent composite
+ * @param valueEditorManager the value editor manager, used to get
+ * proper value editors
+ */
+ public RenameValueEditor( Composite parent, ValueEditorManager valueEditorManager )
+ {
+ super( parent );
+ this.parent = parent;
+ this.valueEditorManager = valueEditorManager;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * This is a dialog editor, it doesn't create a control.
+ */
+ protected Control createControl( Composite parent )
+ {
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Returns the value object stored in a member.
+ */
+ protected final Object doGetValue()
+ {
+ return value;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * This is a dialog editor, doesn't set focus.
+ */
+ protected void doSetFocus()
+ {
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Stores the value object in a member.
+ */
+ protected void doSetValue( Object value )
+ {
+ this.value = value;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Opens the RenameEntryDialog. Expects that an IEntry
+ * object is in value member.
+ */
+ public void activate()
+ {
+ if ( getValue() != null && getValue() instanceof IEntry )
+ {
+ IEntry entry = ( IEntry ) getValue();
+ if ( entry != null )
+ {
+ RenameEntryDialog renameDialog = new RenameEntryDialog( parent.getShell(), entry );
+ if ( renameDialog.open() == Dialog.OK )
+ {
+ Rdn newRdn = renameDialog.getRdn();
+ if ( newRdn != null && !newRdn.equals( entry.getRdn() ) )
+ {
+ new RenameEntryJob( entry, newRdn, new SimulateRenameDialogImpl( parent.getShell() ) )
+ .execute();
+ }
+ }
+ }
+ }
+
+ fireCancelEditor();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Returns this.
+ */
+ public CellEditor getCellEditor()
+ {
+ return this;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * This implementation of getDisplayValue() returns a
+ * comma-separated list of all values.
+ */
+ public String getDisplayValue( AttributeHierarchy attributeHierarchy )
+ {
+ List<IValue> valueList = new ArrayList<IValue>();
+ for ( IAttribute attribute : attributeHierarchy )
+ {
+ valueList.addAll( Arrays.asList( attribute.getValues() ) );
+ }
+
+ StringBuffer sb = new StringBuffer();
+ if ( valueList.size() > 1 )
+ {
+ sb.append( NLS.bind( Messages.getString( "EntryValueEditor.n_values" ), valueList.size() ) ); //$NON-NLS-1$
+ }
+ for ( Iterator<IValue> it = valueList.iterator(); it.hasNext(); )
+ {
+ IValue value = it.next();
+ IValueEditor vp = getValueEditor( value );
+ sb.append( vp.getDisplayValue( value ) );
+ if ( it.hasNext() )
+ {
+ sb.append( ", " ); //$NON-NLS-1$
+ }
+ }
+ return sb.toString();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * This implementation gets the display value of the real value editor.
+ */
+ public String getDisplayValue( IValue value )
+ {
+ IValueEditor vp = getValueEditor( value );
+ return vp.getDisplayValue( value );
+ }
+
+
+ private IValueEditor getValueEditor( IValue value )
+ {
+ IValueEditor vp = valueEditorManager.getCurrentValueEditor( value.getAttribute().getEntry(), value
+ .getAttribute().getDescription() );
+
+ // avoid recursion: unset the user selected value editor
+ if ( vp instanceof RenameValueEditor )
+ {
+ IValueEditor userSelectedValueEditor = valueEditorManager.getUserSelectedValueEditor();
+ valueEditorManager.setUserSelectedValueEditor( null );
+ vp = valueEditorManager.getCurrentValueEditor( value.getAttribute().getEntry(), value.getAttribute()
+ .getDescription() );
+ valueEditorManager.setUserSelectedValueEditor( userSelectedValueEditor );
+ }
+
+ return vp;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Returns the entry.
+ */
+ public Object getRawValue( AttributeHierarchy attributeHierarchy )
+ {
+ return attributeHierarchy.getEntry().isDirectoryEntry() ? attributeHierarchy.getEntry() : null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Returns the entry.
+ */
+ public Object getRawValue( IValue value )
+ {
+ return value.getAttribute().getEntry().isDirectoryEntry() ? value.getAttribute().getEntry() : null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Modification is performed by the wizard. No need to return a value.
+ */
+ public Object getStringOrBinaryValue( Object rawValue )
+ {
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setValueEditorName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getValueEditorName()
+ {
+ return name;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setValueEditorImageDescriptor( ImageDescriptor imageDescriptor )
+ {
+ this.imageDescriptor = imageDescriptor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public ImageDescriptor getValueEditorImageDescriptor()
+ {
+ return imageDescriptor;
+ }
+
+}
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java Sun Feb 8 16:52:10 2009
@@ -104,6 +104,9 @@
/** The special value editor to edit the entry in an wizard */
private EntryValueEditor entryValueEditor;
+ /** The special value editor to rename the entry */
+ private RenameValueEditor renameValueEditor;
+
/** The default string editor for single-line values */
private IValueEditor defaultStringSingleLineValueEditor;
@@ -137,16 +140,22 @@
// special case: multivalued editor
multiValuedValueEditor = new MultivaluedValueEditor( this.parent, this );
- multiValuedValueEditor.setValueEditorName( Messages.getString("ValueEditorManager.MulitivaluedEditor") ); //$NON-NLS-1$
+ multiValuedValueEditor.setValueEditorName( Messages.getString( "ValueEditorManager.MulitivaluedEditor" ) ); //$NON-NLS-1$
multiValuedValueEditor.setValueEditorImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
BrowserCommonConstants.IMG_MULTIVALUEDEDITOR ) );
// special case: entry editor
entryValueEditor = new EntryValueEditor( this.parent, this );
- entryValueEditor.setValueEditorName( Messages.getString("ValueEditorManager.EntryEditor") ); //$NON-NLS-1$
+ entryValueEditor.setValueEditorName( Messages.getString( "ValueEditorManager.EntryEditor" ) ); //$NON-NLS-1$
entryValueEditor.setValueEditorImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
BrowserCommonConstants.IMG_ENTRY ) );
+ // special case: rename editor
+ renameValueEditor = new RenameValueEditor( this.parent, this );
+ renameValueEditor.setValueEditorName( Messages.getString( "ValueEditorManager.RenameEditor" ) ); //$NON-NLS-1$
+ renameValueEditor.setValueEditorImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+ BrowserCommonConstants.IMG_RENAME ) );
+
// get default editors from value editor map
defaultStringSingleLineValueEditor = class2ValueEditors.get( InPlaceTextValueEditor.class.getName() );
defaultStringMultiLineValueEditor = class2ValueEditors.get( TextValueEditor.class.getName() );
@@ -164,6 +173,7 @@
userSelectedValueEditor = null;
multiValuedValueEditor.dispose();
entryValueEditor.dispose();
+ renameValueEditor.dispose();
defaultStringSingleLineValueEditor.dispose();
defaultStringMultiLineValueEditor.dispose();
defaultBinaryValueEditor.dispose();
@@ -300,6 +310,12 @@
return entryValueEditor;
}
+ // special case RDN attribute: always return rename editor
+ if ( userSelectedValueEditor == null && value.isRdnPart() && value.getAttribute().getEntry().isDirectoryEntry() )
+ {
+ return renameValueEditor;
+ }
+
// here the value is known, we can check for single-line or multi-line
if ( ve == defaultStringSingleLineValueEditor )
{
@@ -522,6 +538,7 @@
list.add( multiValuedValueEditor );
list.add( entryValueEditor );
+ list.add( renameValueEditor );
return list.toArray( new IValueEditor[list.size()] );
}
@@ -728,7 +745,8 @@
catch ( Exception e )
{
BrowserCommonActivator.getDefault().getLog().log(
- new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, 1, Messages.getString("ValueEditorManager.UnableToCreateValueEditor") //$NON-NLS-1$
+ new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, 1, Messages
+ .getString( "ValueEditorManager.UnableToCreateValueEditor" ) //$NON-NLS-1$
+ vee.className, e ) );
}
}
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages.properties?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages.properties (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages.properties Sun Feb 8 16:52:10 2009
@@ -20,4 +20,5 @@
AbstractDialogBinaryValueEditor.InvalidData=Invalid Data
ValueEditorManager.EntryEditor=Entry Editor...
ValueEditorManager.MulitivaluedEditor=Mulitvalued Editor...
+ValueEditorManager.RenameEditor=Rename...
ValueEditorManager.UnableToCreateValueEditor=Unable to create ValueEditor
Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages_de.properties?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/messages_de.properties Sun Feb 8 16:52:10 2009
@@ -20,4 +20,5 @@
AbstractDialogBinaryValueEditor.InvalidData=Ungültige Daten
ValueEditorManager.EntryEditor=Eintrags-Editor...
ValueEditorManager.MulitivaluedEditor=Editor für mehrwertige Attribute...
+ValueEditorManager.RenameEditor=Umbenennen...
ValueEditorManager.UnableToCreateValueEditor=Wert-Editor konnte nicht initialisiert werden
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java Sun Feb 8 16:52:10 2009
@@ -165,7 +165,7 @@
// create OpenDefaultEditorAction with enabled rename action flag
openDefaultValueEditorActionProxy.dispose();
openDefaultValueEditorActionProxy = new EntryEditorActionProxy( viewer, new OpenDefaultEditorAction( viewer,
- openBestValueEditorActionProxy, true ) );
+ openBestValueEditorActionProxy ) );
openEntryValueEditorActionProxy = new EntryEditorActionProxy( viewer, new OpenEntryEditorAction( viewer,
entryEditor.getConfiguration().getValueEditorManager( viewer ), entryEditor.getConfiguration()
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/OpenBestEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/OpenBestEditorAction.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/OpenBestEditorAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/OpenBestEditorAction.java Sun Feb 8 16:52:10 2009
@@ -21,10 +21,16 @@
package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
import org.apache.directory.studio.valueeditors.IValueEditor;
import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osgi.util.NLS;
/**
@@ -131,4 +137,49 @@
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run()
+ {
+ boolean ok = true;
+
+ // validate non-modifiable attributes
+ AttributeHierarchy[] attributeHierarchies = getSelectedAttributeHierarchies();
+ if ( attributeHierarchies.length == 1 )
+ {
+ AttributeHierarchy attributeHierarchy = attributeHierarchies[0];
+ if ( attributeHierarchy.size() == 1
+ && attributeHierarchy.getAttribute().getValueSize() == 1
+ && attributeHierarchy.getAttributeDescription().equalsIgnoreCase(
+ attributeHierarchy.getAttribute().getValues()[0].getAttribute().getDescription() )
+ && !attributeHierarchy.getAttribute().getValues()[0].isRdnPart() )
+ {
+ IValue value = attributeHierarchy.getAttribute().getValues()[0];
+ StringBuffer message = new StringBuffer();
+ if ( !value.isEmpty() && !SchemaUtils.isModifiable( value.getAttribute().getAttributeTypeDescription() ) )
+ {
+ message
+ .append( NLS
+ .bind(
+ Messages.getString( "OpenBestEditorAction.EditValueNotModifiable" ), value.getAttribute().getDescription() ) ); //$NON-NLS-1$
+ message.append( BrowserCoreConstants.LINE_SEPARATOR );
+ message.append( BrowserCoreConstants.LINE_SEPARATOR );
+ }
+
+ if ( message.length() > 0 )
+ {
+ message.append( Messages.getString( "OpenBestEditorAction.EditValueQuestion" ) ); //$NON-NLS-1$
+ ok = MessageDialog.openConfirm( getShell(), getText(), message.toString() );
+ }
+ }
+ }
+
+ if ( ok )
+ {
+ super.run();
+ }
+ }
+
}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java Sun Feb 8 16:52:10 2009
@@ -25,7 +25,6 @@
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.apache.directory.studio.valueeditors.ValueEditorManager;
import org.eclipse.jface.viewers.ICellModifier;
@@ -89,36 +88,6 @@
{ new Attribute( result.getEntry(), property ) } );
}
- // check schema modifiable
- boolean isOneModifiable = false;
- for ( IAttribute attribute : ah )
- {
- if ( SchemaUtils.isModifiable( attribute.getAttributeTypeDescription() ) )
- {
- isOneModifiable = true;
- break;
- }
- }
- if ( !isOneModifiable )
- {
- return false;
- }
-
- // check if property is valid for the entry
- boolean isOneValid = false;
- for ( IAttribute attribute : ah )
- {
- if ( attribute.isObjectClassAttribute() || attribute.isMustAttribute() || attribute.isMayAttribute() )
- {
- isOneValid = true;
- break;
- }
- }
- if ( !isOneValid )
- {
- return false;
- }
-
// call value editor
return valueEditorManager.getCurrentValueEditor( ah ).getRawValue( ah ) != null;
}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages.properties?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages.properties Sun Feb 8 16:52:10 2009
@@ -18,6 +18,8 @@
FilterAndSortRunnable.FilterAndSort=Filter and Sort
FilterAndSortRunnable.Filtering=Filtering...
FilterAndSortRunnable.Sorting=Sorting...
+OpenBestEditorAction.EditValueNotModifiable=Warning\! According to the schema attribute {0} is not modifiable\!
+OpenBestEditorAction.EditValueQuestion=Do you still want to edit this value?
OpenDefaultEditorAction.EditValue=Edit Value
OpenEntryEditorAction.EditEntry=Edit Entry...
OpenSearchResultEditorPreferencePage.Preferences=Preferences...
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages_de.properties?rev=742128&r1=742127&r2=742128&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/messages_de.properties Sun Feb 8 16:52:10 2009
@@ -18,6 +18,8 @@
FilterAndSortRunnable.FilterAndSort=Filtern und Sortieren
FilterAndSortRunnable.Filtering=Filtern...
FilterAndSortRunnable.Sorting=Sortieren...
+OpenBestEditorAction.EditValueNotModifiable=Warnung\! Gemäß dem Schema ist das Attribut {0} nicht änderbar\!
+OpenBestEditorAction.EditValueQuestion=Wollen Sie trotzem den Wert bearbeiten?
OpenDefaultEditorAction.EditValue=Wert editieren
OpenEntryEditorAction.EditEntry=Eintrag editieren...
OpenSearchResultEditorPreferencePage.Preferences=Pr\u00E4ferenzen...