directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1236228 - in /directory/studio/trunk/plugins: ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/ ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ ldapbrowser.com...
Date Thu, 26 Jan 2012 15:13:03 GMT
Author: pamarcelot
Date: Thu Jan 26 15:13:02 2012
New Revision: 1236228

URL: http://svn.apache.org/viewvc?rev=1236228&view=rev
Log:
Fix for DIRSTUDIO-739 (Using 'Quick Search' in the DN editor while editing some object cancels
editing and jumps to 'Quick Search' in the main window)

Modified:
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/OpenQuickSearchAction.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserConfiguration.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/OpenQuickSearchAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/OpenQuickSearchAction.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/OpenQuickSearchAction.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/OpenQuickSearchAction.java
Thu Jan 26 15:13:02 2012
@@ -24,6 +24,7 @@ package org.apache.directory.studio.ldap
 import org.apache.directory.studio.connection.core.Utils;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserWidget;
 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.impl.QuickSearch;
@@ -40,12 +41,16 @@ import org.eclipse.ui.dialogs.Preference
  */
 public class OpenQuickSearchAction extends BrowserAction
 {
+    /** The browser widget */
+    private BrowserWidget widget;
+
 
     /**
      * Creates a new instance of OpenQuickSearchAction.
      */
-    public OpenQuickSearchAction()
+    public OpenQuickSearchAction( BrowserWidget widget )
     {
+        this.widget = widget;
     }
 
 
@@ -57,11 +62,11 @@ public class OpenQuickSearchAction exten
         IBrowserConnection browserConnection = getBrowserConnection();
         if ( browserConnection != null )
         {
-            IQuickSearch quickSearch = browserConnection.getSearchManager().getQuickSearch();
+            IQuickSearch quickSearch = widget.getQuickSearch();
             if ( quickSearch == null )
             {
                 quickSearch = new QuickSearch( browserConnection.getRootDSE(), browserConnection
);
-                browserConnection.getSearchManager().setQuickSearch( quickSearch );
+                widget.setQuickSearch( quickSearch );
             }
 
             String pageId = BrowserCommonConstants.PROP_SEARCH;

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
Thu Jan 26 15:13:02 2012
@@ -181,7 +181,7 @@ public class SelectEntryDialog extends D
         browserActionGroup.activateGlobalActionHandlers();
 
         // create the listener
-        browserUniversalListener = new BrowserUniversalListener( browserWidget.getViewer()
);
+        browserUniversalListener = new BrowserUniversalListener( browserWidget );
 
         browserWidget.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
         {

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dnd/SearchTransfer.java
Thu Jan 26 15:13:02 2012
@@ -33,7 +33,6 @@ import org.apache.directory.studio.ldapb
 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;
@@ -106,16 +105,9 @@ public class SearchTransfer extends Byte
                     byte[] connectionId = search.getBrowserConnection().getConnection().getId().getBytes(
"UTF-8" ); //$NON-NLS-1$
                     writeOut.writeInt( connectionId.length );
                     writeOut.write( connectionId );
-                    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[] searchName = search.getName().getBytes( "UTF-8" ); //$NON-NLS-1$
+                    writeOut.writeInt( searchName.length );
+                    writeOut.write( searchName );
                 }
 
                 byte[] buffer = out.toByteArray();
@@ -174,16 +166,9 @@ public class SearchTransfer extends Byte
                         if ( readIn.available() > 1 && connection != null )
                         {
                             int size = readIn.readInt();
-                            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$
-                            }
+                            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/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
Thu Jan 26 15:13:02 2012
@@ -108,7 +108,8 @@ public class BrowserActionGroup implemen
         showQuickSearchAction = new ShowQuickSearchAction( mainWidget.getQuickSearchWidget()
);
         collapseAllAction = new CollapseAllAction( viewer );
 
-        browserActionMap.put( openQuickSearchAction, new BrowserViewActionProxy( viewer,
new OpenQuickSearchAction() ) );
+        browserActionMap.put( openQuickSearchAction, new BrowserViewActionProxy( viewer,
new OpenQuickSearchAction(
+            mainWidget ) ) );
         browserActionMap.put( upAction, new BrowserViewActionProxy( viewer, new UpAction(
viewer ) ) );
         browserActionMap.put( refreshAction, new BrowserViewActionProxy( viewer, new RefreshAction()
) );
         browserActionMap.put( filterChildrenAction, new BrowserViewActionProxy( viewer, new
FilterChildrenAction() ) );

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserConfiguration.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserConfiguration.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserConfiguration.java
Thu Jan 26 15:13:02 2012
@@ -136,15 +136,15 @@ public class BrowserConfiguration
     /**
      * Gets the content provider.
      * 
-     * @param viewer the browser widget's tree viewer 
+     * @param widget the browser widget
      * 
      * @return the content provider
      */
-    public BrowserContentProvider getContentProvider( TreeViewer viewer )
+    public BrowserContentProvider getContentProvider( BrowserWidget widget )
     {
         if ( contentProvider == null )
         {
-            contentProvider = new BrowserContentProvider( viewer, getPreferences(), getSorter()
);
+            contentProvider = new BrowserContentProvider( widget, getPreferences(), getSorter()
);
         }
 
         return contentProvider;

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
Thu Jan 26 15:13:02 2012
@@ -30,7 +30,6 @@ import java.util.Map;
 
 import org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable;
 import org.apache.directory.studio.connection.core.jobs.StudioConnectionRunnableWithProgress;
-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;
@@ -61,6 +60,8 @@ import org.eclipse.jface.viewers.Viewer;
  */
 public class BrowserContentProvider implements ITreeContentProvider
 {
+    /** The browser widget */
+    private BrowserWidget widget;
 
     /** The viewer. */
     private TreeViewer viewer;
@@ -88,7 +89,8 @@ public class BrowserContentProvider impl
             IStructuredSelection selection = ( IStructuredSelection ) event.getSelection();
             if ( selection.size() == 1 && selection.getFirstElement() instanceof
StudioConnectionRunnableWithProgress )
             {
-                StudioConnectionRunnableWithProgress runnable = ( StudioConnectionRunnableWithProgress
) selection.getFirstElement();
+                StudioConnectionRunnableWithProgress runnable = ( StudioConnectionRunnableWithProgress
) selection
+                    .getFirstElement();
                 new StudioBrowserJob( runnable ).execute();
             }
         }
@@ -102,9 +104,10 @@ public class BrowserContentProvider impl
      * @param preferences the preferences
      * @param sorter the sorter
      */
-    public BrowserContentProvider( TreeViewer viewer, BrowserPreferences preferences, BrowserSorter
sorter )
+    public BrowserContentProvider( BrowserWidget widget, BrowserPreferences preferences,
BrowserSorter sorter )
     {
-        this.viewer = viewer;
+        this.widget = widget;
+        this.viewer = widget.getViewer();
         this.preferences = preferences;
         this.sorter = sorter;
         this.entryToEntryPagesMap = new HashMap<IEntry, BrowserEntryPage[]>();
@@ -381,11 +384,10 @@ public class BrowserContentProvider impl
 
                 List<Object> objects = new ArrayList<Object>();
 
-                SearchManager sm = parentEntry.getBrowserConnection().getSearchManager();
-                if ( sm != null && sm.getQuickSearch() != null
-                    && parentEntry.getDn().equals( sm.getQuickSearch().getSearchBase()
) )
+                if ( widget.getQuickSearch() != null
+                    && parentEntry.getDn().equals( widget.getQuickSearch().getSearchBase()
) )
                 {
-                    objects.add( sm.getQuickSearch() );
+                    objects.add( widget.getQuickSearch() );
                 }
 
                 if ( parentEntry.getTopPageChildrenRunnable() != null )

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
Thu Jan 26 15:13:02 2012
@@ -293,7 +293,8 @@ public class BrowserQuickSearchWidget
         IBrowserConnection conn = entry.getBrowserConnection();
 
         QuickSearch quickSearch = new QuickSearch( entry, conn );
-        quickSearch.getSearchParameter().setScope( quickSearchScopeButton.getSelection()
? SearchScope.SUBTREE : SearchScope.ONELEVEL );
+        quickSearch.getSearchParameter().setScope(
+            quickSearchScopeButton.getSelection() ? SearchScope.SUBTREE : SearchScope.ONELEVEL
);
 
         StringBuffer filter = new StringBuffer();
         filter.append( "(" ); //$NON-NLS-1$
@@ -302,7 +303,8 @@ public class BrowserQuickSearchWidget
             filter.append( "!(" ); //$NON-NLS-1$
         }
         filter.append( quickSearchAttributeCombo.getText() );
-        filter.append( Messages.getString("BrowserQuickSearchWidget.9").equals( quickSearchOperatorCombo.getText()
) ? "=" : quickSearchOperatorCombo.getText() ); //$NON-NLS-1$ //$NON-NLS-2$
+        filter
+            .append( Messages.getString( "BrowserQuickSearchWidget.9" ).equals( quickSearchOperatorCombo.getText()
) ? "=" : quickSearchOperatorCombo.getText() ); //$NON-NLS-1$ //$NON-NLS-2$
 
         // only escape '\', '(', ')', and '\u0000'
         // don't escape '*' to allow substring search
@@ -320,7 +322,7 @@ public class BrowserQuickSearchWidget
         quickSearch.getSearchParameter().setFilter( filter.toString() );
 
         // set new quick search
-        conn.getSearchManager().setQuickSearch( quickSearch );
+        browserWidget.setQuickSearch( quickSearch );
 
         // execute quick search
         new StudioBrowserJob( new SearchRunnable( new ISearch[]

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
Thu Jan 26 15:13:02 2012
@@ -34,7 +34,9 @@ import org.apache.directory.studio.ldapb
 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.events.SearchUpdateListener;
+import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent.EventDetail;
 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.eclipse.jface.viewers.DoubleClickEvent;
@@ -54,6 +56,8 @@ import org.eclipse.jface.viewers.TreeVie
  */
 public class BrowserUniversalListener implements ConnectionUpdateListener, EntryUpdateListener,
SearchUpdateListener
 {
+    /** The browser widget */
+    protected BrowserWidget widget;
 
     /** The tree viewer */
     protected TreeViewer viewer;
@@ -121,9 +125,10 @@ public class BrowserUniversalListener im
      *
      * @param viewer the tree viewer
      */
-    public BrowserUniversalListener( TreeViewer viewer )
+    public BrowserUniversalListener( BrowserWidget widget )
     {
-        this.viewer = viewer;
+        this.widget = widget;
+        this.viewer = widget.getViewer();
 
         viewer.addTreeListener( treeViewerListener );
         viewer.addDoubleClickListener( doubleClickListener );
@@ -269,13 +274,21 @@ public class BrowserUniversalListener im
     public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
     {
         ISearch search = searchUpdateEvent.getSearch();
+        
+        if ( ( search instanceof IQuickSearch ) && ( searchUpdateEvent.getDetail()
== EventDetail.SEARCH_REMOVED ) )
+        {
+            if ( widget.getQuickSearch() == search )
+            {
+                widget.setQuickSearch( null );
+            }
+        }
+        
         viewer.refresh();
 
-        if ( search.getBrowserConnection().getSearchManager().getQuickSearch() == search
)
+        if ( ( search instanceof IQuickSearch ) && ( searchUpdateEvent.getDetail()
!= EventDetail.SEARCH_REMOVED ) )
         {
             viewer.setSelection( new StructuredSelection( search ), true );
             viewer.expandToLevel( search, 1 );
         }
     }
-
 }

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserWidget.java
Thu Jan 26 15:13:02 2012
@@ -24,6 +24,7 @@ package org.apache.directory.studio.ldap
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.common.ui.widgets.ViewFormWidget;
 import org.apache.directory.studio.ldapbrowser.common.dialogs.SelectEntryDialog;
+import org.apache.directory.studio.ldapbrowser.core.model.IQuickSearch;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -64,6 +65,9 @@ public class BrowserWidget extends ViewF
     /** The tree viewer. */
     private TreeViewer viewer;
 
+    /** The quick search. */
+    private IQuickSearch quickSearch;
+
 
     /**
      * Creates a new instance of BrowserWidget.
@@ -172,7 +176,7 @@ public class BrowserWidget extends ViewF
         configuration.getPreferences().connect( viewer );
 
         // setup providers
-        viewer.setContentProvider( configuration.getContentProvider( viewer ) );
+        viewer.setContentProvider( configuration.getContentProvider( this ) );
         viewer.setLabelProvider( configuration.getLabelProvider( viewer ) );
 
         return tree;
@@ -243,4 +247,25 @@ public class BrowserWidget extends ViewF
         return viewer;
     }
 
+
+    /**
+     * 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;
+    }
 }

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/SearchManager.java
Thu Jan 26 15:13:02 2012
@@ -28,7 +28,6 @@ import java.util.List;
 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,9 +49,6 @@ public class SearchManager implements Se
     /** The connection. */
     private IBrowserConnection connection;
 
-    /** The quick search. */
-    private IQuickSearch quickSearch;
-
 
     /**
      * Creates a new instance of SearchManager.
@@ -171,14 +167,8 @@ public class SearchManager implements Se
      */
     public void removeSearch( ISearch search )
     {
-        if ( search == quickSearch )
-        {
-            quickSearch = null;
-        }
-        else
-        {
-            searchList.remove( search );
-        }
+        searchList.remove( search );
+
         EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.EventDetail.SEARCH_REMOVED
),
             this );
     }
@@ -219,27 +209,4 @@ public class SearchManager implements Se
     {
         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;
-    }
-
 }

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
Thu Jan 26 15:13:02 2012
@@ -154,7 +154,7 @@ public class BrowserConnection implement
         entryToAttributeInfoMap.clear();
         entryToChildrenInfoMap.clear();
         entryToChildrenFilterMap.clear();
-        searchManager.setQuickSearch( null );
+//        searchManager.setQuickSearch( null ); TODO
 
         rootDSE = new RootDSE( this );
         cacheEntry( rootDSE );

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java?rev=1236228&r1=1236227&r2=1236228&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
Thu Jan 26 15:13:02 2012
@@ -49,11 +49,13 @@ import org.apache.directory.studio.ldapb
 import org.apache.directory.studio.ldapbrowser.core.events.EntryRenamedEvent;
 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.events.SearchUpdateEvent.EventDetail;
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateListener;
 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.IContinuation;
 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;
@@ -273,7 +275,7 @@ public class BrowserViewUniversalListene
      */
     public BrowserViewUniversalListener( BrowserView view )
     {
-        super( view.getMainWidget().getViewer() );
+        super( view.getMainWidget() );
         this.view = view;
 
         // create maps
@@ -525,7 +527,15 @@ public class BrowserViewUniversalListene
     public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
     {
         ISearch search = searchUpdateEvent.getSearch();
-        viewer.setSelection( StructuredSelection.EMPTY );
+
+        if ( ( search instanceof IQuickSearch ) && ( searchUpdateEvent.getDetail()
== EventDetail.SEARCH_REMOVED ) )
+        {
+            if ( widget.getQuickSearch() == search )
+            {
+                widget.setQuickSearch( null );
+            }
+        }
+
         viewer.refresh();
 
         if ( search instanceof IContinuation )
@@ -536,9 +546,12 @@ public class BrowserViewUniversalListene
         {
             viewer.setSelection( new StructuredSelection( search ), true );
         }
-        else if ( search.getBrowserConnection().getSearchManager().getQuickSearch() == search
)
+        else if ( ( search instanceof IQuickSearch ) && ( searchUpdateEvent.getDetail()
!= EventDetail.SEARCH_REMOVED ) )
         {
-            viewer.setSelection( new StructuredSelection( search ), true );
+            if ( widget.getQuickSearch() == search )
+            {
+                viewer.setSelection( new StructuredSelection( search ), true );
+            }
         }
         else
         {



Mime
View raw message