directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592079 [14/17] - in /directory/sandbox/felixk/studio-ldapbrowser-common: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/...
Date Mon, 05 Nov 2007 16:48:54 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java Mon Nov  5 08:48:35 2007
@@ -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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.valueeditors.IValueEditor;
+import org.apache.directory.studio.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 valueEditorManager the value editor manager
+     */
+    public OpenBestEditorAction( TreeViewer viewer, ValueEditorManager valueEditorManager )
+    {
+        super( viewer, valueEditorManager );
+    }
+
+
+    /**
+     * Gets the best value editor.
+     * 
+     * @return the best value editor
+     */
+    public IValueEditor getBestValueEditor()
+    {
+        return this.bestValueEditor;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.AbstractOpenEditorAction#dispose()
+     */
+    public void dispose()
+    {
+        bestValueEditor = null;
+        super.dispose();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getCommandId()
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getImageDescriptor()
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return isEnabled() ? bestValueEditor.getValueEditorImageDescriptor() : null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getText()
+     */
+    public String getText()
+    {
+        return isEnabled() ? bestValueEditor.getValueEditorName() : null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#isEnabled()
+     */
+    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;
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,154 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.RenameAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * 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, null, new RenameAction() ) : null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#dispose()
+     */
+    public void dispose()
+    {
+        bestValueEditorProxy = null;
+        renameProxy = null;
+
+        super.dispose();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getCommandId()
+     */
+    public String getCommandId()
+    {
+        return BrowserCommonConstants.ACTION_ID_EDIT_VALUE;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getImageDescriptor()
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        if ( bestValueEditorProxy != null )
+        {
+            return bestValueEditorProxy.getImageDescriptor();
+        }
+        else if ( renameProxy != null )
+        {
+            return renameProxy.getImageDescriptor();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getText()
+     */
+    public String getText()
+    {
+        return "Edit Value";
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#isEnabled()
+     */
+    public boolean isEnabled()
+    {
+        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;
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#run()
+     */
+    public void run()
+    {
+        if ( bestValueEditorProxy != null && bestValueEditorProxy.isEnabled() )
+        {
+            bestValueEditorProxy.run();
+        }
+        else if ( renameProxy != null && renameProxy.isEnabled() )
+        {
+            renameProxy.run();
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenDefaultEditorAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenEditorAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenEditorAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenEditorAction.java Mon Nov  5 08:48:35 2007
@@ -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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import java.util.Arrays;
+
+import org.apache.directory.studio.valueeditors.IValueEditor;
+import org.apache.directory.studio.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 valueEditorManager the value editor manager
+     * @param valueEditor the specific value editor
+     */
+    public OpenEditorAction( TreeViewer viewer, ValueEditorManager valueEditorManager, IValueEditor valueEditor )
+    {
+        super( viewer, valueEditorManager );
+        super.cellEditor = valueEditor.getCellEditor();
+        this.valueEditor = valueEditor;
+    }
+
+
+    /**
+     * Gets the value editor.
+     * 
+     * @return the value editor
+     */
+    public IValueEditor getValueEditor()
+    {
+        return valueEditor;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.AbstractOpenEditorAction#run()
+     */
+    public void run()
+    {
+        // ensure that the specific value editor is activated 
+        valueEditorManager.setUserSelectedValueEditor( valueEditor );
+
+        super.run();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.AbstractOpenEditorAction#dispose()
+     */
+    public void dispose()
+    {
+        this.valueEditor = null;
+        super.dispose();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getCommandId()
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getImageDescriptor()
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return valueEditor.getValueEditorImageDescriptor();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#getText()
+     */
+    public String getText()
+    {
+        return valueEditor.getValueEditorName();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction#isEnabled()
+     */
+    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;
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenEditorAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenSortDialogAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenSortDialogAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenSortDialogAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenSortDialogAction.java Mon Nov  5 08:48:35 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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.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();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenSortDialogAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ShowQuickFilterAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ShowQuickFilterAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ShowQuickFilterAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ShowQuickFilterAction.java Mon Nov  5 08:48:35 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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.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;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ShowQuickFilterAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/AliasesDereferencingWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/AliasesDereferencingWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/AliasesDereferencingWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/AliasesDereferencingWidget.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.AliasDereferencingMethod;
+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 AliasDereferencingMethod 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
+     * dereferencing method.
+     * 
+     * @param initialAliasesDereferencingMethod the initial aliases dereferencing method
+     */
+    public AliasesDereferencingWidget( AliasDereferencingMethod initialAliasesDereferencingMethod )
+    {
+        this.initialAliasesDereferencingMethod = initialAliasesDereferencingMethod;
+    }
+
+
+    /**
+     * Creates a new instance of AliasesDereferencingWidget. The initial 
+     * dereferencing method is set to {@link AliasDereferencingMethod.NEVER}.
+     */
+    public AliasesDereferencingWidget()
+    {
+        this.initialAliasesDereferencingMethod = AliasDereferencingMethod.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.
+     * 
+     * @param aliasesDereferencingMethod the aliases dereferencing method
+     */
+    public void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod )
+    {
+        initialAliasesDereferencingMethod = aliasesDereferencingMethod;
+        findingButton.setSelection( initialAliasesDereferencingMethod == AliasDereferencingMethod.FINDING
+            || initialAliasesDereferencingMethod == AliasDereferencingMethod.ALWAYS );
+        searchButton.setSelection( initialAliasesDereferencingMethod == AliasDereferencingMethod.SEARCH
+            || initialAliasesDereferencingMethod == AliasDereferencingMethod.ALWAYS );
+    }
+
+
+    /**
+     * Gets the aliases dereferencing method.
+     * 
+     * @return the aliases dereferencing method
+     */
+    public AliasDereferencingMethod getAliasesDereferencingMethod()
+    {
+        if ( findingButton.getSelection() && searchButton.getSelection() )
+        {
+            return AliasDereferencingMethod.ALWAYS;
+        }
+        else if ( findingButton.getSelection() )
+        {
+            return AliasDereferencingMethod.FINDING;
+        }
+        else if ( searchButton.getSelection() )
+        {
+            return AliasDereferencingMethod.SEARCH;
+        }
+        else
+        {
+            return AliasDereferencingMethod.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 );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/AliasesDereferencingWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,143 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import org.apache.directory.studio.ldapbrowser.common.dialogs.SelectBrowserConnectionDialog;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+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 BrowserConnectionWidget could be used to select an {@link IBrowserConnection}. 
+ * It is composed of a text to display the selected connection
+ * and a browse button to open a {@link SelectBrowserConnectionDialog}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserConnectionWidget extends BrowserWidget
+{
+
+    /** The connection text, displays the selected connection */
+    private Text browserConnectionText;
+
+    /** The connection browse button, opens the dialog */
+    private Button connectionBrowseButton;
+
+    /** The selected connection */
+    private IBrowserConnection selectedBrowserConnection;
+
+
+    /**
+     * Creates a new instance of ConnectionWidget.
+     * 
+     * @param connection the initial connection
+     */
+    public BrowserConnectionWidget( IBrowserConnection connection )
+    {
+        this.selectedBrowserConnection = connection;
+    }
+
+
+    /**
+     * Creates a new instance of ConnectionWidget with no initial connection.
+     */
+    public BrowserConnectionWidget()
+    {
+        this.selectedBrowserConnection = null;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( final Composite parent )
+    {
+        // Text
+        browserConnectionText = BaseWidgetUtils.createReadonlyText( parent, "", 1 );
+
+        // Button
+        connectionBrowseButton = BaseWidgetUtils.createButton( parent, "B&rowse...", 1 );
+        connectionBrowseButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                SelectBrowserConnectionDialog dialog = new SelectBrowserConnectionDialog( parent.getShell(),
+                    "Select Connection", selectedBrowserConnection );
+                dialog.open();
+                IBrowserConnection browserConnection = dialog.getSelectedBrowserConnection();
+                if ( browserConnection != null )
+                {
+                    setBrowserConnection( browserConnection );
+                    notifyListeners();
+                }
+            }
+        } );
+
+        // initial values
+        setBrowserConnection( selectedBrowserConnection );
+    }
+
+
+    /**
+     * Gets the selected connection.
+     * 
+     * @return the connection
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return selectedBrowserConnection;
+    }
+
+
+    /**
+     * Sets the selected connection.
+     * 
+     * @param connection the connection
+     */
+    public void setBrowserConnection( IBrowserConnection connection )
+    {
+        selectedBrowserConnection = connection;
+        browserConnectionText.setText( selectedBrowserConnection != null ? selectedBrowserConnection.getConnection().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 )
+    {
+        browserConnectionText.setEnabled( b );
+        connectionBrowseButton.setEnabled( b );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,360 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import javax.naming.InvalidNameException;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.SelectEntryDialog;
+import org.apache.directory.studio.ldapbrowser.common.jobs.RunnableContextJobAdapter;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
+import org.apache.directory.studio.ldapbrowser.common.widgets.HistoryUtils;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ReadEntryJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
+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 IBrowserConnection browserConnection;
+
+    /** The selected DN. */
+    private LdapDN dn;
+
+    /** The suffix. */
+    private LdapDN suffix;
+
+
+    /**
+     * Creates a new instance of EntryWidget.
+     */
+    public EntryWidget()
+    {
+        this.browserConnection = null;
+        this.dn = null;
+    }
+
+
+    /**
+     * Creates a new instance of EntryWidget.
+     *
+     * @param browserConnection the connection
+     * @param dn the initial DN
+     */
+    public EntryWidget( IBrowserConnection browserConnection, LdapDN dn )
+    {
+        this( browserConnection, dn, null );
+    }
+
+
+    /**
+     * Creates a new instance of EntryWidget.
+     *
+     * @param browserConnection the connection
+     * @param dn the initial DN
+     * @param suffix the suffix
+     */
+    public EntryWidget( IBrowserConnection browserConnection, LdapDN dn, LdapDN suffix )
+    {
+        this.browserConnection = browserConnection;
+        this.dn = dn;
+        this.suffix = suffix;
+    }
+
+
+    /**
+     * 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 LdapDN( dnCombo.getText() );
+                }
+                catch ( InvalidNameException 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 && DnUtils.getParent( dn ) != null )
+                {
+                    dn = DnUtils.getParent( dn );
+                    dnChanged();
+                    internalSetEnabled();
+                    notifyListeners();
+                }
+            }
+        } );
+
+        // Browse button
+        entryBrowseButton = BaseWidgetUtils.createButton( parent, "Br&owse...", 1 );
+        entryBrowseButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                if ( browserConnection != null )
+                {
+                    // get root entry
+                    IEntry rootEntry = browserConnection.getRootDSE();
+                    if( suffix != null && suffix.size() > 0 )
+                    {
+                        rootEntry = browserConnection.getEntryFromCache( suffix );
+                        if ( rootEntry == null )
+                        {
+                            ReadEntryJob job = new ReadEntryJob( browserConnection, suffix );
+                            RunnableContextJobAdapter.execute( job );
+                            rootEntry = job.getReadEntry();
+                        }
+                    }
+
+                    // calculate initial DN
+                    LdapDN initialDN = dn;
+                    if( suffix != null && suffix.size() > 0 )
+                    {
+                        if( initialDN != null && initialDN.size() > 0 )
+                        {
+                            initialDN = DnUtils.composeDn( initialDN, suffix );
+                        }
+                    }
+
+                    // get initial entry
+                    IEntry entry = rootEntry;
+                    if ( initialDN != null && initialDN.size() > 0 )
+                    {
+                        entry = browserConnection.getEntryFromCache( initialDN );
+                        if ( entry == null )
+                        {
+                            ReadEntryJob job = new ReadEntryJob( browserConnection, initialDN );
+                            RunnableContextJobAdapter.execute( job );
+                            entry = job.getReadEntry();
+                        }
+                    }
+
+
+                    // open dialog
+                    SelectEntryDialog dialog = new SelectEntryDialog( parent.getShell(), "Select DN", rootEntry, entry );
+                    dialog.open();
+                    IEntry selectedEntry = dialog.getSelectedEntry();
+
+                    // get selected DN
+                    if ( selectedEntry != null )
+                    {
+                        dn = selectedEntry.getDn();
+                        if( suffix != null && suffix.size() > 0 )
+                        {
+                            dn = DnUtils.getPrefixName( dn, suffix );
+                        }
+                        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.getUpName() : "" );
+        }
+    }
+
+
+    /**
+     * 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 && DnUtils.getParent( dn ) != null && dnCombo.isEnabled() );
+        entryBrowseButton.setEnabled( browserConnection != null && dnCombo.isEnabled() );
+    }
+
+
+    /**
+     * Saves dialog settings.
+     */
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( BrowserCommonConstants.DIALOGSETTING_KEY_DN_HISTORY, this.dnCombo.getText() );
+    }
+
+
+    /**
+     * Gets the suffix DN or <code>null</code> if not set.
+     *
+     * @return the suffix DN or <code>null</code> if not set
+     */
+    public LdapDN getSuffix()
+    {
+        return suffix;
+    }
+
+
+    /**
+     * Gets the DN or <code>null</code> if the DN isn't valid.
+     *
+     * @return the DN or <code>null</code> if the DN isn't valid
+     */
+    public LdapDN getDn()
+    {
+        return dn;
+    }
+
+
+    /**
+     * Gets the browser connection.
+     *
+     * @return the browser connection
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return browserConnection;
+    }
+
+
+    /**
+     * Sets the input.
+     *
+     * @param dn the DN
+     * @param browserConnection the connection
+     */
+    public void setInput( IBrowserConnection browserConnection, LdapDN dn )
+    {
+        setInput( browserConnection, dn, null );
+    }
+
+
+    /**
+     * Sets the input.
+     *
+     * @param browserConnection the connection
+     * @param dn the DN
+     * @param suffix the suffix
+     */
+    public void setInput( IBrowserConnection browserConnection, LdapDN dn, LdapDN suffix )
+    {
+        if ( this.browserConnection != browserConnection || this.dn != dn || this.suffix != suffix )
+        {
+            this.browserConnection = browserConnection;
+            this.dn = dn;
+            this.suffix = suffix;
+            dnChanged();
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,254 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.FilterDialog;
+import org.apache.directory.studio.ldapbrowser.common.filtereditor.FilterContentAssistProcessor;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
+import org.apache.directory.studio.ldapbrowser.common.widgets.HistoryUtils;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;
+import org.eclipse.jface.fieldassist.DecoratedField;
+import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.fieldassist.IControlCreator;
+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;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * The FileterWidget could be used to specify an LDAP filter. 
+ * It is composed of a combo with a content assist 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 filter combo field. */
+    private DecoratedField filterComboField;
+
+    /** The filter content proposal adapter */
+    private ContentProposalAdapter filterCPA;
+
+    /** The button to open the filter editor. */
+    private Button filterEditorButton;
+
+    /** The content assist processor. */
+    private FilterContentAssistProcessor contentAssistProcessor;
+
+    /** The connection. */
+    private IBrowserConnection browserConnection;
+
+    /** The inital filter. */
+    private String initalFilter;
+
+    /** The filter parser. */
+    private LdapFilterParser parser;
+
+
+    /**
+     * Creates a new instance of FilterWidget.
+     * 
+     * @param browserConnection the connection
+     * @param initalFilter the inital filter
+     */
+    public FilterWidget( IBrowserConnection browserConnection, String initalFilter )
+    {
+        this.browserConnection = browserConnection;
+        this.initalFilter = initalFilter;
+    }
+
+
+    /**
+     * Creates a new instance of FilterWidget with no connection and
+     * no initial filter.
+     */
+    public FilterWidget()
+    {
+        this.browserConnection = null;
+        this.initalFilter = null;
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent the parent
+     */
+    public void createWidget( final Composite parent )
+    {
+        // filter combo with field decoration
+        final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
+            FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
+        filterComboField = new DecoratedField( parent, SWT.NONE, new IControlCreator()
+        {
+            public Control createControl( Composite parent, int style )
+            {
+                Combo combo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 );
+                GridData gd = new GridData( GridData.FILL_HORIZONTAL );
+                gd.horizontalSpan = 1;
+                gd.widthHint = 200;
+                combo.setLayoutData( gd );
+                combo.setVisibleItemCount( 20 );
+                return combo;
+            }
+        } );
+        filterComboField.addFieldDecoration( fieldDecoration, SWT.TOP | SWT.LEFT, true );
+        filterComboField.getLayoutControl().setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+        filterCombo = ( Combo ) filterComboField.getControl();
+        filterCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                notifyListeners();
+            }
+        } );
+
+        parser = new LdapFilterParser();
+        contentAssistProcessor = new FilterContentAssistProcessor( parser );
+        filterCPA = new ContentProposalAdapter( filterCombo, new ComboContentAdapter(), contentAssistProcessor,
+            KeyStroke.getInstance( SWT.CTRL, ' ' ), null );
+        filterCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        filterCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE );
+
+        // auto edit strategy
+        new FilterWidgetAutoEditStrategyAdapter( filterCombo, parser );
+
+        // Filter editor button
+        filterEditorButton = BaseWidgetUtils.createButton( parent, "F&ilter Editor...", 1 );
+        filterEditorButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                if ( browserConnection != null )
+                {
+                    FilterDialog dialog = new FilterDialog( parent.getShell(), "Filter Editor", filterCombo.getText(),
+                        browserConnection );
+                    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
+        setBrowserConnection( browserConnection );
+        filterCombo.setText( initalFilter == null ? "(objectClass=*)" : initalFilter );
+    }
+
+
+    /**
+     * Gets the filter or null if the filter is invalid. 
+     * 
+     * @return the filter or null if the filter is invalid
+     */
+    public String getFilter()
+    {
+        parser.parse( filterCombo.getText() );
+        return parser.getModel().isValid() ? filterCombo.getText() : null;
+    }
+
+
+    /**
+     * Sets the filter.
+     * 
+     * @param filter the filter
+     */
+    public void setFilter( String filter )
+    {
+        filterCombo.setText( filter );
+    }
+
+
+    /**
+     * Sets the browser connection.
+     * 
+     * @param browserConnection the browser connection
+     */
+    public void setBrowserConnection( IBrowserConnection browserConnection )
+    {
+        if ( this.browserConnection != browserConnection )
+        {
+            this.browserConnection = browserConnection;
+            contentAssistProcessor.setSchema( browserConnection == null ? null : browserConnection.getSchema() );
+            filterCPA.setAutoActivationCharacters( contentAssistProcessor
+                .getCompletionProposalAutoActivationCharacters() );
+        }
+    }
+
+
+    /**
+     * 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 );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidgetAutoEditStrategyAdapter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidgetAutoEditStrategyAdapter.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidgetAutoEditStrategyAdapter.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidgetAutoEditStrategyAdapter.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,171 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.ldapbrowser.common.filtereditor.FilterAutoEditStrategy;
+import org.apache.directory.studio.ldapbrowser.common.filtereditor.FilterAutoEditStrategy.AutoEditParameters;
+import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
+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.graphics.Point;
+import org.eclipse.swt.widgets.Combo;
+
+
+/**
+ * The FilterWidgetAutoEditStrategyAdapter is used to integrate the {@link FilterAutoEditStrategy} 
+ * into an combo field.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class FilterWidgetAutoEditStrategyAdapter
+{
+
+    /** The auto edit strategy. */
+    private FilterAutoEditStrategy autoEditStrategy;
+
+    /** The combo. */
+    private Combo combo;
+
+    /** The old texts. */
+    private List<String> oldTexts;
+
+    /** The verify events. */
+    private List<VerifyEvent> verifyEvents;
+
+    /** The in apply combo customization flag. */
+    private boolean inApplyComboCustomization;
+
+
+    /**
+     * Creates a new instance of FilterWidgetAutoEditStrategyAdapter.
+     * 
+     * @param combo the combo
+     * @param parser the filter parser
+     */
+    public FilterWidgetAutoEditStrategyAdapter( Combo combo, LdapFilterParser parser )
+    {
+        this.combo = combo;
+
+        this.oldTexts = new ArrayList<String>();
+        this.verifyEvents = new ArrayList<VerifyEvent>();
+        this.inApplyComboCustomization = false;
+
+        this.autoEditStrategy = new FilterAutoEditStrategy( parser );
+        combo.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                prepareComboCustomization( e );
+            }
+        } );
+        combo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                applyComboCustomization( e );
+            }
+        } );
+    }
+
+
+    /**
+     * Prepares combo customization.
+     * 
+     * @param e the verify event
+     */
+    public void prepareComboCustomization( VerifyEvent e )
+    {
+        //System.out.println(e);
+        if ( !inApplyComboCustomization )
+        {
+            String oldText = combo.getText();
+            //parser.parse( oldText );
+
+            oldTexts.add( oldText );
+            verifyEvents.add( e );
+        }
+    }
+
+
+    /**
+     * Applies combo customization.
+     * 
+     * @param e the modify event
+     */
+    public void applyComboCustomization( ModifyEvent e )
+    {
+        //System.out.println(e);
+        if ( !inApplyComboCustomization && !verifyEvents.isEmpty() )
+        {
+            String oldText = oldTexts.remove( 0 );
+            VerifyEvent verifyEvent = verifyEvents.remove( 0 );
+            inApplyComboCustomization = true;
+
+            // extract modification details
+            String text = verifyEvent.text;
+            int offset = verifyEvent.start <= verifyEvent.end ? verifyEvent.start : verifyEvent.end;
+            int length = verifyEvent.start <= verifyEvent.end ? verifyEvent.end - verifyEvent.start : verifyEvent.start
+                - verifyEvent.end;
+
+            // apply auto edit strategy
+            AutoEditParameters autoEditParameters = new AutoEditParameters( text, offset, length, -1, true );
+            autoEditStrategy.customizeAutoEditParameters( oldText, autoEditParameters );
+
+            // get current selection
+            Point oldSelection = combo.getSelection();
+
+            // compose new text
+            String newText = "";
+            newText += oldText.substring( 0, autoEditParameters.offset );
+            newText += autoEditParameters.text;
+            newText += oldText.substring( autoEditParameters.offset + autoEditParameters.length, oldText.length() );
+
+            // determine new cursor position
+            Point newSelection;
+            if ( autoEditParameters.caretOffset != -1 )
+            {
+                int x = autoEditParameters.caretOffset;
+                newSelection = new Point( x, x );
+            }
+            else
+            {
+                newSelection = new Point( oldSelection.x, oldSelection.y );
+            }
+
+            // set new text and cursor position
+            if ( verifyEvents.isEmpty() )
+            {
+                combo.setText( newText );
+                combo.setSelection( newSelection );
+            }
+
+            inApplyComboCustomization = false;
+        }
+
+    }
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidgetAutoEditStrategyAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/LimitWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/LimitWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/LimitWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/LimitWidget.java Mon Nov  5 08:48:35 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.studio.ldapbrowser.common.widgets.search;
+
+
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.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 );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/LimitWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReferralsHandlingWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReferralsHandlingWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReferralsHandlingWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReferralsHandlingWidget.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,156 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
+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 ReferralHandlingMethod 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.  
+     * 
+     * @param initialReferralsHandlingMethod the initial referrals handling method
+     */
+    public ReferralsHandlingWidget( ReferralHandlingMethod initialReferralsHandlingMethod )
+    {
+        this.initialReferralsHandlingMethod = initialReferralsHandlingMethod;
+    }
+
+
+    /**
+     * Creates a new instance of ReferralsHandlingWidget with initial 
+     * referrals handling method {@link ReferralHandlingMethod.IGNORE}.
+     */
+    public ReferralsHandlingWidget()
+    {
+        this.initialReferralsHandlingMethod = ReferralHandlingMethod.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. 
+     * 
+     * @param referralsHandlingMethod the referrals handling method
+     */
+    public void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod )
+    {
+        initialReferralsHandlingMethod = referralsHandlingMethod;
+        ignoreButton.setSelection( initialReferralsHandlingMethod == ReferralHandlingMethod.IGNORE );
+        followButton.setSelection( initialReferralsHandlingMethod == ReferralHandlingMethod.FOLLOW );
+    }
+
+
+    /**
+     * Gets the referrals handling method.
+     * 
+     * @return the referrals handling method
+     */
+    public ReferralHandlingMethod getReferralsHandlingMethod()
+    {
+        if ( ignoreButton.getSelection() )
+        {
+            return ReferralHandlingMethod.IGNORE;
+        }
+        else
+        {
+            return ReferralHandlingMethod.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 );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReferralsHandlingWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesContentAssistProcessor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesContentAssistProcessor.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesContentAssistProcessor.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesContentAssistProcessor.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,223 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+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;
+
+
+/**
+ * The ReturningAttributesContentAssistProcessor provides proposals for the 
+ * {@link ReturningAttributesWidget}. It splits the comma separted text input
+ * into separate regions.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReturningAttributesContentAssistProcessor implements ISubjectControlContentAssistProcessor
+{
+
+    /** The auto activation characters */
+    private char[] autoActivationCharacters;
+
+    /** The possible attribute types */
+    private String[] possibleAttributeTypes;
+
+
+    /**
+     * Creates a new instance of ReturningAttributesContentAssistProcessor.
+     *
+     * @param possibleAttributeNames
+     */
+    public ReturningAttributesContentAssistProcessor( String[] possibleAttributeNames )
+    {
+        super();
+        setPossibleAttributeTypes( possibleAttributeTypes );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public char[] getCompletionProposalAutoActivationCharacters()
+    {
+        return autoActivationCharacters;
+    }
+
+
+    /**
+     * Sets the possible attribute types.
+     * 
+     * @param possibleAttributeTypes the possible strings
+     */
+    public void setPossibleAttributeTypes( String[] possibleAttributeTypes )
+    {
+        if ( possibleAttributeTypes == null )
+        {
+            possibleAttributeTypes = new String[0];
+        }
+
+        // set possible strings
+        Arrays.sort( possibleAttributeTypes );
+        this.possibleAttributeTypes = possibleAttributeTypes;
+
+        // set auto activation characters
+        Set<Character> characterSet = new HashSet<Character>();
+        for ( int i = 0; i < possibleAttributeTypes.length; i++ )
+        {
+            String string = possibleAttributeTypes[i];
+            for ( int k = 0; k < string.length(); k++ )
+            {
+                char ch = string.charAt( k );
+                characterSet.add( Character.toLowerCase( ch ) );
+                characterSet.add( Character.toUpperCase( ch ) );
+            }
+        }
+        autoActivationCharacters = new char[characterSet.size()];
+        int i = 0;
+        for ( Iterator<Character> it = characterSet.iterator(); it.hasNext(); )
+        {
+            Character ch = it.next();
+            autoActivationCharacters[i] = ch.charValue();
+            i++;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation always returns null.
+     */
+    public ICompletionProposal[] computeCompletionProposals( ITextViewer viewer, int offset )
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ICompletionProposal[] computeCompletionProposals( IContentAssistSubjectControl contentAssistSubjectControl,
+        int documentOffset )
+    {
+        IDocument document = contentAssistSubjectControl.getDocument();
+        String text = document.get();
+       
+        // search start of current attribute type
+        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 );
+
+        // create proposal list
+        List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
+        for ( int k = 0; k < possibleAttributeTypes.length; k++ )
+        {
+            if ( possibleAttributeTypes[k].toUpperCase().startsWith( attribute.toUpperCase() ) )
+            {
+                ICompletionProposal proposal = new CompletionProposal( possibleAttributeTypes[k] + ", ", start,
+                    documentOffset - start, possibleAttributeTypes[k].length() + 2, null, possibleAttributeTypes[k],
+                    null, null );
+                proposalList.add( proposal );
+            }
+        }
+        return proposalList.toArray( new ICompletionProposal[proposalList.size()] );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation always returns null.
+     */
+    public char[] getContextInformationAutoActivationCharacters()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation always returns null.
+     */
+    public IContextInformation[] computeContextInformation( ITextViewer viewer, int offset )
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation always returns null.
+     */
+    public IContextInformation[] computeContextInformation( IContentAssistSubjectControl contentAssistSubjectControl,
+        int documentOffset )
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation always returns null.
+     */
+    public String getErrorMessage()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation always returns null.
+     */
+    public IContextInformationValidator getContextInformationValidator()
+    {
+        return null;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesContentAssistProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message