directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r488371 [9/14] - in /directory/sandbox/pamarcelot/ldapstudio: ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/jobs/ ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/perspective/ ldapstudio-browser-ui...
Date Mon, 18 Dec 2006 17:57:49 GMT
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetTableMetadata.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetTableMetadata.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetTableMetadata.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetTableMetadata.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,38 @@
+/*
+ *  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.ui.widgets.entryeditor;
+
+
+public interface EntryEditorWidgetTableMetadata
+{
+
+    public static final int KEY_COLUMN_INDEX = 0;
+
+    public static final int VALUE_COLUMN_INDEX = 1;
+
+    public static final String KEY_COLUMN_NAME = "Attribute Description";
+
+    public static final String VALUE_COLUMN_NAME = "Value";
+
+    public static final String[] COLUM_NAMES =
+        { KEY_COLUMN_NAME, VALUE_COLUMN_NAME };
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetUniversalListener.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetUniversalListener.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetUniversalListener.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,187 @@
+/*
+ *  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.ui.widgets.entryeditor;
+
+
+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.apache.directory.ldapstudio.browser.ui.actions.SelectionUtils;
+
+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.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+
+
+public class EntryEditorWidgetUniversalListener implements EntryUpdateListener
+{
+
+    protected TreeViewer viewer;
+
+    protected OpenDefaultEditorAction startEditAction;
+
+
+    public EntryEditorWidgetUniversalListener( TreeViewer treeViewer, OpenDefaultEditorAction startEditAction )
+    {
+        this.startEditAction = startEditAction;
+        this.viewer = treeViewer;
+
+        this.initListeners();
+    }
+
+
+    protected void initListeners()
+    {
+
+        this.viewer.getTree().addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+            }
+
+
+            public void widgetDefaultSelected( SelectionEvent e )
+            {
+                if ( startEditAction.isEnabled() )
+                    startEditAction.run();
+            }
+        } );
+        this.viewer.getTree().addMouseListener( new MouseAdapter()
+        {
+            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 );
+                }
+            }
+
+
+            public void mouseDown( MouseEvent e )
+            {
+            }
+
+
+            public void mouseUp( MouseEvent e )
+            {
+            }
+        } );
+
+        EventRegistry.addEntryUpdateListener( this );
+    }
+
+
+    public void dispose()
+    {
+        if ( this.viewer != null )
+        {
+            EventRegistry.removeEntryUpdateListener( this );
+
+            this.startEditAction = null;
+            this.viewer = null;
+        }
+    }
+
+
+    public void entryUpdated( EntryModificationEvent event )
+    {
+
+        if ( this.viewer == null || this.viewer.getTree() == null || this.viewer.getTree().isDisposed()
+            || this.viewer.getInput() == null || event.getModifiedEntry() != this.viewer.getInput() )
+        {
+            return;
+        }
+
+        // force closing of cell editors
+        if ( this.viewer.isCellEditorActive() )
+        {
+            this.viewer.cancelEditing();
+        }
+
+        // refresh
+        this.viewer.refresh();
+
+        // restore selection
+        if ( event instanceof ValueAddedEvent )
+        {
+            ValueAddedEvent vaEvent = ( ValueAddedEvent ) event;
+            viewer.setSelection( new StructuredSelection( vaEvent.getAddedValue() ), true );
+            this.viewer.refresh();
+        }
+        else if ( event instanceof ValueDeletedEvent )
+        {
+            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 )
+        {
+            EmptyValueAddedEvent evaEvent = ( EmptyValueAddedEvent ) event;
+            viewer.setSelection( new StructuredSelection( evaEvent.getAddedValue() ), true );
+            if ( startEditAction.isEnabled() )
+            {
+                startEditAction.run();
+            }
+        }
+        else if ( event instanceof EmptyValueDeletedEvent )
+        {
+            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 )
+        {
+            ValueModifiedEvent vmEvent = ( ValueModifiedEvent ) event;
+            viewer.setSelection( new StructuredSelection( vmEvent.getNewValue() ), true );
+        }
+        else if ( event instanceof ValueRenamedEvent )
+        {
+            ValueRenamedEvent vrEvent = ( ValueRenamedEvent ) event;
+            viewer.setSelection( new StructuredSelection( vrEvent.getNewValue() ), true );
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenBestEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenBestEditorAction.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenBestEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenBestEditorAction.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,80 @@
+/*
+ *  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.ui.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProvider;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProviderManager;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+public class OpenBestEditorAction extends AbstractOpenEditorAction
+{
+
+    private ValueProvider bestValueProvider;
+
+
+    public OpenBestEditorAction( TreeViewer viewer, EntryEditorWidgetActionGroup actionGroup,
+        ValueProviderManager valueProviderManager )
+    {
+        super( viewer, actionGroup, valueProviderManager );
+    }
+
+
+    public ValueProvider getBestValueProvider()
+    {
+        return this.bestValueProvider;
+    }
+
+
+    protected void updateEnabledState()
+    {
+
+        if ( this.selectedValues.length == 1
+            && this.selectedAttributes.length == 0
+            && this.viewer.getCellModifier().canModify( this.selectedValues[0],
+                EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME ) )
+        {
+            this.bestValueProvider = this.valueProviderManager.getCurrentValueProvider( this.selectedValues[0] );
+            super.cellEditor = this.bestValueProvider.getCellEditor();
+            this.setEnabled( true );
+            this.setText( "" + this.bestValueProvider.getCellEditorName() );
+            this.setToolTipText( "" + this.bestValueProvider.getCellEditorName() );
+            this.setImageDescriptor( this.bestValueProvider.getCellEditorImageDescriptor() );
+        }
+        else
+        {
+            // super.cellEditor = null;
+            this.setEnabled( false );
+            this.setText( "Best Editor" );
+            this.setToolTipText( "Best Editor" );
+            this.setImageDescriptor( null );
+        }
+    }
+
+
+    public void dispose()
+    {
+        this.bestValueProvider = null;
+        super.dispose();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenDefaultEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenDefaultEditorAction.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenDefaultEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenDefaultEditorAction.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,125 @@
+/*
+ *  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.ui.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.actions.RenameAction;
+import org.apache.directory.ldapstudio.browser.ui.actions.proxy.EntryEditorActionProxy;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+public class OpenDefaultEditorAction extends AbstractEntryEditorListenerAction
+{
+
+    private OpenBestEditorAction valueEditorProxy;
+
+    private EntryEditorActionProxy renameProxy;
+
+
+    public OpenDefaultEditorAction( TreeViewer viewer, OpenBestEditorAction proxy )
+    {
+        super( viewer, "Edit Value", null, BrowserUIConstants.ACTION_ID_EDIT_VALUE );
+
+        this.valueEditorProxy = proxy;
+        this.renameProxy = null;
+    }
+
+
+    public void dispose()
+    {
+        this.valueEditorProxy = null;
+        this.renameProxy = null;
+
+        super.dispose();
+    }
+
+
+    public void run()
+    {
+        if ( this.valueEditorProxy != null && this.valueEditorProxy.isEnabled() )
+        {
+            this.valueEditorProxy.run();
+        }
+        else if ( this.renameProxy != null && this.renameProxy.isEnabled() )
+        {
+            this.renameProxy.run();
+        }
+    }
+
+
+    protected void updateEnabledState()
+    {
+
+        // update proxy selections
+        if ( this.valueEditorProxy != 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();
+        }
+
+        // update my state
+        if ( this.valueEditorProxy != null && this.renameProxy != null )
+        {
+            this.setEnabled( this.valueEditorProxy.isEnabled() || this.renameProxy.isEnabled() );
+        }
+        else if ( this.renameProxy != null )
+        {
+            this.setEnabled( this.renameProxy.isEnabled() );
+        }
+        else if ( this.valueEditorProxy != null )
+        {
+            this.setEnabled( this.valueEditorProxy.isEnabled() );
+        }
+        else
+        {
+            this.setEnabled( false );
+        }
+
+        if ( this.valueEditorProxy != null )
+        {
+            this.setImageDescriptor( this.valueEditorProxy.getImageDescriptor() );
+        }
+        else if ( this.renameProxy != null )
+        {
+            this.setImageDescriptor( this.renameProxy.getImageDescriptor() );
+        }
+
+    }
+
+
+    public void enableRenameEntryAction()
+    {
+        this.renameProxy = new EntryEditorActionProxy( valueEditorProxy.viewer, new RenameAction() );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenEditorAction.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenEditorAction.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,89 @@
+/*
+ *  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.ui.widgets.entryeditor;
+
+
+import java.util.Arrays;
+
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProvider;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProviderManager;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+public class OpenEditorAction extends AbstractOpenEditorAction
+{
+
+    private ValueProvider valueProvider;
+
+
+    public OpenEditorAction( TreeViewer viewer, EntryEditorWidgetActionGroup actionGroup,
+        ValueProviderManager valueProviderManager, ValueProvider valueProvider )
+    {
+        super( viewer, actionGroup, valueProviderManager );
+        super.cellEditor = valueProvider.getCellEditor();
+        this.valueProvider = valueProvider;
+
+        this.setText( "" + this.valueProvider.getCellEditorName() );
+        this.setToolTipText( "" + this.valueProvider.getCellEditorName() );
+        this.setImageDescriptor( this.valueProvider.getCellEditorImageDescriptor() );
+    }
+
+
+    public ValueProvider getValueProvider()
+    {
+        return this.valueProvider;
+    }
+
+
+    protected void updateEnabledState()
+    {
+        if ( this.selectedValues.length == 1
+            && this.selectedAttributes.length == 0
+            && this.viewer.getCellModifier().canModify( this.selectedValues[0],
+                EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME ) )
+        {
+            ValueProvider[] alternativeVps = this.valueProviderManager
+                .getAlternativeValueProvider( this.selectedValues[0] );
+            this.setEnabled( Arrays.asList( alternativeVps ).contains( this.valueProvider )
+                && this.valueProvider.getRawValue( this.selectedValues[0] ) != null );
+        }
+        else
+        {
+            this.setEnabled( false );
+        }
+
+    }
+
+
+    public void run()
+    {
+        this.valueProviderManager.setUserSelectedValueProvider( this.valueProvider );
+        super.run();
+    }
+
+
+    public void dispose()
+    {
+        this.valueProvider = null;
+        super.dispose();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenSortDialogAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenSortDialogAction.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenSortDialogAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/OpenSortDialogAction.java Mon Dec 18 09:57:38 2006
@@ -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.ui.widgets.entryeditor;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+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( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.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/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/ldifeditor/LdifEditorWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/ldifeditor/LdifEditorWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/ldifeditor/LdifEditorWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/ldifeditor/LdifEditorWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,167 @@
+/*
+ *  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.ui.widgets.ldifeditor;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.LdifFile;
+import org.apache.directory.ldapstudio.browser.ui.editors.ldif.ILdifEditor;
+import org.apache.directory.ldapstudio.browser.ui.editors.ldif.LdifDocumentProvider;
+import org.apache.directory.ldapstudio.browser.ui.editors.ldif.LdifSourceViewerConfiguration;
+import org.apache.directory.ldapstudio.browser.ui.editors.ldif.NonExistingLdifEditorInput;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class LdifEditorWidget extends BrowserWidget implements ILdifEditor, ITextListener
+{
+
+    private IConnection connection;
+
+    private String initialLdif;
+
+    private boolean contentAssistEnabled;
+
+    private NonExistingLdifEditorInput editorInput;
+
+    private LdifDocumentProvider documentProvider;
+
+    private SourceViewer sourceViewer;
+
+    private LdifSourceViewerConfiguration sourceViewerConfiguration;
+
+
+    public LdifEditorWidget( IConnection connection, String ldif, boolean contentAssistEnabled )
+    {
+        this.connection = connection;
+        this.initialLdif = ldif;
+        this.contentAssistEnabled = contentAssistEnabled;
+    }
+
+
+    public void dispose()
+    {
+        if ( editorInput != null )
+        {
+            sourceViewer.removeTextListener( this );
+            documentProvider.disconnect( editorInput );
+            // documentProvider = null;
+            editorInput = null;
+        }
+    }
+
+
+    public void createWidget( Composite parent )
+    {
+
+        Composite composite = new Composite( parent, SWT.NONE );
+        composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+        GridLayout layout = new GridLayout( 1, false );
+        layout.marginWidth = 0;
+        layout.marginHeight = 0;
+        composite.setLayout( layout );
+
+        // create source viewer
+        // sourceViewer = new ProjectionViewer(parent, ruler,
+        // getOverviewRuler(), true, styles);
+        sourceViewer = new SourceViewer( composite, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
+        sourceViewer.getControl().setLayoutData( new GridData( GridData.FILL_BOTH ) );
+
+        // configure
+        sourceViewerConfiguration = new LdifSourceViewerConfiguration( this, this.contentAssistEnabled );
+        sourceViewer.configure( sourceViewerConfiguration );
+
+        // set font
+        Font font = JFaceResources.getFont( JFaceResources.TEXT_FONT );
+        sourceViewer.getTextWidget().setFont( font );
+
+        // setup document
+        try
+        {
+            editorInput = new NonExistingLdifEditorInput();
+            documentProvider = new LdifDocumentProvider();
+            documentProvider.connect( editorInput );
+
+            IDocument document = documentProvider.getDocument( editorInput );
+            document.set( initialLdif );
+            sourceViewer.setDocument( document );
+        }
+        catch ( CoreException e )
+        {
+            e.printStackTrace();
+        }
+
+        // listener
+        sourceViewer.addTextListener( this );
+
+        // focus
+        sourceViewer.getControl().setFocus();
+
+    }
+
+
+    public IConnection getConnection()
+    {
+        return connection;
+    }
+
+
+    public LdifFile getLdifModel()
+    {
+        return documentProvider.getLdifModel();
+    }
+
+
+    public Object getAdapter( Class adapter )
+    {
+        return null;
+    }
+
+
+    public void textChanged( TextEvent event )
+    {
+        super.notifyListeners();
+    }
+
+
+    public SourceViewer getSourceViewer()
+    {
+        return sourceViewer;
+    }
+
+
+    public LdifSourceViewerConfiguration getSourceViewerConfiguration()
+    {
+        return sourceViewerConfiguration;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/AliasesDereferencingWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/AliasesDereferencingWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/AliasesDereferencingWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/AliasesDereferencingWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,125 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+
+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;
+
+
+public class AliasesDereferencingWidget extends BrowserWidget
+{
+
+    private int initialAliasesDereferencingMethod;
+
+    private Group group;
+
+    private Button findingButton;
+
+    private Button searchButton;
+
+
+    public AliasesDereferencingWidget( int initialAliasesDereferencingMethod )
+    {
+        this.initialAliasesDereferencingMethod = initialAliasesDereferencingMethod;
+    }
+
+
+    public AliasesDereferencingWidget()
+    {
+        this.initialAliasesDereferencingMethod = IConnection.DEREFERENCE_ALIASES_NEVER;
+    }
+
+
+    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();
+            }
+        } );
+
+        this.setAliasesDereferencingMethod( this.initialAliasesDereferencingMethod );
+    }
+
+
+    public void setAliasesDereferencingMethod( int aliasesDereferencingMethod )
+    {
+        this.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 );
+    }
+
+
+    public int getAliasesDereferencingMethod()
+    {
+        if ( this.findingButton.getSelection() && this.searchButton.getSelection() )
+        {
+            return IConnection.DEREFERENCE_ALIASES_ALWAYS;
+        }
+        else if ( this.findingButton.getSelection() )
+        {
+            return IConnection.DEREFERENCE_ALIASES_FINDING;
+        }
+        else if ( this.searchButton.getSelection() )
+        {
+            return IConnection.DEREFERENCE_ALIASES_SEARCH;
+        }
+        else
+        {
+            return IConnection.DEREFERENCE_ALIASES_NEVER;
+        }
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        this.group.setEnabled( b );
+        this.findingButton.setEnabled( b );
+        this.searchButton.setEnabled( b );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ConnectionWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ConnectionWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ConnectionWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ConnectionWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,109 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.ui.dialogs.SelectConnectionDialog;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+
+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;
+
+
+public class ConnectionWidget extends BrowserWidget
+{
+
+    private Text connectionText;
+
+    private Button connectionBrowseButton;
+
+    private IConnection selectedConnection;
+
+
+    public ConnectionWidget( IConnection connection )
+    {
+        this.selectedConnection = connection;
+    }
+
+
+    public ConnectionWidget()
+    {
+        this.selectedConnection = null;
+    }
+
+
+    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
+        this.setConnection( this.selectedConnection );
+
+    }
+
+
+    public IConnection getConnection()
+    {
+        return this.selectedConnection;
+    }
+
+
+    public void setConnection( IConnection connection )
+    {
+        this.selectedConnection = connection;
+        connectionText.setText( this.selectedConnection != null ? this.selectedConnection.getName() : "" );
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        this.connectionText.setEnabled( b );
+        this.connectionBrowseButton.setEnabled( b );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,238 @@
+/*
+ *  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.ui.widgets.search;
+
+
+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.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.dialogs.SelectEntryDialog;
+import org.apache.directory.ldapstudio.browser.ui.jobs.RunnableContextJobAdapter;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.ui.widgets.HistoryUtils;
+
+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;
+
+
+public class EntryWidget extends BrowserWidget
+{
+
+    private Combo dnCombo;
+
+    private Button upButton;
+
+    private Button entryBrowseButton;
+
+    private IConnection connection;
+
+    private DN dn;
+
+
+    public EntryWidget()
+    {
+        this.connection = null;
+        this.dn = null;
+    }
+
+
+    public EntryWidget( IConnection connection, DN dn )
+    {
+        this.connection = connection;
+        this.dn = dn;
+    }
+
+
+    public void createWidget( final Composite parent )
+    {
+
+        // Text and up
+        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( BrowserUIConstants.DIALOGSETTING_KEY_DN_HISTORY );
+        dnCombo.setItems( history );
+        dnCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                if ( dnCombo.getText().length() > 0 )
+                {
+                    try
+                    {
+                        dn = new DN( dnCombo.getText() );
+                    }
+                    catch ( NameException e1 )
+                    {
+                        dn = null;
+                    }
+                }
+                else
+                {
+                    dn = null;
+                }
+
+                internalSetEnabled();
+                notifyListeners();
+            }
+        } );
+        upButton = new Button( textAndUpComposite, SWT.PUSH );
+        upButton.setToolTipText( "Parent" );
+        upButton.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.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();
+                }
+            }
+        } );
+
+        // 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 && connection.getBaseDNEntries() != null
+                        && connection.getBaseDNEntries().length > 0 )
+                    {
+                        entry = connection.getBaseDNEntries()[0];
+                    }
+
+                    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();
+    }
+
+
+    private void dnChanged()
+    {
+        if ( this.dnCombo != null && this.entryBrowseButton != null )
+        {
+            dnCombo.setText( dn != null ? dn.toString() : "" );
+        }
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        dnCombo.setEnabled( b );
+
+        if ( b )
+        {
+            this.dnChanged();
+        }
+
+        internalSetEnabled();
+    }
+
+
+    private void internalSetEnabled()
+    {
+        upButton.setEnabled( dn != null && dn.getParentDn() != null && dnCombo.isEnabled() );
+        entryBrowseButton.setEnabled( this.connection != null && dnCombo.isEnabled() );
+    }
+
+
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( BrowserUIConstants.DIALOGSETTING_KEY_DN_HISTORY, this.dnCombo.getText() );
+    }
+
+
+    public DN getDn()
+    {
+        return this.dn;
+    }
+
+
+    public IConnection getConnection()
+    {
+        return this.connection;
+    }
+
+
+    public void setInput( IConnection connection, DN dn )
+    {
+        if ( this.connection != connection || this.dn != dn )
+        {
+            this.connection = connection;
+            this.dn = dn;
+            dnChanged();
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/FilterWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/FilterWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/FilterWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/FilterWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,168 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterParser;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.dialogs.FilterDialog;
+import org.apache.directory.ldapstudio.browser.ui.editors.filter.FilterContentAssistProcessor;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.widgets.DialogContentAssistant;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.ui.widgets.HistoryUtils;
+
+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;
+
+
+public class FilterWidget extends BrowserWidget
+{
+
+    private Combo filterCombo;
+
+    private Button filterEditorButton;
+
+    private FilterContentAssistProcessor contentAssistProcessor;
+
+    private IConnection connection;
+
+    private String initalFilter;
+
+
+    public FilterWidget( IConnection connection, String initalFilter )
+    {
+        this.connection = connection;
+        this.initalFilter = initalFilter;
+    }
+
+
+    public FilterWidget()
+    {
+        this.connection = null;
+        this.initalFilter = null;
+    }
+
+
+    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();
+            }
+        } );
+        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 );
+
+        // 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( BrowserUIConstants.DIALOGSETTING_KEY_SEARCH_FILTER_HISTORY );
+        filterCombo.setItems( history );
+
+        // initial values
+        this.setConnection( this.connection );
+        filterCombo.setText( initalFilter == null ? "(objectClass=*)" : initalFilter );
+
+    }
+
+
+    public String getFilter()
+    {
+        return this.filterCombo.getText();
+    }
+
+
+    public void setFilter( String filter )
+    {
+        this.filterCombo.setText( filter );
+    }
+
+
+    public void setConnection( IConnection connection )
+    {
+        this.connection = connection;
+        contentAssistProcessor.setPossibleAttributeTypes( connection == null ? new String[0] : connection.getSchema()
+            .getAttributeTypeDescriptionNames() );
+    }
+
+
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( BrowserUIConstants.DIALOGSETTING_KEY_SEARCH_FILTER_HISTORY, this.filterCombo.getText() );
+    }
+
+
+    public void setFocus()
+    {
+        // filterCombo.setFocus();
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        this.filterCombo.setEnabled( b );
+        this.filterEditorButton.setEnabled( b );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/LimitWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/LimitWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/LimitWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/LimitWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,175 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.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;
+
+
+public class LimitWidget extends BrowserWidget
+{
+
+    private int initialCountLimit;
+
+    private int initialTimeLimit;
+
+    private Group limitGroup;
+
+    private Label countLimitLabel;
+
+    private Text countLimitText;
+
+    private Label timeLimitLabel;
+
+    private Text timeLimitText;
+
+
+    public LimitWidget( int initialCountLimit, int initialTimeLimit )
+    {
+        this.initialCountLimit = initialCountLimit;
+        this.initialTimeLimit = initialTimeLimit;
+    }
+
+
+    public LimitWidget()
+    {
+        this.initialCountLimit = 0;
+        this.initialTimeLimit = 0;
+    }
+
+
+    public void createWidget( Composite parent )
+    {
+
+        limitGroup = BaseWidgetUtils.createGroup( parent, "Limits", 1 );
+
+        GridLayout gl = new GridLayout( 2, false );
+        limitGroup.setLayout( gl );
+
+        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();
+            }
+        } );
+
+        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();
+            }
+        } );
+
+        this.setCountLimit( this.initialCountLimit );
+        this.setTimeLimit( this.initialTimeLimit );
+    }
+
+
+    public void setCountLimit( int countLimit )
+    {
+        this.initialCountLimit = countLimit;
+        this.countLimitText.setText( "" + this.initialCountLimit );
+    }
+
+
+    public void setTimeLimit( int timeLimit )
+    {
+        this.initialTimeLimit = timeLimit;
+        this.timeLimitText.setText( "" + this.initialTimeLimit );
+    }
+
+
+    public int getCountLimit()
+    {
+        int countLimit;
+        try
+        {
+            countLimit = new Integer( this.countLimitText.getText() ).intValue();
+        }
+        catch ( NumberFormatException e )
+        {
+            countLimit = 0;
+        }
+        return countLimit;
+    }
+
+
+    public int getTimeLimit()
+    {
+        int timeLimit;
+        try
+        {
+            timeLimit = new Integer( this.timeLimitText.getText() ).intValue();
+        }
+        catch ( NumberFormatException e )
+        {
+            timeLimit = 0;
+        }
+        return timeLimit;
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        limitGroup.setEnabled( b );
+        countLimitLabel.setEnabled( b );
+        countLimitText.setEnabled( b );
+        timeLimitLabel.setEnabled( b );
+        timeLimitText.setEnabled( b );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReferralsHandlingWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReferralsHandlingWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReferralsHandlingWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReferralsHandlingWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,115 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+
+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;
+
+
+public class ReferralsHandlingWidget extends BrowserWidget
+{
+
+    private int initialReferralsHandlingMethod;
+
+    private Group group;
+
+    private Button ignoreButton;
+
+    private Button followButton;
+
+
+    public ReferralsHandlingWidget( int initialReferralsHandlingMethod )
+    {
+        this.initialReferralsHandlingMethod = initialReferralsHandlingMethod;
+    }
+
+
+    public ReferralsHandlingWidget()
+    {
+        this.initialReferralsHandlingMethod = IConnection.HANDLE_REFERRALS_IGNORE;
+    }
+
+
+    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();
+            }
+        } );
+
+        this.setReferralsHandlingMethod( this.initialReferralsHandlingMethod );
+    }
+
+
+    public void setReferralsHandlingMethod( int referralsHandlingMethod )
+    {
+        this.initialReferralsHandlingMethod = referralsHandlingMethod;
+        ignoreButton.setSelection( initialReferralsHandlingMethod == IConnection.HANDLE_REFERRALS_IGNORE );
+        followButton.setSelection( initialReferralsHandlingMethod == IConnection.HANDLE_REFERRALS_FOLLOW );
+    }
+
+
+    public int getReferralsHandlingMethod()
+    {
+        if ( this.ignoreButton.getSelection() )
+        {
+            return IConnection.HANDLE_REFERRALS_IGNORE;
+        }
+        else
+        /* if(this.handleButton.getSelection()) */{
+            return IConnection.HANDLE_REFERRALS_FOLLOW;
+        }
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        this.group.setEnabled( b );
+        this.ignoreButton.setEnabled( b );
+        this.followButton.setEnabled( b );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesContentAssistProcessor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesContentAssistProcessor.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesContentAssistProcessor.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesContentAssistProcessor.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,144 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jface.contentassist.IContentAssistSubjectControl;
+import org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+
+
+public class ReturningAttributesContentAssistProcessor implements ISubjectControlContentAssistProcessor
+{
+
+    private char[] autoActivationCharacters;
+
+    private String[] possibleAttributeTypes;
+
+
+    public ReturningAttributesContentAssistProcessor( String[] possibleAttributeNames )
+    {
+        super();
+        this.setPossibleAttributeTypes( possibleAttributeNames );
+
+        this.autoActivationCharacters = new char[26 + 26];
+        int i = 0;
+        for ( char c = 'a'; c <= 'z'; c++, i++ )
+        {
+            this.autoActivationCharacters[i] = c;
+        }
+        for ( char c = 'A'; c <= 'Z'; c++, i++ )
+        {
+            this.autoActivationCharacters[i] = c;
+        }
+    }
+
+
+    public void setPossibleAttributeTypes( String[] possibleAttributeTypes )
+    {
+        Arrays.sort( possibleAttributeTypes );
+        this.possibleAttributeTypes = possibleAttributeTypes;
+    }
+
+
+    public char[] getCompletionProposalAutoActivationCharacters()
+    {
+        return this.autoActivationCharacters;
+    }
+
+
+    public ICompletionProposal[] computeCompletionProposals( ITextViewer viewer, int offset )
+    {
+        return null;
+    }
+
+
+    public ICompletionProposal[] computeCompletionProposals( IContentAssistSubjectControl contentAssistSubjectControl,
+        int documentOffset )
+    {
+        IDocument document = contentAssistSubjectControl.getDocument();
+        String text = document.get();
+        int start = 0;
+        for ( int i = documentOffset - 1; i >= 0; i-- )
+        {
+            char c = text.charAt( i );
+            if ( c == ',' || Character.isWhitespace( c ) )
+            {
+                start = i + 1;
+                break;
+            }
+        }
+        String attribute = text.substring( start, documentOffset );
+
+        List proposalList = new ArrayList();
+        for ( int k = 0; k < this.possibleAttributeTypes.length; k++ )
+        {
+            if ( this.possibleAttributeTypes[k].startsWith( attribute ) )
+            {
+                ICompletionProposal proposal = new CompletionProposal( this.possibleAttributeTypes[k] + ", ", start,
+                    documentOffset - start, this.possibleAttributeTypes[k].length() + 2, null,
+                    this.possibleAttributeTypes[k], null, null );
+                proposalList.add( proposal );
+            }
+        }
+        return ( ICompletionProposal[] ) proposalList.toArray( new ICompletionProposal[0] );
+    }
+
+
+    public char[] getContextInformationAutoActivationCharacters()
+    {
+        return null;
+    }
+
+
+    public IContextInformation[] computeContextInformation( ITextViewer viewer, int offset )
+    {
+        return null;
+    }
+
+
+    public IContextInformation[] computeContextInformation( IContentAssistSubjectControl contentAssistSubjectControl,
+        int documentOffset )
+    {
+        return null;
+    }
+
+
+    public String getErrorMessage()
+    {
+        return null;
+    }
+
+
+    public IContextInformationValidator getContextInformationValidator()
+    {
+        return null;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ReturningAttributesWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,145 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.utils.Utils;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.ldapstudio.browser.ui.widgets.DialogContentAssistant;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+import org.apache.directory.ldapstudio.browser.ui.widgets.HistoryUtils;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class ReturningAttributesWidget extends BrowserWidget
+{
+
+    private Combo returningAttributesCombo;
+
+    private ReturningAttributesContentAssistProcessor contentAssistProcessor;
+
+    private IConnection connection;
+
+    private String[] initialReturningAttributes;
+
+
+    public ReturningAttributesWidget( IConnection connection, String[] initialReturningAttributes )
+    {
+        this.connection = connection;
+        this.initialReturningAttributes = initialReturningAttributes;
+    }
+
+
+    public ReturningAttributesWidget()
+    {
+        this.connection = null;
+        this.initialReturningAttributes = null;
+    }
+
+
+    public void createWidget( Composite parent )
+    {
+
+        returningAttributesCombo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 );
+
+        GridData gd = new GridData( GridData.FILL_HORIZONTAL );
+        gd.horizontalSpan = 1;
+        gd.widthHint = 200;
+        returningAttributesCombo.setLayoutData( gd );
+
+        contentAssistProcessor = new ReturningAttributesContentAssistProcessor( new String[0] );
+        DialogContentAssistant raca = new DialogContentAssistant();
+        raca.enableAutoInsert( true );
+        raca.enableAutoActivation( true );
+        raca.setAutoActivationDelay( 500 );
+        raca.setContentAssistProcessor( contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE );
+        raca.install( returningAttributesCombo );
+
+        String[] history = HistoryUtils.load( BrowserUIConstants.DIALOGSETTING_KEY_RETURNING_ATTRIBUTES_HISTORY );
+        for ( int i = 0; i < history.length; i++ )
+        {
+            history[i] = Utils.arrayToString( Utils.stringToArray( history[i] ) );
+        }
+        returningAttributesCombo.setItems( history );
+        returningAttributesCombo.setText( Utils.arrayToString( this.initialReturningAttributes ) );
+
+        returningAttributesCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        this.setConnection( this.connection );
+    }
+
+
+    public void setConnection( IConnection connection )
+    {
+        this.connection = connection;
+        contentAssistProcessor.setPossibleAttributeTypes( connection == null ? new String[0] : connection.getSchema()
+            .getAttributeTypeDescriptionNames() );
+    }
+
+
+    public void setInitialReturningAttributes( String[] initialReturningAttributes )
+    {
+        this.initialReturningAttributes = initialReturningAttributes;
+        returningAttributesCombo.setText( Utils.arrayToString( this.initialReturningAttributes ) );
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        this.returningAttributesCombo.setEnabled( b );
+    }
+
+
+    public String[] getReturningAttributes()
+    {
+        String s = this.returningAttributesCombo.getText();
+        return Utils.stringToArray( s );
+    }
+
+
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( BrowserUIConstants.DIALOGSETTING_KEY_RETURNING_ATTRIBUTES_HISTORY, Utils
+            .arrayToString( getReturningAttributes() ) );
+    }
+
+
+    public void setFocus()
+    {
+        returningAttributesCombo.setFocus();
+
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ScopeWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ScopeWidget.java?view=auto&rev=488371
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ScopeWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/widgets/search/ScopeWidget.java Mon Dec 18 09:57:38 2006
@@ -0,0 +1,140 @@
+/*
+ *  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.ui.widgets.search;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BrowserWidget;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+
+public class ScopeWidget extends BrowserWidget
+{
+
+    private int initialScope;
+
+    private Group scopeGroup;
+
+    private Button scopeObjectButton;
+
+    private Button scopeOnelevelButton;
+
+    private Button scopeSubtreeButton;
+
+
+    public ScopeWidget( int initialScope )
+    {
+        this.initialScope = initialScope;
+    }
+
+
+    public ScopeWidget()
+    {
+        this.initialScope = 0;
+    }
+
+
+    public void createWidget( Composite parent )
+    {
+
+        // Search Scope
+        scopeGroup = new Group( parent, SWT.NONE );
+        scopeGroup.setText( "Scope" );
+        scopeGroup.setLayout( new GridLayout( 1, false ) );
+        scopeGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+
+        scopeObjectButton = new Button( scopeGroup, SWT.RADIO );
+        scopeObjectButton.setText( "&Object" );
+        scopeObjectButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+        scopeOnelevelButton = new Button( scopeGroup, SWT.RADIO );
+        scopeOnelevelButton.setText( "One &Level" );
+        scopeOnelevelButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+        scopeSubtreeButton = new Button( scopeGroup, SWT.RADIO );
+        scopeSubtreeButton.setText( "&Subtree" );
+        scopeSubtreeButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        setScope( this.initialScope );
+    }
+
+
+    public void setScope( int scope )
+    {
+        this.initialScope = scope;
+
+        scopeObjectButton.setSelection( initialScope == ISearch.SCOPE_OBJECT );
+        scopeOnelevelButton.setSelection( initialScope == ISearch.SCOPE_ONELEVEL );
+        scopeSubtreeButton.setSelection( initialScope == ISearch.SCOPE_SUBTREE );
+
+    }
+
+
+    public int getScope()
+    {
+        int scope;
+
+        if ( this.scopeSubtreeButton.getSelection() )
+            scope = ISearch.SCOPE_SUBTREE;
+        else if ( this.scopeOnelevelButton.getSelection() )
+            scope = ISearch.SCOPE_ONELEVEL;
+        else if ( this.scopeObjectButton.getSelection() )
+            scope = ISearch.SCOPE_OBJECT;
+        else
+            scope = ISearch.SCOPE_ONELEVEL;
+
+        return scope;
+    }
+
+
+    public void setEnabled( boolean b )
+    {
+        scopeGroup.setEnabled( b );
+        scopeObjectButton.setEnabled( b );
+        scopeOnelevelButton.setEnabled( b );
+        scopeSubtreeButton.setEnabled( b );
+    }
+
+}



Mime
View raw message