directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r751389 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/ ldapbrowser-core/src/main/ja...
Date Sun, 08 Mar 2009 09:27:49 GMT
Author: seelmann
Date: Sun Mar  8 09:27:48 2009
New Revision: 751389

URL: http://svn.apache.org/viewvc?rev=751389&view=rev
Log:
Return List instead of Array

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.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/jobs/DeleteEntriesJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.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/BrowserViewUniversalListener.java

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=751389&r1=751388&r2=751389&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 09:27:48 2009
@@ -468,7 +468,7 @@
 
                 case BrowserCategory.TYPE_SEARCHES:
                 {
-                    return browserConnection.getSearchManager().getSearches();
+                    return browserConnection.getSearchManager().getSearches().toArray();
                 }
 
                 case BrowserCategory.TYPE_BOOKMARKS:

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java?rev=751389&r1=751388&r2=751389&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java
Sun Mar  8 09:27:48 2009
@@ -436,7 +436,7 @@
 
         // Searches
         Element searchesElement = browserConnectionElement.addElement( SEARCHES_TAG );
-        ISearch[] searches = browserConnection.getSearchManager().getSearches();
+        List<ISearch> searches = browserConnection.getSearchManager().getSearches();
         for ( ISearch search : searches )
         {
             Element searchParameterElement = searchesElement.addElement( SEARCH_PARAMETER_TAG
);

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=751389&r1=751388&r2=751389&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 09:27:48 2009
@@ -80,7 +80,7 @@
      */
     public IBrowserConnection getConnection()
     {
-        return this.connection;
+        return connection;
     }
 
 
@@ -92,7 +92,7 @@
      */
     public void addSearch( ISearch search )
     {
-        this.addSearch( this.searchList.size(), search );
+        addSearch( searchList.size(), search );
     }
 
 
@@ -119,7 +119,8 @@
         }
 
         searchList.add( index, search );
-        EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.EventDetail.SEARCH_ADDED
), this );
+        EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.EventDetail.SEARCH_ADDED
),
+            this );
     }
 
 
@@ -133,7 +134,7 @@
      */
     public ISearch getSearch( String name )
     {
-        for ( ISearch search:searchList )
+        for ( ISearch search : searchList )
         {
             if ( search.getName().equals( name ) )
             {
@@ -168,7 +169,8 @@
     public void removeSearch( ISearch search )
     {
         searchList.remove( search );
-        EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.EventDetail.SEARCH_REMOVED
), this );
+        EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.EventDetail.SEARCH_REMOVED
),
+            this );
     }
 
 
@@ -180,19 +182,20 @@
      */
     public void removeSearch( String name )
     {
-        this.removeSearch( this.getSearch( name ) );
+        removeSearch( getSearch( name ) );
     }
 
 
     /**
-     * Gets an array containing all the Searches
+     * Gets a list containing all the Searches
      *
      * @return
-     *      an array containing all the Searches
+     *      a list containing all the Searches
      */
-    public ISearch[] getSearches()
+    public List<ISearch> getSearches()
     {
-        return searchList.toArray( new ISearch[0] );
+        // clone the internal list
+        return new ArrayList<ISearch>(searchList);
     }
 
 
@@ -206,4 +209,5 @@
     {
         return searchList.size();
     }
+
 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java?rev=751389&r1=751388&r2=751389&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
Sun Mar  8 09:27:48 2009
@@ -166,7 +166,7 @@
                     entryToDelete.getParententry().deleteChild( entryToDelete );
 
                     // delete from searches
-                    ISearch[] searches = browserConnection.getSearchManager().getSearches();
+                    List<ISearch> searches = browserConnection.getSearchManager().getSearches();
                     for ( ISearch search : searches )
                     {
                         if ( search.getSearchResults() != null )

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java?rev=751389&r1=751388&r2=751389&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java
Sun Mar  8 09:27:48 2009
@@ -212,7 +212,7 @@
                 newParent.setHasMoreChildren( hasMoreChildren );
 
                 // reset searches, if the moved entry is a result of a search
-                ISearch[] searches = browserConnection.getSearchManager().getSearches();
+                List<ISearch> searches = browserConnection.getSearchManager().getSearches();
                 for ( ISearch search : searches )
                 {
                     if ( search.getSearchResults() != null )

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java?rev=751389&r1=751388&r2=751389&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java
Sun Mar  8 09:27:48 2009
@@ -194,7 +194,7 @@
             parent.setHasMoreChildren( hasMoreChildren );
 
             // reset searches, if the renamed entry is a result of a search
-            ISearch[] searches = browserConnection.getSearchManager().getSearches();
+            List<ISearch> searches = browserConnection.getSearchManager().getSearches();
             for ( ISearch search : searches )
             {
                 if ( search.getSearchResults() != null )

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=751389&r1=751388&r2=751389&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 09:27:48 2009
@@ -39,6 +39,7 @@
 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.IRootDSE;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
 import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
 import org.eclipse.search.ui.ISearchPageScoreComputer;
@@ -137,9 +138,9 @@
      */
     public void clearCaches()
     {
-        for ( int i = 0; i < getSearchManager().getSearchCount(); i++ )
+        for(ISearch search : getSearchManager().getSearches())
         {
-            getSearchManager().getSearches()[i].setSearchResults( null );
+            search.setSearchResults( null );
         }
 
         dnToEntryCache.clear();

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=751389&r1=751388&r2=751389&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 09:27:48 2009
@@ -21,7 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.ui.views.browser;
 
 
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -446,7 +445,7 @@
         ISearch search = searchUpdateEvent.getSearch();
         viewer.refresh();
 
-        if ( Arrays.asList( search.getBrowserConnection().getSearchManager().getSearches()
).contains( search ) )
+        if ( search.getBrowserConnection().getSearchManager().getSearches().contains( search
) )
         {
             viewer.setSelection( new StructuredSelection( search ), true );
         }



Mime
View raw message