directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r526693 [14/17] - in /directory/ldapstudio/trunk/ldapstudio-browser-common: ./ META-INF/ resources/ resources/icons/ resources/templates/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/di...
Date Mon, 09 Apr 2007 09:49:57 GMT
Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetSorterDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetSorterDialog.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetSorterDialog.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetSorterDialog.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,189 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This class represents the dialog used to change the entry editors's  default sort preferences.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidgetSorterDialog extends Dialog
+{
+
+    /** The Constant DIALOG_TITLE. */
+    public static final String DIALOG_TITLE = "Entry Editor Sorting";
+
+    /** The Constant SORT_BY_NONE. */
+    public static final String SORT_BY_NONE = "No Default Sorting";
+
+    /** The Constant SORT_BY_ATTRIBUTE. */
+    public static final String SORT_BY_ATTRIBUTE = "Attribute Description";
+
+    /** The Constant SORT_BY_VALUE. */
+    public static final String SORT_BY_VALUE = "Value";
+
+    /** The preferences. */
+    private EntryEditorWidgetPreferences preferences;
+
+    /** The object class and must attributes first button. */
+    private Button objectClassAndMustAttributesFirstButton;
+
+    /** The operational attributes last button. */
+    private Button operationalAttributesLastButton;
+
+    /** The sort by combo. */
+    private Combo sortByCombo;
+
+    /** The sort acending button. */
+    private Button sortAcendingButton;
+
+    /** The sort descending button. */
+    private Button sortDescendingButton;
+
+
+    /**
+     * Creates a new instance of EntryEditorWidgetSorterDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param preferences the preferences
+     */
+    public EntryEditorWidgetSorterDialog( Shell parentShell, EntryEditorWidgetPreferences preferences )
+    {
+        super( parentShell );
+        this.preferences = preferences;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation calls its super implementation and sets the dialog's title.
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( DIALOG_TITLE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation saves the changed settings when OK is pressed.
+     */
+    protected void buttonPressed( int buttonId )
+    {
+        if ( buttonId == IDialogConstants.OK_ID )
+        {
+            IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+            store.setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OBJECTCLASS_AND_MUST_ATTRIBUTES_FIRST,
+                objectClassAndMustAttributesFirstButton.getSelection() );
+            store.setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OPERATIONAL_ATTRIBUTES_LAST,
+                operationalAttributesLastButton.getSelection() );
+            store.setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_ORDER, sortDescendingButton
+                .getSelection() ? BrowserCoreConstants.SORT_ORDER_DESCENDING
+                : BrowserCoreConstants.SORT_ORDER_ASCENDING );
+            store.setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_BY,
+                sortByCombo.getSelectionIndex() == 2 ? BrowserCoreConstants.SORT_BY_VALUE : sortByCombo
+                    .getSelectionIndex() == 1 ? BrowserCoreConstants.SORT_BY_ATTRIBUTE_DESCRIPTION
+                    : BrowserCoreConstants.SORT_BY_NONE );
+        }
+
+        super.buttonPressed( buttonId );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+
+        Group group = BaseWidgetUtils.createGroup( composite, "Group attributes", 1 );
+        GridData gd = new GridData( GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL );
+        gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+        group.setLayoutData( gd );
+
+        objectClassAndMustAttributesFirstButton = BaseWidgetUtils.createCheckbox( group,
+            "ObjectClass and must attributes first", 1 );
+        objectClassAndMustAttributesFirstButton.setSelection( preferences.isObjectClassAndMustAttributesFirst() );
+
+        operationalAttributesLastButton = BaseWidgetUtils.createCheckbox( group, "Operational attributes last", 1 );
+        operationalAttributesLastButton.setSelection( preferences.isOperationalAttributesLast() );
+
+        Group sortingGroup = BaseWidgetUtils.createGroup( composite, "Sort attributes", 1 );
+
+        Composite sortByComposite = BaseWidgetUtils.createColumnContainer( sortingGroup, 4, 1 );
+        BaseWidgetUtils.createLabel( sortByComposite, "Sort by", 1 );
+        sortByCombo = BaseWidgetUtils.createReadonlyCombo( sortByComposite, new String[]
+            { SORT_BY_NONE, SORT_BY_ATTRIBUTE, SORT_BY_VALUE }, 0, 1 );
+        sortByCombo.select( preferences.getDefaultSortBy() == BrowserCoreConstants.SORT_BY_VALUE ? 2 : preferences
+            .getDefaultSortBy() == BrowserCoreConstants.SORT_BY_ATTRIBUTE_DESCRIPTION ? 1 : 0 );
+        sortByCombo.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                sortAcendingButton.setEnabled( sortByCombo.getSelectionIndex() != 0 );
+                sortDescendingButton.setEnabled( sortByCombo.getSelectionIndex() != 0 );
+            }
+        } );
+
+        sortAcendingButton = BaseWidgetUtils.createRadiobutton( sortByComposite, "Ascending", 1 );
+        sortAcendingButton
+            .setSelection( preferences.getDefaultSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING );
+        sortAcendingButton.setEnabled( sortByCombo.getSelectionIndex() != 0 );
+
+        sortDescendingButton = BaseWidgetUtils.createRadiobutton( sortByComposite, "Descending", 1 );
+        sortDescendingButton
+            .setSelection( preferences.getDefaultSortOrder() == BrowserCoreConstants.SORT_ORDER_DESCENDING );
+        sortDescendingButton.setEnabled( sortByCombo.getSelectionIndex() != 0 );
+
+        BaseWidgetUtils.createSpacer( composite, 2 );
+
+        BaseWidgetUtils.createLabel( composite,
+            "Please click to table headers to sort by attribute description or value.", 1 );
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetTableMetadata.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetTableMetadata.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetTableMetadata.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetTableMetadata.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,50 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+/**
+ * The EntryEditorWidgetTableMetadata interface contains some constants used
+ * by the entry editor widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface EntryEditorWidgetTableMetadata
+{
+
+    /** The Constant KEY_COLUMN_INDEX. */
+    public static final int KEY_COLUMN_INDEX = 0;
+
+    /** The Constant VALUE_COLUMN_INDEX. */
+    public static final int VALUE_COLUMN_INDEX = 1;
+
+    /** The Constant KEY_COLUMN_NAME. */
+    public static final String KEY_COLUMN_NAME = "Attribute Description";
+
+    /** The Constant VALUE_COLUMN_NAME. */
+    public static final String VALUE_COLUMN_NAME = "Value";
+
+    /** The Constant COLUM_NAMES. */
+    public static final String[] COLUM_NAMES =
+        { KEY_COLUMN_NAME, VALUE_COLUMN_NAME };
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,240 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
+import org.apache.directory.ldapstudio.browser.core.events.BulkModificationEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EmptyValueAddedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EmptyValueDeletedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.ValueAddedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.ValueDeletedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.ValueModifiedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.ValueRenamedEvent;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+
+
+/**
+ * The EntryEditorWidgetUniversalListener manages all events for the entry editor widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidgetUniversalListener implements EntryUpdateListener
+{
+
+    /** The tree viewer */
+    protected TreeViewer viewer;
+
+    /** The action used to start the default value editor */
+    protected OpenDefaultEditorAction startEditAction;
+
+    /** This listener starts the value editor when pressing enter */
+    protected SelectionListener viewerSelectionListener = new SelectionAdapter()
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public void widgetSelected( SelectionEvent e )
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation starts the value editor.
+         */
+        public void widgetDefaultSelected( SelectionEvent e )
+        {
+            if ( startEditAction.isEnabled() )
+                startEditAction.run();
+        }
+    };
+
+    /** This listener starts the value editor or expands/collapses the selected attribute */
+    protected MouseListener viewerMouseListener = new MouseAdapter()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation starts the value editor or expands/collapses the selected attribute.
+         */
+        public void mouseDoubleClick( MouseEvent e )
+        {
+            if ( startEditAction.isEnabled() )
+            {
+                startEditAction.run();
+            }
+
+            IAttribute[] attributes = SelectionUtils.getAttributes( viewer.getSelection() );
+            IValue[] values = SelectionUtils.getValues( viewer.getSelection() );
+            if ( attributes.length == 1 && values.length == 0 )
+            {
+                if ( viewer.getExpandedState( attributes[0] ) )
+                {
+                    viewer.collapseToLevel( attributes[0], 1 );
+                }
+                else
+                {
+                    viewer.expandToLevel( attributes[0], 1 );
+                }
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void mouseDown( MouseEvent e )
+        {
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void mouseUp( MouseEvent e )
+        {
+        }
+    };
+
+
+    /**
+     * Creates a new instance of EntryEditorWidgetUniversalListener.
+     *
+     * @param treeViewer the tree viewer
+     * @param startEditAction the action used to start the default value editor
+     */
+    public EntryEditorWidgetUniversalListener( TreeViewer treeViewer, OpenDefaultEditorAction startEditAction )
+    {
+        this.startEditAction = startEditAction;
+        this.viewer = treeViewer;
+
+        // register listeners
+        viewer.getTree().addSelectionListener( viewerSelectionListener  );
+        viewer.getTree().addMouseListener( viewerMouseListener  );
+        EventRegistry.addEntryUpdateListener( this );
+    }
+
+
+    /**
+     * Disposes this universal listener.
+     */
+    public void dispose()
+    {
+        if ( viewer != null )
+        {
+            EventRegistry.removeEntryUpdateListener( this );
+
+            startEditAction = null;
+            viewer = null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation refreshes the viewer and selects a value depending
+     * on the event.
+     */
+    public void entryUpdated( EntryModificationEvent event )
+    {
+
+        if ( viewer == null || viewer.getTree() == null || viewer.getTree().isDisposed() || viewer.getInput() == null
+            || ( event.getModifiedEntry() != viewer.getInput() && !( event instanceof BulkModificationEvent ) ) )
+        {
+            return;
+        }
+
+        // force closing of cell editors
+        if ( viewer.isCellEditorActive() )
+        {
+            viewer.cancelEditing();
+        }
+
+        // refresh
+        viewer.refresh();
+
+        // selection value
+        if ( event instanceof ValueAddedEvent )
+        {
+            // select the vadded value
+            ValueAddedEvent vaEvent = ( ValueAddedEvent ) event;
+            viewer.setSelection( new StructuredSelection( vaEvent.getAddedValue() ), true );
+            viewer.refresh();
+        }
+        else if ( event instanceof ValueDeletedEvent )
+        {
+            // select another value of the deleted attribute
+            ValueDeletedEvent vdEvent = ( ValueDeletedEvent ) event;
+            if ( viewer.getSelection().isEmpty() && vdEvent.getDeletedValue().getAttribute().getValueSize() > 0 )
+            {
+                viewer.setSelection(
+                    new StructuredSelection( vdEvent.getDeletedValue().getAttribute().getValues()[0] ), true );
+            }
+        }
+        else if ( event instanceof EmptyValueAddedEvent )
+        {
+            // select the added value and start editing
+            EmptyValueAddedEvent evaEvent = ( EmptyValueAddedEvent ) event;
+            viewer.setSelection( new StructuredSelection( evaEvent.getAddedValue() ), true );
+            if ( startEditAction.isEnabled() )
+            {
+                startEditAction.run();
+            }
+        }
+        else if ( event instanceof EmptyValueDeletedEvent )
+        {
+            // select another value of the deleted attribute
+            EmptyValueDeletedEvent evdEvent = ( EmptyValueDeletedEvent ) event;
+            if ( viewer.getSelection().isEmpty() && evdEvent.getDeletedValue().getAttribute().getValueSize() > 0 )
+            {
+                viewer.setSelection(
+                    new StructuredSelection( evdEvent.getDeletedValue().getAttribute().getValues()[0] ), true );
+            }
+        }
+        else if ( event instanceof ValueModifiedEvent )
+        {
+            // select the modified value
+            ValueModifiedEvent vmEvent = ( ValueModifiedEvent ) event;
+            viewer.setSelection( new StructuredSelection( vmEvent.getNewValue() ), true );
+        }
+        else if ( event instanceof ValueRenamedEvent )
+        {
+            // select the renamed value
+            ValueRenamedEvent vrEvent = ( ValueRenamedEvent ) event;
+            viewer.setSelection( new StructuredSelection( vrEvent.getNewValue() ), true );
+        }
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenBestEditorAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenBestEditorAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenBestEditorAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenBestEditorAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,132 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.valueeditors.IValueEditor;
+import org.apache.directory.ldapstudio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * 
+ * The OpenBestEditorAction is used to edit a value with the best value editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenBestEditorAction extends AbstractOpenEditorAction
+{
+
+    /** The best value editor. */
+    private IValueEditor bestValueEditor;
+
+
+    /**
+     * Creates a new instance of OpenBestEditorAction.
+     * 
+     * @param viewer the viewer
+     * @param actionGroup the action group
+     * @param valueEditorManager the value editor manager
+     */
+    public OpenBestEditorAction( TreeViewer viewer, EntryEditorWidgetActionGroup actionGroup,
+        ValueEditorManager valueEditorManager )
+    {
+        super( viewer, actionGroup, valueEditorManager );
+    }
+
+
+    /**
+     * Gets the best value editor.
+     * 
+     * @return the best value editor
+     */
+    public IValueEditor getBestValueEditor()
+    {
+        return this.bestValueEditor;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        bestValueEditor = null;
+        super.dispose();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor()
+    {
+        return isEnabled() ? bestValueEditor.getValueEditorImageDescriptor() : null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getText()
+    {
+        return isEnabled() ? bestValueEditor.getValueEditorName() : null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isEnabled()
+    {
+        if ( getSelectedValues().length == 1
+            && getSelectedAttributes().length == 0
+            && viewer.getCellModifier().canModify( getSelectedValues()[0],
+                EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME ) )
+        {
+            // update value editor
+            bestValueEditor = valueEditorManager.getCurrentValueEditor( getSelectedValues()[0] );
+            super.cellEditor = bestValueEditor.getCellEditor();
+
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenDefaultEditorAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenDefaultEditorAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenDefaultEditorAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenDefaultEditorAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,178 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.apache.directory.ldapstudio.browser.common.actions.BrowserAction;
+import org.apache.directory.ldapstudio.browser.common.actions.RenameAction;
+import org.apache.directory.ldapstudio.browser.common.actions.proxy.EntryEditorActionProxy;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * 
+ * The OpenBestEditorAction is used to edit a value with the default value editor.
+ * This is either the best value editor or in case of an RDN attribute the rename
+ * action is invoked.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenDefaultEditorAction extends BrowserAction
+{
+
+    /** The best value editor proxy. */
+    private EntryEditorActionProxy bestValueEditorProxy;
+
+    /** The rename proxy. */
+    private EntryEditorActionProxy renameProxy;
+    
+
+    /**
+     * Creates a new instance of OpenDefaultEditorAction.
+     * 
+     * @param viewer the viewer
+     * @param bestValueEditorProxy the best value editor proxy
+     * @param enableRenameAction true to enable rename action
+     */
+    public OpenDefaultEditorAction( TreeViewer viewer, EntryEditorActionProxy bestValueEditorProxy, boolean enableRenameAction )
+    {
+        this.bestValueEditorProxy = bestValueEditorProxy;
+        this.renameProxy = enableRenameAction ? new EntryEditorActionProxy( viewer, new RenameAction() ) : null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        bestValueEditorProxy = null;
+        renameProxy = null;
+
+        super.dispose();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getCommandId()
+    {
+        return BrowserCommonConstants.ACTION_ID_EDIT_VALUE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor()
+    {
+        if ( bestValueEditorProxy != null )
+        {
+            return bestValueEditorProxy.getImageDescriptor();
+        }
+        else if ( renameProxy != null )
+        {
+            return renameProxy.getImageDescriptor();
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getText()
+    {
+        return "Edit Value";
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isEnabled()
+    {
+//      // update proxy selections
+//      if ( bestValueEditorProxy != null )
+//      {
+//          if ( this.currentSelectionChangedEvent != null )
+//          {
+//              this.valueEditorProxy.selectionChanged( currentSelectionChangedEvent );
+//          }
+//          this.valueEditorProxy.updateEnabledState();
+//      }
+//      if ( this.renameProxy != null )
+//      {
+//          if ( this.currentSelectionChangedEvent != null )
+//          {
+//              this.renameProxy.selectionChanged( currentSelectionChangedEvent );
+//          }
+//          this.renameProxy.updateAction();
+//      }
+
+      if ( bestValueEditorProxy != null && renameProxy != null )
+      {
+          return bestValueEditorProxy.isEnabled() || renameProxy.isEnabled();
+      }
+      else if ( renameProxy != null )
+      {
+          return renameProxy.isEnabled();
+      }
+      else if ( bestValueEditorProxy != null )
+      {
+          return bestValueEditorProxy.isEnabled();
+      }
+      else
+      {
+          return false;
+      }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void run()
+    {
+      if ( bestValueEditorProxy != null && bestValueEditorProxy.isEnabled() )
+      {
+          bestValueEditorProxy.run();
+      }
+      else if ( renameProxy != null && renameProxy.isEnabled() )
+      {
+          renameProxy.run();
+      }
+        
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenEditorAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenEditorAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenEditorAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,146 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import java.util.Arrays;
+
+import org.apache.directory.ldapstudio.valueeditors.IValueEditor;
+import org.apache.directory.ldapstudio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * The OpenEditorAction is used to edit a value with a specific value editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenEditorAction extends AbstractOpenEditorAction
+{
+
+    /** The specific value editor. */
+    private IValueEditor valueEditor;
+
+
+    /**
+     * Creates a new instance of OpenEditorAction.
+     * 
+     * @param viewer the viewer
+     * @param actionGroup the action group
+     * @param valueEditorManager the value editor manager
+     * @param valueEditor the specific value editor
+     */
+    public OpenEditorAction( TreeViewer viewer, EntryEditorWidgetActionGroup actionGroup,
+        ValueEditorManager valueEditorManager, IValueEditor valueEditor )
+    {
+        super( viewer, actionGroup, valueEditorManager );
+        super.cellEditor = valueEditor.getCellEditor();
+        this.valueEditor = valueEditor;
+    }
+
+
+    /**
+     * Gets the value editor.
+     * 
+     * @return the value editor
+     */
+    public IValueEditor getValueEditor()
+    {
+        return valueEditor;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        // ensure that the specific value editor is activated 
+        valueEditorManager.setUserSelectedValueEditor( valueEditor );
+
+        super.run();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        this.valueEditor = null;
+        super.dispose();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor()
+    {
+        return valueEditor.getValueEditorImageDescriptor();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getText()
+    {
+        return valueEditor.getValueEditorName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isEnabled()
+    {
+        if ( getSelectedValues().length == 1
+            && getSelectedAttributes().length == 0
+            && viewer.getCellModifier().canModify( getSelectedValues()[0],
+                EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME ) )
+        {
+            IValueEditor[] alternativeVps = valueEditorManager.getAlternativeValueEditors( getSelectedValues()[0] );
+            return Arrays.asList( alternativeVps ).contains( valueEditor )
+                && valueEditor.getRawValue( getSelectedValues()[0] ) != null;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenSortDialogAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenSortDialogAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenSortDialogAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/OpenSortDialogAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,54 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.PlatformUI;
+
+
+public class OpenSortDialogAction extends Action
+{
+
+    private EntryEditorWidgetPreferences preferences;
+
+
+    public OpenSortDialogAction( EntryEditorWidgetPreferences preferences )
+    {
+        super.setText( "Sorting..." );
+        super.setToolTipText( "Sorting..." );
+        super.setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_SORT ) );
+        super.setEnabled( true );
+
+        this.preferences = preferences;
+    }
+
+
+    public void run()
+    {
+        EntryEditorWidgetSorterDialog dlg = new EntryEditorWidgetSorterDialog( PlatformUI.getWorkbench().getDisplay()
+            .getActiveShell(), this.preferences );
+        dlg.open();
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/ShowQuickFilterAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/ShowQuickFilterAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/ShowQuickFilterAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/ShowQuickFilterAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,113 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * This action shows/hides the instant search.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ShowQuickFilterAction extends Action
+{
+
+    /** The Constant SHOW_QUICKFILTER_DIALOGSETTING_KEY. */
+    public static final String SHOW_QUICKFILTER_DIALOGSETTING_KEY = ShowQuickFilterAction.class.getName()
+        + ".showQuickFilter";
+
+    /** The quick filter widget. */
+    private EntryEditorWidgetQuickFilterWidget quickFilterWidget;
+
+
+    /**
+     * Creates a new instance of ShowQuickFilterAction.
+     * 
+     * @param quickFilterWidget the quick filter widget
+     */
+    public ShowQuickFilterAction( EntryEditorWidgetQuickFilterWidget quickFilterWidget )
+    {
+        super( "Show Quick Filter", AS_CHECK_BOX );
+        setToolTipText( "Show Quick Filter" );
+        setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_FILTER ) );
+        setActionDefinitionId( IWorkbenchActionDefinitionIds.FIND_REPLACE );
+        setEnabled( true );
+
+        this.quickFilterWidget = quickFilterWidget;
+
+        if ( BrowserCommonActivator.getDefault().getDialogSettings().get( SHOW_QUICKFILTER_DIALOGSETTING_KEY ) == null )
+        {
+            BrowserCommonActivator.getDefault().getDialogSettings().put( SHOW_QUICKFILTER_DIALOGSETTING_KEY, false );
+        }
+
+        // call the super implementation here because the local implementation
+        // does nothing.
+        super.setChecked( BrowserCommonActivator.getDefault().getDialogSettings().getBoolean(
+            SHOW_QUICKFILTER_DIALOGSETTING_KEY ) );
+        quickFilterWidget.setActive( isChecked() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation toggles the checked state and 
+     * activates or deactivates the quick filter accordingly. 
+     */
+    public void run()
+    {
+        boolean checked = isChecked();
+        super.setChecked( !checked );
+
+        BrowserCommonActivator.getDefault().getDialogSettings().put( SHOW_QUICKFILTER_DIALOGSETTING_KEY, isChecked() );
+
+        if ( quickFilterWidget != null )
+        {
+            quickFilterWidget.setActive( isChecked() );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation does nothing. Toggling of the checked state is done within the run() method.
+     */
+    public void setChecked( boolean checked )
+    {
+    }
+
+
+    /**
+     * Disposes this action.
+     */
+    public void dispose()
+    {
+        quickFilterWidget = null;
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/AliasesDereferencingWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/AliasesDereferencingWidget.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/AliasesDereferencingWidget.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/AliasesDereferencingWidget.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,172 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.common.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+
+/**
+ * The AliasesDereferencingWidget could be used to select the
+ * alias dereferencing method. It is composed of a group with 
+ * two check boxes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AliasesDereferencingWidget extends BrowserWidget
+{
+
+    /** The initial aliases dereferencing method */
+    private int initialAliasesDereferencingMethod;
+
+    /** The group. */
+    private Group group;
+
+    /** The finding button. */
+    private Button findingButton;
+
+    /** The search button. */
+    private Button searchButton;
+
+
+    /**
+     * Creates a new instance of AliasesDereferencingWidget with the given
+     * derefenencing method. This must be one of {@link IConnection#DEREFERENCE_ALIASES_NEVER},
+     * {@link IConnection#DEREFERENCE_ALIASES_SEARCH}, {@link IConnection#DEREFERENCE_ALIASES_FINDING}
+     * or {@link IConnection#DEREFERENCE_ALIASES_ALWAYS}.
+     * 
+     * @param initialAliasesDereferencingMethod the initial aliases dereferencing method
+     */
+    public AliasesDereferencingWidget( int initialAliasesDereferencingMethod )
+    {
+        this.initialAliasesDereferencingMethod = initialAliasesDereferencingMethod;
+    }
+
+
+    /**
+     * Creates a new instance of AliasesDereferencingWidget. The initial 
+     * dereferncing method is set to {@link IConnection#DEREFERENCE_ALIASES_NEVER}.
+     */
+    public AliasesDereferencingWidget()
+    {
+        this.initialAliasesDereferencingMethod = IConnection.DEREFERENCE_ALIASES_NEVER;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( Composite parent )
+    {
+
+        group = BaseWidgetUtils.createGroup( parent, "Aliases Dereferencing", 1 );
+        Composite groupComposite = BaseWidgetUtils.createColumnContainer( group, 1, 1 );
+
+        findingButton = BaseWidgetUtils.createCheckbox( groupComposite, "Finding Base DN", 1 );
+        findingButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        searchButton = BaseWidgetUtils.createCheckbox( groupComposite, "Search", 1 );
+        searchButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        setAliasesDereferencingMethod( initialAliasesDereferencingMethod );
+    }
+
+
+    /**
+     * Sets the aliases dereferencing method, must be one of {@link IConnection#DEREFERENCE_ALIASES_NEVER},
+     * {@link IConnection#DEREFERENCE_ALIASES_SEARCH}, {@link IConnection#DEREFERENCE_ALIASES_FINDING}
+     * or {@link IConnection#DEREFERENCE_ALIASES_ALWAYS}.
+     * 
+     * @param aliasesDereferencingMethod the aliases dereferencing method
+     */
+    public void setAliasesDereferencingMethod( int aliasesDereferencingMethod )
+    {
+        initialAliasesDereferencingMethod = aliasesDereferencingMethod;
+        findingButton.setSelection( initialAliasesDereferencingMethod == IConnection.DEREFERENCE_ALIASES_FINDING
+            || initialAliasesDereferencingMethod == IConnection.DEREFERENCE_ALIASES_ALWAYS );
+        searchButton.setSelection( initialAliasesDereferencingMethod == IConnection.DEREFERENCE_ALIASES_SEARCH
+            || initialAliasesDereferencingMethod == IConnection.DEREFERENCE_ALIASES_ALWAYS );
+    }
+
+
+    /**
+     * Gets the aliases dereferencing method, one of {@link IConnection#DEREFERENCE_ALIASES_NEVER},
+     * {@link IConnection#DEREFERENCE_ALIASES_SEARCH}, {@link IConnection#DEREFERENCE_ALIASES_FINDING}
+     * or {@link IConnection#DEREFERENCE_ALIASES_ALWAYS}.
+     * 
+     * @return the aliases dereferencing method
+     */
+    public int getAliasesDereferencingMethod()
+    {
+        if ( findingButton.getSelection() && searchButton.getSelection() )
+        {
+            return IConnection.DEREFERENCE_ALIASES_ALWAYS;
+        }
+        else if ( findingButton.getSelection() )
+        {
+            return IConnection.DEREFERENCE_ALIASES_FINDING;
+        }
+        else if ( searchButton.getSelection() )
+        {
+            return IConnection.DEREFERENCE_ALIASES_SEARCH;
+        }
+        else
+        {
+            return IConnection.DEREFERENCE_ALIASES_NEVER;
+        }
+    }
+
+
+    /**
+     * Sets the enabled state of the widget.
+     * 
+     * @param b true to enable the widget, false to disable the widget
+     */
+    public void setEnabled( boolean b )
+    {
+        group.setEnabled( b );
+        findingButton.setEnabled( b );
+        searchButton.setEnabled( b );
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ConnectionWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ConnectionWidget.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ConnectionWidget.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ConnectionWidget.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,147 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.common.dialogs.SelectConnectionDialog;
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.common.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * The ConnectionWidget could be used to select a connection. 
+ * It is composed of a text to display the selected connection
+ * and a browse button to open a {@link SelectConnectionDialog}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionWidget extends BrowserWidget
+{
+
+    /** The connection text, displays the selected connection */
+    private Text connectionText;
+
+    /** The connection browse button, opens the dialog */
+    private Button connectionBrowseButton;
+
+    /** The selected connection */
+    private IConnection selectedConnection;
+
+
+    /**
+     * Creates a new instance of ConnectionWidget.
+     * 
+     * @param connection the initial connection
+     */
+    public ConnectionWidget( IConnection connection )
+    {
+        this.selectedConnection = connection;
+    }
+
+
+    /**
+     * Creates a new instance of ConnectionWidget with no initial connection.
+     */
+    public ConnectionWidget()
+    {
+        this.selectedConnection = null;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( final Composite parent )
+    {
+
+        // Text
+        connectionText = BaseWidgetUtils.createReadonlyText( parent, "", 1 );
+
+        // Button
+        connectionBrowseButton = BaseWidgetUtils.createButton( parent, "B&rowse...", 1 );
+        connectionBrowseButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                // if(selectedConnection != null) {
+                SelectConnectionDialog dialog = new SelectConnectionDialog( parent.getShell(), "Select Connection",
+                    selectedConnection );
+                dialog.open();
+                IConnection connection = dialog.getSelectedConnection();
+                if ( connection != null )
+                {
+                    setConnection( connection );
+                    notifyListeners();
+                }
+                // }
+            }
+        } );
+
+        // initial values
+        setConnection( selectedConnection );
+
+    }
+
+
+    /**
+     * Gets the selected connection.
+     * 
+     * @return the connection
+     */
+    public IConnection getConnection()
+    {
+        return selectedConnection;
+    }
+
+
+    /**
+     * Sets the selected connection.
+     * 
+     * @param connection the connection
+     */
+    public void setConnection( IConnection connection )
+    {
+        selectedConnection = connection;
+        connectionText.setText( selectedConnection != null ? selectedConnection.getName() : "" );
+    }
+
+
+    /**
+     * Sets the enabled state of the widget.
+     * 
+     * @param b true to enable the widget, false to disable the widget
+     */
+    public void setEnabled( boolean b )
+    {
+        connectionText.setEnabled( b );
+        connectionBrowseButton.setEnabled( b );
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/EntryWidget.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/EntryWidget.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/EntryWidget.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,293 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.apache.directory.ldapstudio.browser.common.dialogs.SelectEntryDialog;
+import org.apache.directory.ldapstudio.browser.common.jobs.RunnableContextJobAdapter;
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.common.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.common.widgets.HistoryUtils;
+import org.apache.directory.ldapstudio.browser.core.jobs.ReadEntryJob;
+import org.apache.directory.ldapstudio.browser.core.model.DN;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.NameException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * The EntryWidget could be used to select an entry. 
+ * It is composed
+ * <ul>
+ * <li>a combo to manually enter an DN or to choose one from
+ *     the history
+ * <li>an up button to switch to the parent's DN
+ * <li>a browse button to open a {@link SelectEntryDialog}
+ * </ul>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryWidget extends BrowserWidget
+{
+    
+    /** The DN combo. */
+    private Combo dnCombo;
+
+    /** The up button. */
+    private Button upButton;
+
+    /** The entry browse button. */
+    private Button entryBrowseButton;
+
+    /** The connection. */
+    private IConnection connection;
+
+    /** The selected DN. */
+    private DN dn;
+
+
+    /**
+     * Creates a new instance of EntryWidget.
+     */
+    public EntryWidget()
+    {
+        this.connection = null;
+        this.dn = null;
+    }
+
+
+    /**
+     * Creates a new instance of EntryWidget.
+     *
+     * @param connection the connection
+     * @param dn the initial DN
+     */
+    public EntryWidget( IConnection connection, DN dn )
+    {
+        this.connection = connection;
+        this.dn = dn;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( final Composite parent )
+    {
+
+        // DN combo
+        Composite textAndUpComposite = BaseWidgetUtils.createColumnContainer( parent, 2, 1 );
+        dnCombo = BaseWidgetUtils.createCombo( textAndUpComposite, new String[0], -1, 1 );
+        GridData gd = new GridData( GridData.FILL_HORIZONTAL );
+        gd.horizontalSpan = 1;
+        gd.widthHint = 200;
+        dnCombo.setLayoutData( gd );
+        
+        // DN history
+        String[] history = HistoryUtils.load( BrowserCommonConstants.DIALOGSETTING_KEY_DN_HISTORY );
+        dnCombo.setItems( history );
+        dnCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                try
+                {
+                    dn = new DN( dnCombo.getText() );
+                }
+                catch ( NameException e1 )
+                {
+                    dn = null;
+                }
+
+                internalSetEnabled();
+                notifyListeners();
+            }
+        } );
+        
+        // Up button
+        upButton = new Button( textAndUpComposite, SWT.PUSH );
+        upButton.setToolTipText( "Parent" );
+        upButton.setImage( BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_PARENT ) );
+        upButton.setEnabled( false );
+        upButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                if ( dn != null && dn.getParentDn() != null )
+                {
+                    dn = dn.getParentDn();
+                    dnChanged();
+                    internalSetEnabled();
+                    notifyListeners();
+                }
+            }
+        } );
+
+        // Browse button
+        entryBrowseButton = BaseWidgetUtils.createButton( parent, "Br&owse...", 1 );
+        entryBrowseButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                if ( connection != null )
+                {
+                    IEntry entry = null;
+                    if ( dn != null && dn.getRdns().length > 0 )
+                    {
+                        entry = connection.getEntryFromCache( dn );
+                        if ( entry == null )
+                        {
+                            ReadEntryJob job = new ReadEntryJob( connection, dn );
+                            RunnableContextJobAdapter.execute( job );
+                            entry = job.getReadEntry();
+                        }
+                    }
+                    
+                    if( entry == null )
+                    {
+                        entry = connection.getRootDSE();
+                    }
+
+                    if ( entry != null )
+                    {
+                        SelectEntryDialog dialog = new SelectEntryDialog( parent.getShell(), "Select DN", connection,
+                            entry );
+                        dialog.open();
+                        IEntry selectedEntry = dialog.getSelectedEntry();
+                        if ( selectedEntry != null )
+                        {
+                            dn = selectedEntry.getDn();
+                            dnChanged();
+                            internalSetEnabled();
+                            notifyListeners();
+                        }
+                    }
+                }
+            }
+        } );
+
+        dnChanged();
+        internalSetEnabled();
+    }
+
+
+    /**
+     * Notifies that the DN has been changed.
+     */
+    private void dnChanged()
+    {
+        if ( dnCombo != null && entryBrowseButton != null )
+        {
+            dnCombo.setText( dn != null ? dn.toString() : "" );
+        }
+    }
+
+
+    /**
+     * Sets the enabled state of the widget.
+     * 
+     * @param b true to enable the widget, false to disable the widget
+     */
+    public void setEnabled( boolean b )
+    {
+        dnCombo.setEnabled( b );
+
+        if ( b )
+        {
+            this.dnChanged();
+        }
+
+        internalSetEnabled();
+    }
+
+
+    /**
+     * Internal set enabled.
+     */
+    private void internalSetEnabled()
+    {
+        upButton.setEnabled( dn != null && dn.getParentDn() != null && dnCombo.isEnabled() );
+        entryBrowseButton.setEnabled( connection != null && dnCombo.isEnabled() );
+    }
+
+
+    /**
+     * Saves dialog settings.
+     */
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( BrowserCommonConstants.DIALOGSETTING_KEY_DN_HISTORY, this.dnCombo.getText() );
+    }
+
+
+    /**
+     * Gets the DN.
+     * 
+     * @return the DN
+     */
+    public DN getDn()
+    {
+        return dn;
+    }
+
+
+    /**
+     * Gets the connection.
+     * 
+     * @return the connection
+     */
+    public IConnection getConnection()
+    {
+        return connection;
+    }
+
+
+    /**
+     * Sets the input.
+     * 
+     * @param dn the DN
+     * @param connection the connection
+     */
+    public void setInput( IConnection connection, DN dn )
+    {
+        if ( this.connection != connection || this.dn != dn )
+        {
+            this.connection = connection;
+            this.dn = dn;
+            dnChanged();
+        }
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/FilterWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/FilterWidget.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/FilterWidget.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/FilterWidget.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,221 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.apache.directory.ldapstudio.browser.common.dialogs.FilterDialog;
+import org.apache.directory.ldapstudio.browser.common.filtereditor.FilterContentAssistProcessor;
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.common.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.common.widgets.DialogContentAssistant;
+import org.apache.directory.ldapstudio.browser.common.widgets.HistoryUtils;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterParser;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * The FileterWidget could be used to specify an LDAP filter. 
+ * It is composed of a text with a content assit to enter 
+ * a filter and a button to open a {@link FilterDialog}.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class FilterWidget extends BrowserWidget
+{
+
+    /** The filter combo. */
+    private Combo filterCombo;
+
+    /** The button to open the filter editor. */
+    private Button filterEditorButton;
+
+    /** The content assist processor. */
+    private FilterContentAssistProcessor contentAssistProcessor;
+
+    /** The connection. */
+    private IConnection connection;
+
+    /** The inital filter. */
+    private String initalFilter;
+
+
+    /**
+     * Creates a new instance of FilterWidget.
+     * 
+     * @param connection the connection
+     * @param initalFilter the inital filter
+     */
+    public FilterWidget( IConnection connection, String initalFilter )
+    {
+        this.connection = connection;
+        this.initalFilter = initalFilter;
+    }
+
+
+    /**
+     * Creates a new instance of FilterWidget with no connection and
+     * no initial filter.
+     */
+    public FilterWidget()
+    {
+        this.connection = null;
+        this.initalFilter = null;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( final Composite parent )
+    {
+        // Combo
+        filterCombo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 );
+        GridData gd = new GridData( GridData.FILL_HORIZONTAL );
+        gd.horizontalSpan = 1;
+        gd.widthHint = 200;
+        filterCombo.setLayoutData( gd );
+
+        filterCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        // Content assist
+        LdapFilterParser parser = new LdapFilterParser();
+        contentAssistProcessor = new FilterContentAssistProcessor( parser );
+        DialogContentAssistant fca = new DialogContentAssistant();
+        fca.enableAutoInsert( true );
+        fca.enableAutoActivation( true );
+        fca.setAutoActivationDelay( 100 );
+        fca.setContentAssistProcessor( contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE );
+        fca.install( filterCombo );
+
+        // Filter editor button
+        filterEditorButton = BaseWidgetUtils.createButton( parent, "F&ilter Editor...", 1 );
+        filterEditorButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                if ( connection != null )
+                {
+                    FilterDialog dialog = new FilterDialog( parent.getShell(), "Filter Editor", filterCombo.getText(),
+                        connection );
+                    dialog.open();
+                    String filter = dialog.getFilter();
+                    if ( filter != null )
+                    {
+                        filterCombo.setText( filter );
+                    }
+                }
+            }
+        } );
+
+        // filter history
+        String[] history = HistoryUtils.load( BrowserCommonConstants.DIALOGSETTING_KEY_SEARCH_FILTER_HISTORY );
+        filterCombo.setItems( history );
+
+        // initial values
+        setConnection( connection );
+        filterCombo.setText( initalFilter == null ? "(objectClass=*)" : initalFilter );
+    }
+
+
+    /**
+     * Gets the filter.
+     * 
+     * @return the filter
+     */
+    public String getFilter()
+    {
+        return filterCombo.getText();
+    }
+
+
+    /**
+     * Sets the filter.
+     * 
+     * @param filter the filter
+     */
+    public void setFilter( String filter )
+    {
+        filterCombo.setText( filter );
+    }
+
+
+    /**
+     * Sets the connection.
+     * 
+     * @param connection the connection
+     */
+    public void setConnection( IConnection connection )
+    {
+        this.connection = connection;
+        contentAssistProcessor.setPossibleAttributeTypes( connection == null ? new String[0] : connection.getSchema()
+            .getAttributeTypeDescriptionNames() );
+    }
+
+
+    /**
+     * Saves dialog settings.
+     */
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( BrowserCommonConstants.DIALOGSETTING_KEY_SEARCH_FILTER_HISTORY, filterCombo.getText() );
+    }
+
+
+    /**
+     * Sets the focus.
+     */
+    public void setFocus()
+    {
+        // filterCombo.setFocus();
+    }
+
+
+    /**
+     * Sets the enabled state of the widget.
+     * 
+     * @param b true to enable the widget, false to disable the widget
+     */
+    public void setEnabled( boolean b )
+    {
+        filterCombo.setEnabled( b );
+        filterEditorButton.setEnabled( b );
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/LimitWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/LimitWidget.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/LimitWidget.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/LimitWidget.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,229 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.common.widgets.BrowserWidget;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * The LimitWidget could be used to select the limits of a connection
+ * or search. It is composed of a group with text input fields.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LimitWidget extends BrowserWidget
+{
+
+    /** The initial count limit. */
+    private int initialCountLimit;
+
+    /** The initial time limit. */
+    private int initialTimeLimit;
+
+    /** The limit group. */
+    private Group limitGroup;
+
+    /** The count limit label. */
+    private Label countLimitLabel;
+
+    /** The count limit text. */
+    private Text countLimitText;
+
+    /** The time limit label. */
+    private Label timeLimitLabel;
+
+    /** The time limit text. */
+    private Text timeLimitText;
+
+
+    /**
+     * Creates a new instance of LimitWidget.
+     * 
+     * @param initialTimeLimit the initial time limit
+     * @param initialCountLimit the initial count limit
+     */
+    public LimitWidget( int initialCountLimit, int initialTimeLimit )
+    {
+        this.initialCountLimit = initialCountLimit;
+        this.initialTimeLimit = initialTimeLimit;
+    }
+
+
+    /**
+     * Creates a new instance of LimitWidget with no limits.
+     */
+    public LimitWidget()
+    {
+        this.initialCountLimit = 0;
+        this.initialTimeLimit = 0;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( Composite parent )
+    {
+
+        limitGroup = BaseWidgetUtils.createGroup( parent, "Limits", 1 );
+        GridLayout gl = new GridLayout( 2, false );
+        limitGroup.setLayout( gl );
+
+        // Count limit
+        countLimitLabel = BaseWidgetUtils.createLabel( limitGroup, "&Count Limit:", 1 );
+        countLimitText = BaseWidgetUtils.createText( limitGroup, "", 1 );
+        countLimitText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        countLimitText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        // Time limit
+        timeLimitLabel = BaseWidgetUtils.createLabel( limitGroup, "&Time Limit:", 1 );
+        timeLimitText = BaseWidgetUtils.createText( limitGroup, "", 1 );
+        timeLimitText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        timeLimitText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        setCountLimit( initialCountLimit );
+        setTimeLimit( initialTimeLimit );
+    }
+
+
+    /**
+     * Sets the count limit.
+     * 
+     * @param countLimit the count limit
+     */
+    public void setCountLimit( int countLimit )
+    {
+        initialCountLimit = countLimit;
+        countLimitText.setText( Integer.toString( initialCountLimit ) );
+    }
+
+
+    /**
+     * Sets the time limit.
+     * 
+     * @param timeLimit the time limit
+     */
+    public void setTimeLimit( int timeLimit )
+    {
+        initialTimeLimit = timeLimit;
+        timeLimitText.setText( Integer.toString( initialTimeLimit ) );
+    }
+
+
+    /**
+     * Gets the count limit.
+     * 
+     * @return the count limit
+     */
+    public int getCountLimit()
+    {
+        int countLimit;
+        try
+        {
+            countLimit = new Integer( countLimitText.getText() ).intValue();
+        }
+        catch ( NumberFormatException e )
+        {
+            countLimit = 0;
+        }
+        return countLimit;
+    }
+
+
+    /**
+     * Gets the time limit.
+     * 
+     * @return the time limit
+     */
+    public int getTimeLimit()
+    {
+        int timeLimit;
+        try
+        {
+            timeLimit = new Integer( timeLimitText.getText() ).intValue();
+        }
+        catch ( NumberFormatException e )
+        {
+            timeLimit = 0;
+        }
+        return timeLimit;
+    }
+
+
+    /**
+     * Sets the enabled state of the widget.
+     * 
+     * @param b true to enable the widget, false to disable the widget
+     */
+    public void setEnabled( boolean b )
+    {
+        limitGroup.setEnabled( b );
+        countLimitLabel.setEnabled( b );
+        countLimitText.setEnabled( b );
+        timeLimitLabel.setEnabled( b );
+        timeLimitText.setEnabled( b );
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ReferralsHandlingWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ReferralsHandlingWidget.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ReferralsHandlingWidget.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/search/ReferralsHandlingWidget.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,162 @@
+/*
+ *  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.ldapstudio.browser.common.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.common.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+
+/**
+ * The ReferralsHandlingWidget could be used to select the
+ * referrals handling method. It is composed of a group with 
+ * two radio buttons.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReferralsHandlingWidget extends BrowserWidget
+{
+
+    /** The initial referrals handling method. */
+    private int initialReferralsHandlingMethod;
+
+    /** The group. */
+    private Group group;
+
+    /** The ignore button. */
+    private Button ignoreButton;
+
+    /** The follow button. */
+    private Button followButton;
+
+
+    /**
+     * Creates a new instance of ReferralsHandlingWidget with the given
+     * referrals handling method. This must be one of
+     * {@link IConnection#HANDLE_REFERRALS_IGNORE} or
+     * {@link IConnection#HANDLE_REFERRALS_FOLLOW}.  
+     * 
+     * @param initialReferralsHandlingMethod the initial referrals handling method
+     */
+    public ReferralsHandlingWidget( int initialReferralsHandlingMethod )
+    {
+        this.initialReferralsHandlingMethod = initialReferralsHandlingMethod;
+    }
+
+
+    /**
+     * Creates a new instance of ReferralsHandlingWidget with initial 
+     * referrals handling method {@link IConnection#HANDLE_REFERRALS_IGNORE}.
+     */
+    public ReferralsHandlingWidget()
+    {
+        this.initialReferralsHandlingMethod = IConnection.HANDLE_REFERRALS_IGNORE;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( Composite parent )
+    {
+
+        group = BaseWidgetUtils.createGroup( parent, "Referrals Handling", 1 );
+        Composite groupComposite = BaseWidgetUtils.createColumnContainer( group, 1, 1 );
+
+        ignoreButton = BaseWidgetUtils.createRadiobutton( groupComposite, "Ignore", 1 );
+        ignoreButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        followButton = BaseWidgetUtils.createRadiobutton( groupComposite, "Follow", 1 );
+        followButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        setReferralsHandlingMethod( initialReferralsHandlingMethod );
+    }
+
+
+    /**
+     * Sets the referrals handling method must be one of
+     *  {@link IConnection#HANDLE_REFERRALS_IGNORE} or
+     * {@link IConnection#HANDLE_REFERRALS_FOLLOW}. 
+     * 
+     * @param referralsHandlingMethod the referrals handling method
+     */
+    public void setReferralsHandlingMethod( int referralsHandlingMethod )
+    {
+        initialReferralsHandlingMethod = referralsHandlingMethod;
+        ignoreButton.setSelection( initialReferralsHandlingMethod == IConnection.HANDLE_REFERRALS_IGNORE );
+        followButton.setSelection( initialReferralsHandlingMethod == IConnection.HANDLE_REFERRALS_FOLLOW );
+    }
+
+
+    /**
+     * Gets the referrals handling method, one of
+     * {@link IConnection#HANDLE_REFERRALS_IGNORE} or
+     * {@link IConnection#HANDLE_REFERRALS_FOLLOW}.
+     * 
+     * @return the referrals handling method
+     */
+    public int getReferralsHandlingMethod()
+    {
+        if ( ignoreButton.getSelection() )
+        {
+            return IConnection.HANDLE_REFERRALS_IGNORE;
+        }
+        else
+        {
+            return IConnection.HANDLE_REFERRALS_FOLLOW;
+        }
+    }
+
+
+    /**
+     * Sets the enabled state of the widget.
+     * 
+     * @param b true to enable the widget, false to disable the widget
+     */
+    public void setEnabled( boolean b )
+    {
+        group.setEnabled( b );
+        ignoreButton.setEnabled( b );
+        followButton.setEnabled( b );
+    }
+
+}



Mime
View raw message