directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r751549 - in /directory/studio/trunk: ldapbrowser-common/resources/icons/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actio...
Date Sun, 08 Mar 2009 23:22:33 GMT
Author: seelmann
Date: Sun Mar  8 23:22:32 2009
New Revision: 751549

URL: http://svn.apache.org/viewvc?rev=751549&view=rev
Log:
DIRSTUDIO-335: initial implementation

Added:
    directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif   (with props)
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ShowQuickSearchAction.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IQuickSearch.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/QuickSearch.java
Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ListContentProposalProvider.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java

Added: directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif?rev=751549&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java Sun Mar  8 23:22:32 2009
@@ -70,6 +70,7 @@
     public static final String PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST = "browserLeafEntriesFirst"; //$NON-NLS-1$
     public static final String PREFERENCE_BROWSER_CONTAINER_ENTRIES_FIRST = "browserContainerEntriesFirst"; //$NON-NLS-1$
     public static final String PREFERENCE_BROWSER_META_ENTRIES_LAST = "browserMetaEntriesLast"; //$NON-NLS-1$
+    public static final String PREFERENCE_BROWSER_SHOW_QUICK_SEARCH = "browserShowQuickSearch"; //$NON-NLS-1$
     public static final String PREFERENCE_BROWSER_SHOW_DIT = "browserShowDIT"; //$NON-NLS-1$
     public static final String PREFERENCE_BROWSER_SHOW_SEARCHES = "browserShowSearches"; //$NON-NLS-1$
     public static final String PREFERENCE_BROWSER_SHOW_BOOKMARKS = "browserShowBookmarks"; //$NON-NLS-1$
@@ -136,6 +137,7 @@
     public static final String IMG_ENTRY_ALIAS = "resources/icons/entry_alias.gif"; //$NON-NLS-1$
     public static final String IMG_SEARCHES = "resources/icons/searches.gif"; //$NON-NLS-1$
     public static final String IMG_SEARCH = "resources/icons/search.gif"; //$NON-NLS-1$
+    public static final String IMG_QUICKSEARCH = "resources/icons/quicksearch.gif"; //$NON-NLS-1$
     public static final String IMG_SEARCH_UNPERFORMED = "resources/icons/search_unperformed.gif"; //$NON-NLS-1$
     public static final String IMG_BOOKMARKS = "resources/icons/bookmarks.gif"; //$NON-NLS-1$
     public static final String IMG_BOOKMARK = "resources/icons/bookmark.gif"; //$NON-NLS-1$

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java Sun Mar  8 23:22:32 2009
@@ -122,6 +122,7 @@
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL, BrowserCommonConstants.SHOW_DN );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE, true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH, 50 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_QUICK_SEARCH, true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_DIT, true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_SEARCHES, true );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_BOOKMARKS, true );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java Sun Mar  8 23:22:32 2009
@@ -27,6 +27,7 @@
 import org.apache.directory.studio.ldapbrowser.core.jobs.RenameEntryJob;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IQuickSearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.RootDSE;
 import org.eclipse.jface.dialogs.Dialog;
@@ -210,7 +211,7 @@
      */
     protected ISearch[] getSearches()
     {
-        if ( getSelectedSearches().length == 1 )
+        if ( getSelectedSearches().length == 1 && !( getSelectedSearches()[0] instanceof IQuickSearch ) )
         {
             return getSelectedSearches();
         }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java Sun Mar  8 23:22:32 2009
@@ -33,6 +33,7 @@
 import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IQuickSearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.eclipse.swt.dnd.ByteArrayTransfer;
 import org.eclipse.swt.dnd.Transfer;
@@ -101,14 +102,21 @@
                 ByteArrayOutputStream out = new ByteArrayOutputStream();
                 DataOutputStream writeOut = new DataOutputStream( out );
 
-                for ( int i = 0; i < searches.length; i++ )
+                for ( ISearch search : searches )
                 {
-                    byte[] connectionId = searches[i].getBrowserConnection().getConnection().getId().getBytes( "UTF-8" ); //$NON-NLS-1$
+                    byte[] connectionId = search.getBrowserConnection().getConnection().getId().getBytes( "UTF-8" ); //$NON-NLS-1$
                     writeOut.writeInt( connectionId.length );
                     writeOut.write( connectionId );
-                    byte[] searchName = searches[i].getName().getBytes( "UTF-8" ); //$NON-NLS-1$
-                    writeOut.writeInt( searchName.length );
-                    writeOut.write( searchName );
+                    if ( search instanceof IQuickSearch )
+                    {
+                        writeOut.writeInt( 0 );
+                    }
+                    else
+                    {
+                        byte[] searchName = search.getName().getBytes( "UTF-8" ); //$NON-NLS-1$
+                        writeOut.writeInt( searchName.length );
+                        writeOut.write( searchName );
+                    }
                 }
 
                 byte[] buffer = out.toByteArray();
@@ -167,9 +175,16 @@
                         if ( readIn.available() > 1 && connection != null )
                         {
                             int size = readIn.readInt();
-                            byte[] searchName = new byte[size];
-                            readIn.read( searchName );
-                            search = connection.getSearchManager().getSearch( new String( searchName, "UTF-8" ) ); //$NON-NLS-1$
+                            if(size == 0)
+                            {
+                                search = connection.getSearchManager().getQuickSearch();
+                            }
+                            else
+                            {
+                                byte[] searchName = new byte[size];
+                                readIn.read( searchName );
+                                search = connection.getSearchManager().getSearch( new String( searchName, "UTF-8" ) ); //$NON-NLS-1$
+                            }
                         }
                         else
                         {

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ListContentProposalProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ListContentProposalProvider.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ListContentProposalProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ListContentProposalProvider.java Sun Mar  8 23:22:32 2009
@@ -78,8 +78,7 @@
         for ( int k = 0; k < proposals.size(); k++ )
         {
             final String proposal = proposals.get( k );
-            if ( proposal.toUpperCase().startsWith( string.toUpperCase() ) && !proposal.equalsIgnoreCase( string )
-                && !"".equals( string ) ) //$NON-NLS-1$
+            if ( proposal.toUpperCase().startsWith( string.toUpperCase() ) && !"".equals( string ) ) //$NON-NLS-1$
             {
                 IContentProposal p = new IContentProposal()
                 {

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java Sun Mar  8 23:22:32 2009
@@ -58,6 +58,9 @@
     /** The open sort dialog action. */
     protected OpenSortDialogAction openSortDialogAction;
 
+    /** The show quick search action. */
+    protected ShowQuickSearchAction showQuickSearchAction;
+    
     /** The collapse all action. */
     protected CollapseAllAction collapseAllAction;
 
@@ -98,7 +101,8 @@
         this.browserActionMap = new HashMap<String, BrowserViewActionProxy>();
 
         TreeViewer viewer = mainWidget.getViewer();
-        openSortDialogAction = new OpenSortDialogAction( ( BrowserPreferences ) configuration.getPreferences() );
+        openSortDialogAction = new OpenSortDialogAction( configuration.getPreferences() );
+        showQuickSearchAction = new ShowQuickSearchAction( mainWidget.getQuickSearchWidget() );
         collapseAllAction = new CollapseAllAction( viewer );
 
         browserActionMap.put( upAction, new BrowserViewActionProxy( viewer, new UpAction( viewer ) ) );
@@ -119,6 +123,8 @@
         {
             openSortDialogAction.dispose();
             openSortDialogAction = null;
+            showQuickSearchAction.dispose();
+            showQuickSearchAction = null;
             collapseAllAction.dispose();
             collapseAllAction = null;
 
@@ -171,6 +177,8 @@
     {
         menuManager.add( openSortDialogAction );
         menuManager.add( new Separator() );
+        menuManager.add( showQuickSearchAction );
+        menuManager.add( new Separator() );
         menuManager.update( true );
     }
 
@@ -230,6 +238,7 @@
                 .get( refreshAction ) );
             actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) browserActionMap
                 .get( propertyDialogAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), showQuickSearchAction ); // IWorkbenchActionDefinitionIds.FIND_REPLACE
             actionBars.updateActionBars();
         }
         else
@@ -240,6 +249,9 @@
 
             IAction ra = browserActionMap.get( refreshAction );
             ActionUtils.activateActionHandler( ra );
+
+            showQuickSearchAction.setActionDefinitionId( BrowserCommonConstants.CMD_FIND );
+            ActionUtils.activateActionHandler( showQuickSearchAction );
         }
 
         IAction ua = browserActionMap.get( upAction );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java Sun Mar  8 23:22:32 2009
@@ -30,12 +30,14 @@
 
 import org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable;
 import org.apache.directory.studio.connection.core.jobs.StudioRunnableWithProgress;
+import org.apache.directory.studio.ldapbrowser.core.SearchManager;
 import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeChildrenRunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 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.model.IQuickSearch;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
@@ -235,6 +237,12 @@
         {
             return ( ( BrowserSearchResultPage ) child ).getParent();
         }
+        else if ( child instanceof IQuickSearch )
+        {
+            IQuickSearch quickSearch = ( ( IQuickSearch ) child );
+            IEntry entry = quickSearch.getBrowserConnection().getEntryFromCache( quickSearch.getSearchBase() );
+            return entry;
+        }
         else if ( child instanceof ISearch )
         {
             ISearch search = ( ( ISearch ) child );
@@ -347,6 +355,13 @@
 
                 List<Object> objects = new ArrayList<Object>();
 
+                SearchManager sm = parentEntry.getBrowserConnection().getSearchManager();
+                IQuickSearch quickSearch = sm.getQuickSearch();
+                if ( quickSearch != null && parentEntry.getDn().equals( quickSearch.getSearchBase() ) )
+                {
+                    objects.add( quickSearch );
+                }
+
                 if ( parentEntry.getTopPageChildrenRunnable() != null )
                 {
                     objects.add( parentEntry.getTopPageChildrenRunnable() );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java Sun Mar  8 23:22:32 2009
@@ -31,6 +31,7 @@
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IQuickSearch;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
@@ -283,6 +284,10 @@
         {
             return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJ_FOLDER );
         }
+        else if ( obj instanceof IQuickSearch )
+        {
+            return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_QUICKSEARCH );
+        }
         else if ( obj instanceof ISearch )
         {
             ISearch search = ( ISearch ) obj;

Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java?rev=751549&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java (added)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java Sun Mar  8 23:22:32 2009
@@ -0,0 +1,418 @@
+/*
+ *  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.browser;
+
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription;
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.connection.ui.widgets.ExtendedContentAssistCommandAdapter;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserSelectionUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.HistoryUtils;
+import org.apache.directory.studio.ldapbrowser.common.widgets.ListContentProposalProvider;
+import org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable;
+import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
+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.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.QuickSearch;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
+import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+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.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * The BrowserQuickSearchWidget implements an instant search 
+ * for the browser widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserQuickSearchWidget
+{
+
+    /** The Constant VALUE_HISTORY_DIALOGSETTING_KEY. */
+    public static final String VALUE_HISTORY_DIALOGSETTING_KEY = BrowserQuickSearchWidget.class.getName()
+        + ".valueHistory"; //$NON-NLS-1$
+
+    /** An empty string array */
+    private static final String[] EMPTY = new String[0];
+
+    /** The browser widget. */
+    private BrowserWidget browserWidget;
+
+    /** The parent, used to create the composite. */
+    private Composite parent;
+
+    /** The outer composite. */
+    private Composite composite;
+
+    /** The inner composite, it is created/destroyed when showing/hiding the quick search. */
+    private Composite innerComposite;
+
+    /** The quick search attribute combo. */
+    private Combo quickSearchAttributeCombo;
+
+    /** The quick search attribute proposal provider. */
+    private ListContentProposalProvider quickSearchAttributePP;
+
+    /** The quick search operator combo. */
+    private Combo quickSearchOperatorCombo;
+
+    /** The quick search value combo. */
+    private Combo quickSearchValueCombo;
+
+    /** The quick search value proposal provider. */
+    private ListContentProposalProvider quickSearchValuePP;
+
+    /** The quick search run button. */
+    private Button quickSearchRunButton;
+
+    /** Listener that listens for selections of connections */
+    private ISelectionChangedListener selectionListener = new ISelectionChangedListener()
+    {
+        /**
+         * {@inheritDoc}
+         *
+         * This implementation sets the input when another connection was selected.
+         */
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            setEnabled( getSelectedEntry() != null );
+        }
+    };
+
+
+    /**
+     * Creates a new instance of BrowserQuickSearchWidget.
+     * 
+     * @param browserWidget the browser widget
+     */
+    public BrowserQuickSearchWidget( BrowserWidget browserWidget )
+    {
+        this.browserWidget = browserWidget;
+
+        if ( BrowserCommonActivator.getDefault().getDialogSettings().get( VALUE_HISTORY_DIALOGSETTING_KEY ) == null )
+        {
+            BrowserCommonActivator.getDefault().getDialogSettings().put( VALUE_HISTORY_DIALOGSETTING_KEY, EMPTY );
+        }
+    }
+
+
+    /**
+     * Creates the outer composite.
+     * 
+     * @param parent the parent
+     */
+    public void createComposite( Composite parent )
+    {
+        this.parent = parent;
+
+        composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+        GridLayout gl = new GridLayout();
+        gl.marginHeight = 2;
+        gl.marginWidth = 2;
+        composite.setLayout( gl );
+
+        innerComposite = null;
+    }
+
+
+    /**
+     * Creates the inner composite with its input fields.
+     */
+    private void create()
+    {
+        this.browserWidget.getViewer().addPostSelectionChangedListener( selectionListener );
+
+        innerComposite = BaseWidgetUtils.createColumnContainer( composite, 4, 1 );
+
+        quickSearchAttributeCombo = BaseWidgetUtils.createCombo( innerComposite, EMPTY, -1, 1 );
+        quickSearchAttributePP = new ListContentProposalProvider( EMPTY );
+        new ExtendedContentAssistCommandAdapter( quickSearchAttributeCombo, new ComboContentAdapter(),
+            quickSearchAttributePP, null, null, true );
+        quickSearchAttributeCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                quickSearchRunButton.setEnabled( !"".equals( quickSearchAttributeCombo.getText() ) );
+            }
+        } );
+        quickSearchAttributeCombo.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetDefaultSelected( SelectionEvent e )
+            {
+                performSearch();
+            }
+        } );
+        //        quickSearchAttributeCombo.addKeyListener( new KeyListener()
+        //        {
+        //            public void keyPressed( KeyEvent e )
+        //            {
+        //                if ( e.character == SWT.CR || e.character == SWT.LF )
+        //                {
+        //                    e.doit = false;
+        //                }
+        //            }
+        //            public void keyReleased( KeyEvent e )
+        //            {
+        //            }
+        //        });
+
+        String[] operators = new String[]
+            { "=", "!=", "<=", ">=", "~=" };
+        quickSearchOperatorCombo = BaseWidgetUtils.createReadonlyCombo( innerComposite, operators, 0, 1 );
+        GridData data = new GridData( 50, SWT.DEFAULT );
+        quickSearchOperatorCombo.setLayoutData( data );
+
+        String[] values = HistoryUtils.load( VALUE_HISTORY_DIALOGSETTING_KEY );
+        quickSearchValueCombo = BaseWidgetUtils.createCombo( innerComposite, values, -1, 1 );
+        quickSearchValuePP = new ListContentProposalProvider( values );
+        new ExtendedContentAssistCommandAdapter( quickSearchValueCombo, new ComboContentAdapter(), quickSearchValuePP,
+            null, null, true );
+        quickSearchValueCombo.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetDefaultSelected( SelectionEvent e )
+            {
+                performSearch();
+            }
+        } );
+
+        quickSearchRunButton = new Button( innerComposite, SWT.PUSH );
+        quickSearchRunButton.setToolTipText( Messages.getString( "BrowserQuickSearchWidget.RunQuickSearch" ) ); //$NON-NLS-1$
+        quickSearchRunButton.setImage( BrowserCommonActivator.getDefault().getImage(
+            BrowserCommonConstants.IMG_QUICKSEARCH ) );
+        quickSearchRunButton.setEnabled( true );
+        quickSearchRunButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                performSearch();
+            }
+        } );
+
+        setEnabled( getSelectedEntry() != null );
+
+        composite.layout( true, true );
+        parent.layout( true, true );
+    }
+
+
+    private void performSearch()
+    {
+        if ( !quickSearchRunButton.isEnabled() )
+        {
+            return;
+        }
+
+        IEntry entry = getSelectedEntry();
+        if ( entry == null )
+        {
+            return;
+        }
+
+        HistoryUtils.save( VALUE_HISTORY_DIALOGSETTING_KEY, quickSearchValueCombo.getText() );
+        String[] values = HistoryUtils.load( VALUE_HISTORY_DIALOGSETTING_KEY );
+        quickSearchValueCombo.setItems( values );
+        quickSearchValueCombo.select( 0 );
+        quickSearchValuePP.setProposals( Arrays.asList( values ) );
+
+        IBrowserConnection conn = entry.getBrowserConnection();
+
+        QuickSearch quickSearch = new QuickSearch();
+        quickSearch.setBrowserConnection( conn );
+        quickSearch.setSearchBase( entry.getDn() );
+        quickSearch.setReturningAttributes( ISearch.NO_ATTRIBUTES );
+        quickSearch.setAliasesDereferencingMethod( conn.getAliasesDereferencingMethod() );
+        quickSearch.setReferralsHandlingMethod( conn.getReferralsHandlingMethod() );
+        quickSearch.setCountLimit( conn.getCountLimit() );
+        quickSearch.setTimeLimit( conn.getTimeLimit() );
+
+        // TODO: externalize string
+        quickSearch.setName( "Quick Search" );
+        // TODO: select search scope
+        quickSearch.setScope( ISearch.SearchScope.SUBTREE );
+
+        StringBuffer filter = new StringBuffer();
+        filter.append( "(" );
+        if ( "!=".equals( quickSearchOperatorCombo.getText() ) )
+        {
+            filter.append( "!(" );
+        }
+        filter.append( quickSearchAttributeCombo.getText() );
+        filter.append( "!=".equals( quickSearchOperatorCombo.getText() ) ? "=" : quickSearchOperatorCombo.getText() );
+        filter.append( quickSearchValueCombo.getText() );
+        if ( "!=".equals( quickSearchOperatorCombo.getText() ) )
+        {
+            filter.append( ")" );
+        }
+        filter.append( ")" );
+        quickSearch.setFilter( filter.toString() );
+
+        // set new quick search
+        conn.getSearchManager().setQuickSearch( quickSearch );
+
+        // execute quick search
+        new StudioBrowserJob( new SearchRunnable( new ISearch[]
+            { quickSearch } ) ).execute();
+    }
+
+
+    private IEntry getSelectedEntry()
+    {
+        ISelection selection = browserWidget.getViewer().getSelection();
+        IEntry[] entries = BrowserSelectionUtils.getEntries( selection );
+        if ( entries != null && entries.length == 1 )
+        {
+            IEntry entry = entries[0];
+            return entry;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * Destroys the inner widget.
+     */
+    private void destroy()
+    {
+        browserWidget.getViewer().removePostSelectionChangedListener( selectionListener );
+
+        innerComposite.dispose();
+        innerComposite = null;
+
+        composite.layout( true, true );
+        parent.layout( true, true );
+    }
+
+
+    /**
+     * Disposes this widget.
+     */
+    public void dispose()
+    {
+        if ( browserWidget != null )
+        {
+            quickSearchAttributeCombo = null;
+            quickSearchOperatorCombo = null;
+            quickSearchValueCombo = null;
+            quickSearchRunButton = null;
+            innerComposite = null;
+            composite.dispose();
+            composite = null;
+            parent = null;
+            browserWidget = null;
+        }
+    }
+
+
+    /**
+     * Enables or disables this quick search widget.
+     * 
+     * @param enabled true to enable this quick search widget, false to disable it
+     */
+    public void setEnabled( boolean enabled )
+    {
+        if ( composite != null && !composite.isDisposed() )
+        {
+            composite.setEnabled( enabled );
+        }
+        if ( innerComposite != null && !innerComposite.isDisposed() )
+        {
+            innerComposite.setEnabled( enabled );
+            quickSearchAttributeCombo.setEnabled( enabled );
+            quickSearchOperatorCombo.setEnabled( enabled );
+            quickSearchValueCombo.setEnabled( enabled );
+            quickSearchRunButton.setEnabled( enabled && !"".equals( quickSearchAttributeCombo.getText() ) );
+        }
+    }
+
+
+    /**
+     * Activates or deactivates this quick search widget.
+     *
+     * @param visible true to create this quick search widget, false to destroy it
+     */
+    public void setActive( boolean visible )
+    {
+        if ( visible && innerComposite == null && composite != null )
+        {
+            create();
+            Object input = browserWidget.getViewer().getInput();
+            if ( input != null && input instanceof IBrowserConnection )
+            {
+                setInput( ( IBrowserConnection ) input );
+            }
+            quickSearchAttributeCombo.setFocus();
+        }
+        else if ( !visible && innerComposite != null && composite != null )
+        {
+            destroy();
+            browserWidget.getViewer().getTree().setFocus();
+        }
+    }
+
+
+    /**
+     * Sets the input.
+     * 
+     * @param connection the new input
+     */
+    public void setInput( IBrowserConnection connection )
+    {
+        if ( quickSearchAttributeCombo != null && quickSearchAttributePP != null )
+        {
+            String[] atdNames;
+            if ( connection != null )
+            {
+                Collection<AttributeTypeDescription> atds = connection.getSchema().getAttributeTypeDescriptions();
+                atdNames = SchemaUtils.getNames( atds ).toArray( EMPTY );
+            }
+            else
+            {
+                atdNames = EMPTY;
+                setEnabled( false );
+            }
+            quickSearchAttributeCombo.setItems( atdNames );
+            quickSearchAttributePP.setProposals( Arrays.asList( atdNames ) );
+        }
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java Sun Mar  8 23:22:32 2009
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.common.widgets.browser;
 
 
+import org.apache.directory.studio.ldapbrowser.common.dialogs.SelectEntryDialog;
 import org.apache.directory.studio.ldapbrowser.common.widgets.ViewFormWidget;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
@@ -50,6 +51,9 @@
     /** The widget's configuration with the content provider, label provider and menu manager */
     private BrowserConfiguration configuration;
 
+    /** The quick search widget. */
+    private BrowserQuickSearchWidget quickSearchWidget;
+    
     /** The action bars. */
     private IActionBars actionBars;
 
@@ -142,7 +146,9 @@
      */
     protected Control createContent( Composite parent )
     {
-
+        quickSearchWidget = new BrowserQuickSearchWidget( this );
+        quickSearchWidget.createComposite( parent );
+        
         // create tree widget and viewer
         tree = new Tree( parent, SWT.VIRTUAL | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
         GridData data = new GridData( GridData.FILL_BOTH );
@@ -194,6 +200,12 @@
             this.configuration.dispose();
             this.configuration = null;
 
+            if ( quickSearchWidget != null )
+            {
+                quickSearchWidget.dispose();
+                quickSearchWidget = null;
+            }
+            
             this.tree.dispose();
             this.tree = null;
             this.viewer = null;
@@ -202,6 +214,17 @@
 
 
     /**
+     * Gets the quick search widget.
+     * 
+     * @return the quick search widget
+     */
+    public BrowserQuickSearchWidget getQuickSearchWidget()
+    {
+        return quickSearchWidget;
+    }
+
+
+    /**
      * Gets the tree viewer.
      * 
      * @return the tree viewer

Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ShowQuickSearchAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ShowQuickSearchAction.java?rev=751549&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ShowQuickSearchAction.java (added)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ShowQuickSearchAction.java Sun Mar  8 23:22:32 2009
@@ -0,0 +1,83 @@
+/*
+ *  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.browser;
+
+
+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.jface.action.IAction;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * The ShowQuickSearchAction is used to select whether the quick search widget
+ * should be visible in the browser view or not.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ShowQuickSearchAction extends Action
+{
+
+    /** The quick search widget. */
+    private BrowserQuickSearchWidget quickSearchWidget;
+
+
+    /**
+     * Creates a new instance of ShowQuickSearchAction.
+     */
+    public ShowQuickSearchAction( BrowserQuickSearchWidget quickSearchWidget )
+    {
+        super( Messages.getString( "ShowQuickSearchAction.ShowQuickSearch" ), IAction.AS_CHECK_BOX ); //$NON-NLS-1$
+        this.quickSearchWidget = quickSearchWidget;
+        setActionDefinitionId( IWorkbenchActionDefinitionIds.FIND_REPLACE );
+        setEnabled( true );
+        setChecked( BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_QUICK_SEARCH ) );
+        run();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        BrowserCommonActivator.getDefault().getPreferenceStore().setValue(
+            BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_QUICK_SEARCH, isChecked() );
+
+        if ( quickSearchWidget != null )
+        {
+            quickSearchWidget.setActive( isChecked() );
+        }
+    }
+
+
+    /**
+     * Disposes this action.
+     */
+    public void dispose()
+    {
+        quickSearchWidget = null;
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java Sun Mar  8 23:22:32 2009
@@ -28,6 +28,7 @@
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IQuickSearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.eclipse.osgi.util.NLS;
 
@@ -50,6 +51,9 @@
     /** The connection. */
     private IBrowserConnection connection;
 
+    /** The quick search. */
+    private IQuickSearch quickSearch;
+
 
     /**
      * Creates a new instance of SearchManager.
@@ -168,7 +172,14 @@
      */
     public void removeSearch( ISearch search )
     {
-        searchList.remove( search );
+        if(search == quickSearch)
+        {
+            quickSearch = null;
+        }
+        else
+        {
+            searchList.remove( search );
+        }
         EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.EventDetail.SEARCH_REMOVED ),
             this );
     }
@@ -195,7 +206,7 @@
     public List<ISearch> getSearches()
     {
         // clone the internal list
-        return new ArrayList<ISearch>(searchList);
+        return new ArrayList<ISearch>( searchList );
     }
 
 
@@ -210,4 +221,26 @@
         return searchList.size();
     }
 
+
+    /**
+     * Sets the quick search.
+     * 
+     * @param quickSearch the new quick search
+     */
+    public void setQuickSearch( IQuickSearch quickSearch )
+    {
+        this.quickSearch = quickSearch;
+    }
+
+
+    /**
+     * Gets the quick search.
+     * 
+     * @return the quick search
+     */
+    public IQuickSearch getQuickSearch()
+    {
+        return quickSearch;
+    }
+
 }

Added: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IQuickSearch.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IQuickSearch.java?rev=751549&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IQuickSearch.java (added)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IQuickSearch.java Sun Mar  8 23:22:32 2009
@@ -0,0 +1,33 @@
+/*
+ *  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.core.model;
+
+
+/**
+ * An IQuickSearch holds all search parameters and search results of an
+ * LDAP quick search.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IQuickSearch extends ISearch
+{
+}

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java Sun Mar  8 23:22:32 2009
@@ -147,11 +147,10 @@
         entryToAttributeInfoMap.clear();
         entryToChildrenInfoMap.clear();
         entryToChildrenFilterMap.clear();
+        searchManager.setQuickSearch( null );
 
         rootDSE = new RootDSE( this );
         cacheEntry( rootDSE );
-
-        System.gc();
     }
 
 

Added: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/QuickSearch.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/QuickSearch.java?rev=751549&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/QuickSearch.java (added)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/QuickSearch.java Sun Mar  8 23:22:32 2009
@@ -0,0 +1,36 @@
+/*
+ *  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.core.model.impl;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IQuickSearch;
+
+
+/**
+ * Default implementation of IQuickSearch.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class QuickSearch extends Search implements IQuickSearch
+{
+    private static final long serialVersionUID = 4387604973869066354L;
+}

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java Sun Mar  8 23:22:32 2009
@@ -228,7 +228,6 @@
             ImportExportAction.TYPE_EXPORT_CSV ) ) );
         browserActionMap.put( exportExcelAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_EXPORT_EXCEL ) ) );
-
     }
 
 
@@ -258,7 +257,6 @@
      */
     public void fillToolBar( IToolBarManager toolBarManager )
     {
-
         toolBarManager.add( browserActionMap.get( upAction ) );
         toolBarManager.add( new Separator() );
         toolBarManager.add( browserActionMap.get( refreshAction ) );
@@ -266,7 +264,6 @@
         toolBarManager.add( collapseAllAction );
         toolBarManager.add( linkWithEditorAction );
         toolBarManager.update( true );
-
     }
 
 
@@ -275,9 +272,10 @@
      */
     public void fillMenu( IMenuManager menuManager )
     {
-
         menuManager.add( openSortDialogAction );
         menuManager.add( new Separator() );
+        menuManager.add( showQuickSearchAction );
+        menuManager.add( new Separator() );
         menuManager.add( showDITAction );
         menuManager.add( showSearchesAction );
         menuManager.add( showBookmarksAction );
@@ -365,7 +363,6 @@
 
         // properties
         menuManager.add( browserActionMap.get( propertyDialogAction ) );
-
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java?rev=751549&r1=751548&r2=751549&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java Sun Mar  8 23:22:32 2009
@@ -378,6 +378,7 @@
             // change input
             viewer.setInput( connection );
             view.getActionGroup().setInput( connection );
+            view.getMainWidget().getQuickSearchWidget().setInput( connection );
 
             // restore expanded elements and selection
             if ( view != null && connection != null )
@@ -449,6 +450,10 @@
         {
             viewer.setSelection( new StructuredSelection( search ), true );
         }
+        else if ( search.getBrowserConnection().getSearchManager().getQuickSearch() == search )
+        {
+            viewer.setSelection( new StructuredSelection( search ), true );
+        }
         else
         {
             Object searchCategory = ( ( ITreeContentProvider ) viewer.getContentProvider() ).getParent( search );



Mime
View raw message