directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r510647 [1/2] - in /directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui: views/browser/ widgets/browser/ widgets/connection/
Date Thu, 22 Feb 2007 20:52:26 GMT
Author: seelmann
Date: Thu Feb 22 12:52:24 2007
New Revision: 510647

URL: http://svn.apache.org/viewvc?view=rev&rev=510647
Log:
Code cleaning and Javadoc

Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserCategory.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserConfiguration.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserEntryPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserPreferences.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSearchResultPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorter.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorterDialog.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserWidget.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/OpenSortDialogAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/connection/ConnectionWidget.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java Thu Feb 22 12:52:24 2007
@@ -29,12 +29,10 @@
 import org.apache.directory.ldapstudio.browser.core.events.BookmarkUpdateEvent;
 import org.apache.directory.ldapstudio.browser.core.events.BookmarkUpdateListener;
 import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
-import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateListener;
 import org.apache.directory.ldapstudio.browser.core.events.EntryAddedEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryMovedEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryRenamedEvent;
-import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
 import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
 import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
 import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateListener;
@@ -73,7 +71,7 @@
  * @version $Rev$, $Date$
  */
 public class BrowserViewUniversalListener extends BrowserUniversalListener implements SearchUpdateListener,
-    EntryUpdateListener, ConnectionUpdateListener, BookmarkUpdateListener
+    BookmarkUpdateListener
 {
 
     /** This map contains all expanded elements for a particular connection */
@@ -390,7 +388,7 @@
      * {@inheritDoc}
      * 
      * This implementation refreshes the tree and expands/collapses the 
-     * tree when the connection is opene/closed.
+     * tree when the connection is opened/closed.
      */
     public void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
     {
@@ -469,7 +467,6 @@
      */
     public void entryUpdated( EntryModificationEvent event )
     {
-
         // Don't handle attribute initalization, could cause double
         // retrieval of children. 
         //

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserCategory.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserCategory.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserCategory.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserCategory.java Thu Feb 22 12:52:24 2007
@@ -24,70 +24,92 @@
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 
 
+/**
+ * A BrowserCategory is the top-level node in the browser widget. 
+ * There are three types: DIT categories, searches categories
+ * and bookmarks categories.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserCategory
 {
 
+    /** The Constant TYPE_DIT identifies DIT categories. */
     public static final int TYPE_DIT = 0;
 
+    /** The Constant TYPE_SEARCHES identifies searches categories. */
     public static final int TYPE_SEARCHES = 1;
 
+    /** The Constant TYPE_BOOKMARKS identifies bookmark categories. */
     public static final int TYPE_BOOKMARKS = 2;
 
+    /** The title for the DIT categoy */
     public static final String TITLE_DIT = "DIT";
 
+    /** The title for the searches categoy */
     public static final String TITLE_SEARCHES = "Searches";
 
+    /** The title for the bookmarks categoy */
     public static final String TITLE_BOOKMARKS = "Bookmarks";
 
+    /** The category's connection */
     private IConnection parent;
 
+    /** The category's type */
     private int type;
 
-    private Object[] children;
 
-
-    public BrowserCategory( int type, IConnection parent, Object[] children )
+    public BrowserCategory( int type, IConnection parent )
     {
-        super();
-        this.children = children;
         this.parent = parent;
         this.type = type;
     }
 
 
-    public Object[] getChildren()
-    {
-        return children;
-    }
-
-
+    /**
+     * Gets the category's parent, which is always a connection.
+     * 
+     * @return the parent connection
+     */
     public IConnection getParent()
     {
         return parent;
     }
 
 
+    /**
+     * Gets the category's type, one of TYPE_DIT, TYPE_SEARCHES or TYPE_BOOKMARKS.
+     *
+     * @return the category's type.
+     */
     public int getType()
     {
         return type;
     }
 
 
+    /**
+     * Gets the category's title.
+     *
+     * @return the category's title
+     */
     public String getTitle()
     {
-        if ( type == TYPE_DIT )
-            return TITLE_DIT;
-        if ( type == TYPE_SEARCHES )
-            return TITLE_SEARCHES;
-        if ( type == TYPE_BOOKMARKS )
-            return TITLE_BOOKMARKS;
-        return "ERROR";
-    }
-
-
-    public void setChildren( Object[] children )
-    {
-        this.children = children;
+        switch ( type )
+        {
+            case TYPE_DIT:
+                return TITLE_DIT;
+
+            case TYPE_SEARCHES:
+                return TITLE_SEARCHES;
+
+            case TYPE_BOOKMARKS:
+                return TITLE_BOOKMARKS;
+
+            default:
+                return "ERROR";
+        }
     }
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserConfiguration.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserConfiguration.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserConfiguration.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserConfiguration.java Thu Feb 22 12:52:24 2007
@@ -29,106 +29,176 @@
 import org.eclipse.swt.widgets.Menu;
 
 
+/**
+ * The BrowserConfiguration contains the content provider, the
+ * label provider, the sorter, the context menu manager and the
+ * preferences for the browser widget. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserConfiguration
 {
 
+    /** The disposed flag */
     private boolean disposed = false;
 
+    /** The sorter. */
     protected BrowserSorter sorter;
 
+    /** The preferences. */
     protected BrowserPreferences preferences;
 
+    /** The content provider. */
     protected BrowserContentProvider contentProvider;
 
+    /** The label provider. */
     protected BrowserLabelProvider labelProvider;
 
+    /** The decorating label provider. */
     protected DecoratingLabelProvider decoratingLabelProvider;
 
+    /** The context menu manager. */
     protected MenuManager contextMenuManager;
 
 
+    /**
+     * Creates a new instance of BrowserConfiguration.
+     */
     public BrowserConfiguration()
     {
     }
 
 
+    /**
+     * Disposes this configuration.
+     */
     public void dispose()
     {
-        if ( !this.disposed )
+        if ( !disposed )
         {
+            if ( sorter != null )
+            {
+                sorter.dispose();
+                sorter = null;
+            }
+
+            if ( preferences != null )
+            {
+                preferences.dispose();
+                preferences = null;
+            }
+
+            if ( contentProvider != null )
+            {
+                contentProvider.dispose();
+                contentProvider = null;
+            }
+
+            if ( labelProvider != null )
+            {
+                labelProvider.dispose();
+                labelProvider = null;
+                decoratingLabelProvider.dispose();
+                decoratingLabelProvider = null;
+            }
+
+            if ( contextMenuManager != null )
+            {
+                contextMenuManager.dispose();
+                contextMenuManager = null;
+            }
 
-            if ( this.sorter != null )
-                this.sorter.dispose();
-            this.sorter = null;
-
-            if ( this.preferences != null )
-                this.preferences.dispose();
-            this.preferences = null;
-
-            if ( this.contentProvider != null )
-                this.contentProvider.dispose();
-            this.contentProvider = null;
-
-            if ( this.labelProvider != null )
-                this.labelProvider.dispose();
-            this.labelProvider = null;
-
-            if ( this.contextMenuManager != null )
-                this.contextMenuManager.dispose();
-            this.contextMenuManager = null;
-
-            this.disposed = true;
+            disposed = true;
         }
     }
 
 
+    /**
+     * Gets the context menu manager.
+     * 
+     * @param viewer the browser widget's tree viewer 
+     * 
+     * @return the context menu manager
+     */
     public IMenuManager getContextMenuManager( TreeViewer viewer )
     {
-        if ( this.contextMenuManager == null )
+        if ( contextMenuManager == null )
         {
-            this.contextMenuManager = new MenuManager();
-            Menu menu = this.contextMenuManager.createContextMenu( viewer.getControl() );
+            contextMenuManager = new MenuManager();
+            Menu menu = contextMenuManager.createContextMenu( viewer.getControl() );
             viewer.getControl().setMenu( menu );
         }
-        return this.contextMenuManager;
+
+        return contextMenuManager;
     }
 
 
+    /**
+     * Gets the content provider.
+     * 
+     * @param viewer the browser widget's tree viewer 
+     * 
+     * @return the content provider
+     */
     public BrowserContentProvider getContentProvider( TreeViewer viewer )
     {
-        if ( this.contentProvider == null )
-            this.contentProvider = new BrowserContentProvider( this.getPreferences(), this.getSorter() );
+        if ( contentProvider == null )
+        {
+            contentProvider = new BrowserContentProvider( getPreferences(), getSorter() );
+        }
 
         return contentProvider;
     }
 
 
+    /**
+     * Gets the label provider.
+     * 
+     * @param viewer the browser widget's tree viewer 
+     * 
+     * @return the label provider
+     */
     public DecoratingLabelProvider getLabelProvider( TreeViewer viewer )
     {
-        if ( this.labelProvider == null )
+        if ( labelProvider == null )
         {
-            this.labelProvider = new BrowserLabelProvider( this.getPreferences() );
-            this.decoratingLabelProvider = new DecoratingLabelProvider( this.labelProvider, BrowserUIPlugin
-                .getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() );
+            labelProvider = new BrowserLabelProvider( getPreferences() );
+            decoratingLabelProvider = new DecoratingLabelProvider( labelProvider, BrowserUIPlugin.getDefault()
+                .getWorkbench().getDecoratorManager().getLabelDecorator() );
         }
 
         return decoratingLabelProvider;
     }
 
 
+    /**
+     * Gets the sorter.
+     * 
+     * @return the sorter
+     */
     public BrowserSorter getSorter()
     {
-        if ( this.sorter == null )
-            this.sorter = new BrowserSorter( getPreferences() );
+        if ( sorter == null )
+        {
+            sorter = new BrowserSorter( getPreferences() );
+        }
 
         return sorter;
     }
 
 
+    /**
+     * Gets the preferences.
+     * 
+     * @return the preferences
+     */
     public BrowserPreferences getPreferences()
     {
-        if ( this.preferences == null )
-            this.preferences = new BrowserPreferences();
+        if ( preferences == null )
+        {
+            preferences = new BrowserPreferences();
+        }
 
         return preferences;
     }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserContentProvider.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserContentProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserContentProvider.java Thu Feb 22 12:52:24 2007
@@ -40,28 +40,45 @@
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 import org.apache.directory.ldapstudio.browser.core.model.ISearch;
 import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
-
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
 
+/**
+ * The BrowserContentProvider implements the content provider for
+ * the browser widget. It accepts an IConnection as input.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserContentProvider implements ITreeContentProvider
 {
 
-    protected BrowserPreferences layout;
+    /** The prefernces */
+    protected BrowserPreferences preferences;
 
+    /** The sorter */
     protected BrowserSorter sorter;
 
+    /** This map contains the pages for entries with many children (if folding is activated) */
     private Map<IEntry, BrowserEntryPage[]> entryToEntryPagesMap;
 
+    /** This map contains the pages for searches with many results (if folding is activated) */
     private Map<ISearch, BrowserSearchResultPage[]> searchToSearchResultPagesMap;
 
+    /** This map contains the top-level categories for each connection */
     private Map<IConnection, BrowserCategory[]> connectionToCategoriesMap;
 
 
-    public BrowserContentProvider( BrowserPreferences layout, BrowserSorter sorter )
+    /**
+     * Creates a new instance of BrowserContentProvider.
+     *
+     * @param preferences the preferences
+     * @param sorter the sorter
+     */
+    public BrowserContentProvider( BrowserPreferences preferences, BrowserSorter sorter )
     {
-        this.layout = layout;
+        this.preferences = preferences;
         this.sorter = sorter;
         this.entryToEntryPagesMap = new HashMap<IEntry, BrowserEntryPage[]>();
         this.searchToSearchResultPagesMap = new HashMap<ISearch, BrowserSearchResultPage[]>();
@@ -69,55 +86,69 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void inputChanged( Viewer v, Object oldInput, Object newInput )
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void dispose()
     {
-
-        if ( this.entryToEntryPagesMap != null )
+        if ( entryToEntryPagesMap != null )
         {
-            this.entryToEntryPagesMap.clear();
-            this.entryToEntryPagesMap = null;
+            entryToEntryPagesMap.clear();
+            entryToEntryPagesMap = null;
         }
-        if ( this.searchToSearchResultPagesMap != null )
+        if ( searchToSearchResultPagesMap != null )
         {
-            this.searchToSearchResultPagesMap.clear();
-            this.searchToSearchResultPagesMap = null;
+            searchToSearchResultPagesMap.clear();
+            searchToSearchResultPagesMap = null;
         }
-        if ( this.connectionToCategoriesMap != null )
+        if ( connectionToCategoriesMap != null )
         {
-            this.connectionToCategoriesMap.clear();
-            this.connectionToCategoriesMap = null;
+            connectionToCategoriesMap.clear();
+            connectionToCategoriesMap = null;
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object[] getElements( Object parent )
     {
         if ( parent instanceof IConnection )
         {
             IConnection connection = ( IConnection ) parent;
-            if ( !this.connectionToCategoriesMap.containsKey( connection ) )
+            if ( !connectionToCategoriesMap.containsKey( connection ) )
             {
                 BrowserCategory[] categories = new BrowserCategory[3];
-                categories[0] = new BrowserCategory( BrowserCategory.TYPE_DIT, connection, null );
-                categories[1] = new BrowserCategory( BrowserCategory.TYPE_SEARCHES, connection, null );
-                categories[2] = new BrowserCategory( BrowserCategory.TYPE_BOOKMARKS, connection, null );
-                this.connectionToCategoriesMap.put( connection, categories );
+                categories[0] = new BrowserCategory( BrowserCategory.TYPE_DIT, connection );
+                categories[1] = new BrowserCategory( BrowserCategory.TYPE_SEARCHES, connection );
+                categories[2] = new BrowserCategory( BrowserCategory.TYPE_BOOKMARKS, connection );
+                connectionToCategoriesMap.put( connection, categories );
             }
 
-            BrowserCategory[] categories = this.connectionToCategoriesMap.get( connection );
+            BrowserCategory[] categories = connectionToCategoriesMap.get( connection );
 
             List<BrowserCategory> catList = new ArrayList<BrowserCategory>( 3 );
-            if ( this.layout.isShowDIT() )
+            if ( preferences.isShowDIT() )
+            {
                 catList.add( categories[0] );
-            if ( this.layout.isShowSearches() )
+            }
+            if ( preferences.isShowSearches() )
+            {
                 catList.add( categories[1] );
-            if ( this.layout.isShowBookmarks() )
+            }
+            if ( preferences.isShowBookmarks() )
+            {
                 catList.add( categories[2] );
+            }
 
             return catList.toArray( new BrowserCategory[0] );
         }
@@ -132,6 +163,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getParent( final Object child )
     {
         if ( child instanceof BrowserCategory )
@@ -147,18 +181,18 @@
             IEntry parentEntry = ( ( IEntry ) child ).getParententry();
             if ( parentEntry == null )
             {
-                if ( this.connectionToCategoriesMap.get( ( ( IEntry ) child ).getConnection() ) != null )
+                if ( connectionToCategoriesMap.get( ( ( IEntry ) child ).getConnection() ) != null )
                 {
-                    return this.connectionToCategoriesMap.get( ( ( IEntry ) child ).getConnection() )[0];
+                    return connectionToCategoriesMap.get( ( ( IEntry ) child ).getConnection() )[0];
                 }
                 else
                 {
                     return null;
                 }
             }
-            else if ( this.entryToEntryPagesMap.containsKey( parentEntry ) )
+            else if ( entryToEntryPagesMap.containsKey( parentEntry ) )
             {
-                BrowserEntryPage[] entryPages = this.entryToEntryPagesMap.get( parentEntry );
+                BrowserEntryPage[] entryPages = entryToEntryPagesMap.get( parentEntry );
                 BrowserEntryPage ep = null;
                 for ( int i = 0; i < entryPages.length && ep == null; i++ )
                 {
@@ -178,14 +212,14 @@
         else if ( child instanceof ISearch )
         {
             ISearch search = ( ( ISearch ) child );
-            return this.connectionToCategoriesMap.get( search.getConnection() )[1];
+            return connectionToCategoriesMap.get( search.getConnection() )[1];
         }
         else if ( child instanceof ISearchResult )
         {
             ISearch parentSearch = ( ( ISearchResult ) child ).getSearch();
-            if ( parentSearch != null && this.searchToSearchResultPagesMap.containsKey( parentSearch ) )
+            if ( parentSearch != null && searchToSearchResultPagesMap.containsKey( parentSearch ) )
             {
-                BrowserSearchResultPage[] srPages = this.searchToSearchResultPagesMap.get( parentSearch );
+                BrowserSearchResultPage[] srPages = searchToSearchResultPagesMap.get( parentSearch );
                 BrowserSearchResultPage srp = null;
                 for ( int i = 0; i < srPages.length && srp == null; i++ )
                 {
@@ -201,7 +235,7 @@
         else if ( child instanceof IBookmark )
         {
             IBookmark bookmark = ( ( IBookmark ) child );
-            return this.connectionToCategoriesMap.get( bookmark.getConnection() )[2];
+            return connectionToCategoriesMap.get( bookmark.getConnection() )[2];
         }
         else
         {
@@ -210,13 +244,15 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object[] getChildren( Object parent )
     {
-
         if ( parent instanceof BrowserEntryPage )
         {
             BrowserEntryPage entryPage = ( BrowserEntryPage ) parent;
-            Object[] objects = entryPage.get();
+            Object[] objects = entryPage.getChildren();
             if ( objects == null )
             {
                 return new String[]
@@ -245,11 +281,11 @@
             }
 
             int childrenCount = parentEntry.getChildrenCount();
-            if ( childrenCount <= layout.getFoldingSize() || !layout.isUseFolding() )
+            if ( childrenCount <= preferences.getFoldingSize() || !preferences.isUseFolding() )
             {
-                if ( this.entryToEntryPagesMap.containsKey( parentEntry ) )
+                if ( entryToEntryPagesMap.containsKey( parentEntry ) )
                 {
-                    this.entryToEntryPagesMap.remove( parentEntry );
+                    entryToEntryPagesMap.remove( parentEntry );
                 }
 
                 IEntry[] entries = parentEntry.getChildren();
@@ -266,18 +302,18 @@
             else
             {
                 BrowserEntryPage[] entryPages = null;
-                if ( !this.entryToEntryPagesMap.containsKey( parentEntry ) )
+                if ( !entryToEntryPagesMap.containsKey( parentEntry ) )
                 {
                     entryPages = getEntryPages( parentEntry, 0, childrenCount - 1 );
-                    this.entryToEntryPagesMap.put( parentEntry, entryPages );
+                    entryToEntryPagesMap.put( parentEntry, entryPages );
                 }
                 else
                 {
-                    entryPages = this.entryToEntryPagesMap.get( parentEntry );
+                    entryPages = entryToEntryPagesMap.get( parentEntry );
                     if ( childrenCount - 1 != entryPages[entryPages.length - 1].getLast() )
                     {
                         entryPages = getEntryPages( parentEntry, 0, childrenCount - 1 );
-                        this.entryToEntryPagesMap.put( parentEntry, entryPages );
+                        entryToEntryPagesMap.put( parentEntry, entryPages );
                     }
                 }
                 return entryPages;
@@ -286,7 +322,7 @@
         else if ( parent instanceof BrowserSearchResultPage )
         {
             BrowserSearchResultPage srPage = ( BrowserSearchResultPage ) parent;
-            Object[] objects = srPage.get();
+            Object[] objects = srPage.getChildren();
             if ( objects == null )
             {
                 return new String[]
@@ -307,7 +343,6 @@
             ISearch search = ( ISearch ) parent;
             if ( search.getSearchResults() == null )
             {
-                // return new Object[0];
                 new SearchJob( new ISearch[]
                     { search } ).execute();
                 return new String[]
@@ -318,7 +353,7 @@
                 return new String[]
                     { "No Results" };
             }
-            else if ( search.getSearchResults().length <= layout.getFoldingSize() || !layout.isUseFolding() )
+            else if ( search.getSearchResults().length <= preferences.getFoldingSize() || !preferences.isUseFolding() )
             {
                 ISearchResult[] results = search.getSearchResults();
                 return results;
@@ -326,18 +361,18 @@
             else
             {
                 BrowserSearchResultPage[] srPages = null;
-                if ( !this.searchToSearchResultPagesMap.containsKey( search ) )
+                if ( !searchToSearchResultPagesMap.containsKey( search ) )
                 {
                     srPages = getSearchResultPages( search, 0, search.getSearchResults().length - 1 );
-                    this.searchToSearchResultPagesMap.put( search, srPages );
+                    searchToSearchResultPagesMap.put( search, srPages );
                 }
                 else
                 {
-                    srPages = this.searchToSearchResultPagesMap.get( search );
+                    srPages = searchToSearchResultPagesMap.get( search );
                     if ( search.getSearchResults().length - 1 != srPages[srPages.length - 1].getLast() )
                     {
                         srPages = getSearchResultPages( search, 0, search.getSearchResults().length - 1 );
-                        this.searchToSearchResultPagesMap.put( search, srPages );
+                        searchToSearchResultPagesMap.put( search, srPages );
                     }
                 }
                 return srPages;
@@ -350,10 +385,8 @@
 
             switch ( category.getType() )
             {
-
                 case BrowserCategory.TYPE_DIT:
                 {
-
                     // open connection when expanding DIT
                     if ( !connection.isOpened() )
                     {
@@ -375,7 +408,7 @@
                     for ( Iterator<IEntry> it = entryList.iterator(); it.hasNext(); )
                     {
                         Object o = it.next();
-                        if ( !this.layout.isShowDirectoryMetaEntries()
+                        if ( !preferences.isShowDirectoryMetaEntries()
                             && ( o instanceof DirectoryMetadataEntry || o instanceof RootDSE ) )
                         {
                             it.remove();
@@ -394,7 +427,6 @@
                 {
                     return connection.getBookmarkManager().getBookmarks();
                 }
-
             }
 
             return new Object[0];
@@ -406,6 +438,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasChildren( Object parent )
     {
         if ( parent instanceof IEntry )
@@ -430,15 +465,11 @@
         }
         else if ( parent instanceof ISearch )
         {
-            // ISearch search = ((ISearch)parent);
-            // return search.getSearchResults() != null;
             return true;
         }
         else if ( parent instanceof BrowserCategory )
         {
             return true;
-            // BrowserCategory category = (BrowserCategory)parent;
-            // return category.getChildren().length > 0;
         }
         else
         {
@@ -447,10 +478,18 @@
     }
 
 
+    /**
+     * Creates and returns the entry pages for the given entry. The number of pages
+     * depends on the number of entries and the paging size. 
+     *
+     * @param entry the parent entry
+     * @param first the index of the first child entry
+     * @param last the index of the last child entry
+     * @return the created entry pages
+     */
     private BrowserEntryPage[] getEntryPages( IEntry entry, int first, int last )
     {
-
-        int pagingSize = this.layout.getFoldingSize();
+        int pagingSize = preferences.getFoldingSize();
 
         int diff = last - first;
         int factor = diff > 0 ? ( int ) ( Math.log( diff ) / Math.log( pagingSize ) ) : 0;
@@ -464,17 +503,25 @@
             groupLast = ( int ) ( ( i + 1 ) * Math.pow( pagingSize, factor ) ) + first - 1;
             groupLast = groupLast > last ? last : groupLast;
             BrowserEntryPage[] subpages = ( factor > 1 ) ? getEntryPages( entry, groupFirst, groupLast ) : null;
-            pages[i] = new BrowserEntryPage( entry, groupFirst, groupLast, subpages, this.sorter );
+            pages[i] = new BrowserEntryPage( entry, groupFirst, groupLast, subpages, sorter );
         }
 
         return pages;
     }
 
 
+    /**
+     * Creates and returns the search result pages for the given search. The number of pages
+     * depends on the number of search results and the paging size. 
+     *
+     * @param search the parent search
+     * @param first the index of the first search result
+     * @param last the index of the last child search result
+     * @return the created search result pages
+     */
     private BrowserSearchResultPage[] getSearchResultPages( ISearch search, int first, int last )
     {
-
-        int pagingSize = this.layout.getFoldingSize();
+        int pagingSize = preferences.getFoldingSize();
 
         int diff = last - first;
         int factor = diff > 0 ? ( int ) ( Math.log( diff ) / Math.log( pagingSize ) ) : 0;
@@ -489,7 +536,7 @@
             groupLast = groupLast > last ? last : groupLast;
             BrowserSearchResultPage[] subpages = ( factor > 1 ) ? getSearchResultPages( search, groupFirst, groupLast )
                 : null;
-            pages[i] = new BrowserSearchResultPage( search, groupFirst, groupLast, subpages, this.sorter );
+            pages[i] = new BrowserSearchResultPage( search, groupFirst, groupLast, subpages, sorter );
         }
 
         return pages;

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserEntryPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserEntryPage.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserEntryPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserEntryPage.java Thu Feb 22 12:52:24 2007
@@ -26,61 +26,80 @@
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 
 
+/**
+ * A BrowserEntryPage is a container for entries or other nested browser entry pages.
+ * It is used when folding large branches. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserEntryPage
 {
-
+    /** The tree sorter */
     private BrowserSorter sorter;
 
+    /** The index of the first child entry in this page */ 
     private int first;
 
+    /** The index of the last child entry in this page */
     private int last;
 
+    /** The parent entry */
     private IEntry entry;
 
+    /** The parent entry page or null if not nested */
     private BrowserEntryPage parentEntryPage;
 
+    /** The sub pages */
     private BrowserEntryPage[] subpages;
 
 
-    public BrowserEntryPage( IEntry entry, int first, int last, BrowserSorter sorter )
-    {
-        this( entry, first, last, null, sorter );
-    }
-
-
-    public BrowserEntryPage( IEntry entry, int first, int last, BrowserEntryPage[] subcontainers, BrowserSorter sorter )
+    /**
+     * Creates a new instance of BrowserEntryPage.
+     *
+     * @param entry the parent entry
+     * @param first the index of the first child entry in this page
+     * @param last the index of the last child entry in this page
+     * @param subpages the sub pages
+     * @param sorter the sorter
+     */
+    public BrowserEntryPage( IEntry entry, int first, int last, BrowserEntryPage[] subpages, BrowserSorter sorter )
     {
         this.entry = entry;
         this.first = first;
         this.last = last;
-        this.subpages = subcontainers;
-
+        this.subpages = subpages;
         this.sorter = sorter;
 
-        if ( this.subpages != null )
+        if ( subpages != null )
         {
-            for ( int i = 0; i < this.subpages.length; i++ )
-                subcontainers[i].parentEntryPage = this;
+            for ( int i = 0; i < subpages.length; i++ )
+            {
+                subpages[i].parentEntryPage = this;
+            }
         }
     }
 
 
-    public Object[] get()
+    /**
+     * Gets the children, either the sub pages or 
+     * the entries contained in this page.
+     *
+     * @return the children
+     */
+    public Object[] getChildren()
     {
-        if ( this.subpages != null )
+        if ( subpages != null )
         {
-            // return subpages
-            return this.subpages;
+            return subpages;
         }
         else
         {
-            // return children
-
             // 1. get children
-            IEntry[] children = this.entry.getChildren();
+            IEntry[] children = entry.getChildren();
 
             // 2. sort
-            this.sorter.sort( null, children );
+            sorter.sort( null, children );
 
             // 3. extraxt range
             if ( children != null )
@@ -100,27 +119,51 @@
     }
 
 
+    
+    /**
+     * Gets the first.
+     * 
+     * @return the first
+     */
     public int getFirst()
     {
-        return this.first;
+        return first;
     }
 
 
+    /**
+     * Gets the last.
+     * 
+     * @return the last
+     */
     public int getLast()
     {
-        return this.last;
+        return last;
     }
 
 
+    /**
+     * Gets the parent entry.
+     * 
+     * @return the parent entry
+     */
     public IEntry getEntry()
     {
-        return this.entry;
+        return entry;
     }
 
 
+    /**
+     * Gets the parent page if the given entry is contained in this page
+     * or one of the sub pages.
+     * 
+     * @param entry the entry
+     * 
+     * @return the parent page of the given entry.
+     */
     public BrowserEntryPage getParentOf( IEntry entry )
     {
-        if ( this.subpages != null )
+        if ( subpages != null )
         {
             BrowserEntryPage ep = null;
             for ( int i = 0; i < subpages.length && ep == null; i++ )
@@ -131,7 +174,7 @@
         }
         else
         {
-            IEntry[] sr = ( IEntry[] ) this.get();
+            IEntry[] sr = ( IEntry[] ) getChildren();
             if ( sr != null && Arrays.asList( sr ).contains( entry ) )
             {
                 return this;
@@ -144,15 +187,23 @@
     }
 
 
+    /**
+     * Gets the direct parent, either a page or the entry.
+     * 
+     * @return the direct parent
+     */
     public Object getParent()
     {
-        return ( this.parentEntryPage != null ) ? ( Object ) this.parentEntryPage : ( Object ) this.entry;
+        return ( parentEntryPage != null ) ? ( Object ) parentEntryPage : ( Object ) entry;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString()
     {
-        return this.entry.toString() + "[" + this.first + "..." + this.last + "]" + this.hashCode();
+        return entry.toString() + "[" + first + "..." + last + "]" + hashCode();
     }
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserLabelProvider.java Thu Feb 22 12:52:24 2007
@@ -21,8 +21,6 @@
 package org.apache.directory.ldapstudio.browser.ui.widgets.browser;
 
 
-import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
-import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
 import org.apache.directory.ldapstudio.browser.core.internal.model.AliasBaseEntry;
 import org.apache.directory.ldapstudio.browser.core.internal.model.DirectoryMetadataEntry;
 import org.apache.directory.ldapstudio.browser.core.internal.model.ReferralBaseEntry;
@@ -36,7 +34,6 @@
 import org.apache.directory.ldapstudio.browser.core.utils.Utils;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
-
 import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.viewers.IColorProvider;
 import org.eclipse.jface.viewers.IFontProvider;
@@ -50,18 +47,34 @@
 import org.eclipse.ui.PlatformUI;
 
 
+/**
+ * The BrowserLabelProvider implements the label provider for
+ * the browser widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserLabelProvider extends LabelProvider implements IFontProvider, IColorProvider
 {
 
+    /** The preferences. */
     private BrowserPreferences preferences;
 
 
+    /**
+     * Creates a new instance of BrowserLabelProvider.
+     *
+     * @param preferences the preferences
+     */
     public BrowserLabelProvider( BrowserPreferences preferences )
     {
         this.preferences = preferences;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String getText( Object obj )
     {
         if ( obj instanceof IEntry )
@@ -99,31 +112,25 @@
             {
 
                 String label = "";
-                if ( this.preferences.getEntryLabel() == BrowserUIConstants.SHOW_DN )
+                if ( preferences.getEntryLabel() == BrowserUIConstants.SHOW_DN )
                 {
                     label = entry.getDn().toString();
                 }
-                else if ( this.preferences.getEntryLabel() == BrowserUIConstants.SHOW_RDN )
+                else if ( preferences.getEntryLabel() == BrowserUIConstants.SHOW_RDN )
                 {
                     label = entry.getRdn().toString();
 
                 }
-                else if ( this.preferences.getEntryLabel() == BrowserUIConstants.SHOW_RDN_VALUE )
+                else if ( preferences.getEntryLabel() == BrowserUIConstants.SHOW_RDN_VALUE )
                 {
                     label = entry.getRdn().getValue();
                 }
 
                 label += append.toString();
 
-                if ( this.preferences.isEntryAbbreviate()
-                    && label.length() > this.preferences.getEntryAbbreviateMaxLength() )
+                if ( preferences.isEntryAbbreviate() && label.length() > preferences.getEntryAbbreviateMaxLength() )
                 {
-                    label = Utils.shorten( label, this.preferences.getEntryAbbreviateMaxLength() );
-                    // label =
-                    // label.substring(0,this.preferences.getEntryAbbreviateMaxLength()/2)
-                    // + "..." +
-                    // label.substring(label.length()-this.preferences.getEntryAbbreviateMaxLength()/2,
-                    // label.length());
+                    label = Utils.shorten( label, preferences.getEntryAbbreviateMaxLength() );
                 }
 
                 return label;
@@ -175,28 +182,23 @@
             else if ( sr.getEntry().hasParententry() )
             {
                 String label = "";
-                if ( this.preferences.getSearchResultLabel() == BrowserUIConstants.SHOW_DN )
+                if ( preferences.getSearchResultLabel() == BrowserUIConstants.SHOW_DN )
                 {
                     label = sr.getEntry().getDn().toString();
                 }
-                else if ( this.preferences.getSearchResultLabel() == BrowserUIConstants.SHOW_RDN )
+                else if ( preferences.getSearchResultLabel() == BrowserUIConstants.SHOW_RDN )
                 {
                     label = sr.getEntry().getRdn().toString();
                 }
-                else if ( this.preferences.getSearchResultLabel() == BrowserUIConstants.SHOW_RDN_VALUE )
+                else if ( preferences.getSearchResultLabel() == BrowserUIConstants.SHOW_RDN_VALUE )
                 {
                     label = sr.getEntry().getRdn().getValue();
                 }
 
-                if ( this.preferences.isSearchResultAbbreviate()
-                    && label.length() > this.preferences.getSearchResultAbbreviateMaxLength() )
+                if ( preferences.isSearchResultAbbreviate()
+                    && label.length() > preferences.getSearchResultAbbreviateMaxLength() )
                 {
-                    label = Utils.shorten( label, this.preferences.getSearchResultAbbreviateMaxLength() );
-                    // label =
-                    // label.substring(0,this.preferences.getSearchResultAbbreviateMaxLength()/2)
-                    // + "..." +
-                    // label.substring(label.length()-this.preferences.getSearchResultAbbreviateMaxLength()/2,
-                    // label.length());
+                    label = Utils.shorten( label, preferences.getSearchResultAbbreviateMaxLength() );
                 }
 
                 return label;
@@ -223,6 +225,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Image getImage( Object obj )
     {
         if ( obj instanceof IEntry )
@@ -252,7 +257,6 @@
         }
         else if ( obj instanceof IBookmark )
         {
-            // IBookmark bookmark = (IBookmark) obj;
             return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_BOOKMARK );
         }
         else if ( obj instanceof ISearchResult )
@@ -290,9 +294,14 @@
     }
 
 
+    /**
+     * Gets the image depending on the RDN attribute
+     *
+     * @param entry the entry
+     * @return the image
+     */
     private Image getImageByRdn( IEntry entry )
     {
-
         if ( entry instanceof IRootDSE )
         {
             return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ENTRY_ROOT );
@@ -305,15 +314,11 @@
         {
             return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_BROWSER_SCHEMABROWSEREDITOR );
         }
-        else if ( BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
-            BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS )
-            && entry.isAlias() )
+        else if ( preferences.isDerefAliasesAndReferralsWhileBrowsing() && entry.isAlias() )
         {
             return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ENTRY_ALIAS );
         }
-        else if ( BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
-            BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS )
-            && entry.isReferral() )
+        else if ( preferences.isDerefAliasesAndReferralsWhileBrowsing() && entry.isReferral() )
         {
             return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ENTRY_REF );
         }
@@ -323,7 +328,6 @@
         }
         else
         {
-
             RDN rdn = entry.getRdn();
             RDNPart[] rdnParts = rdn.getParts();
             for ( int i = 0; i < rdnParts.length; i++ )
@@ -431,6 +435,9 @@
     // BrowserUIPlugin.getDefault().getImage(BrowserUIConstants.IMG_ENTRY);
     // }
 
+    /**
+     * {@inheritDoc}
+     */
     public Font getFont( Object element )
     {
 
@@ -458,6 +465,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Color getForeground( Object element )
     {
 
@@ -485,6 +495,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Color getBackground( Object element )
     {
         return null;

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserPreferences.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserPreferences.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserPreferences.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserPreferences.java Thu Feb 22 12:52:24 2007
@@ -25,19 +25,28 @@
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
-
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.TreeViewer;
 
 
+/**
+ * This class is a wrapper for the preferences of the browser widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserPreferences implements IPropertyChangeListener, Preferences.IPropertyChangeListener
 {
 
+    /** The tree viewer */
     protected TreeViewer viewer;
 
 
+    /**
+     * Creates a new instance of BrowserPreferences.
+     */
     public BrowserPreferences()
     {
         BrowserUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
@@ -45,26 +54,46 @@
     }
 
 
+    /**
+     * Connects the tree viewer to this preferences.
+     *
+     * @param viewer the tree viewer
+     */
     public void connect( TreeViewer viewer )
     {
         this.viewer = viewer;
     }
 
 
+    /**
+     * Disposes this preferences.
+     */
     public void dispose()
     {
         BrowserUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
         BrowserCorePlugin.getDefault().getPluginPreferences().removePropertyChangeListener( this );
-        this.viewer = null;
+        viewer = null;
     }
 
 
+    /**
+     * Gets the sort by, one of BrowserCoreConstants.SORT_BY_NONE, 
+     * BrowserCoreConstants.SORT_BY_RDN or BrowserCoreConstants.SORT_BY_RDN_VALUE.
+     * 
+     * @return the sort by
+     */
     public int getSortBy()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt( BrowserUIConstants.PREFERENCE_BROWSER_SORT_BY );
     }
 
 
+    /**
+     * Gets the sort order, one of one of BrowserCoreConstants.SORT_ORDER_NONE, 
+     * BrowserCoreConstants.SORT_ORDER_ASCENDING or BrowserCoreConstants.SORT_ORDER_DESCENDING.
+     * 
+     * @return the sort order
+     */
     public int getSortOrder()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -72,6 +101,11 @@
     }
 
 
+    /**
+     * Gets the sort limit.
+     * 
+     * @return the sort limit
+     */
     public int getSortLimit()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -79,6 +113,11 @@
     }
 
 
+    /**
+     * Returns true if leaf entries should be shown before non-leaf entries.
+     * 
+     * @return true, if leaf entries should be shown first
+     */
     public boolean isLeafEntriesFirst()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -86,6 +125,11 @@
     }
 
 
+    /**
+     * Returns true if meta entries should be shown after non-meta entries.
+     * 
+     * @return true, if meta entries should be shown first
+     */
     public boolean isMetaEntriesLast()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -93,6 +137,11 @@
     }
 
 
+    /**
+     * Returns true if the bookmark category should be visible.
+     *
+     * @return true if the bookmark category should be visible
+     */
     public boolean isShowBookmarks()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -100,6 +149,11 @@
     }
 
 
+    /**
+     * Returns true if the DIT category should be visible.
+     *
+     * @return true if the DIT category should be visible
+     */
     public boolean isShowDIT()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -107,6 +161,11 @@
     }
 
 
+    /**
+     * Returns true if the searches category should be visible.
+     *
+     * @return true if the searches category should be visible
+     */
     public boolean isShowSearches()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -114,6 +173,11 @@
     }
 
 
+    /**
+     * Gets the folding size.
+     * 
+     * @return the folding size
+     */
     public int getFoldingSize()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -121,6 +185,11 @@
     }
 
 
+    /**
+     * Returns true if folding is enabled.
+     *
+     * @return true if folding is enabled
+     */
     public boolean isUseFolding()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -128,6 +197,11 @@
     }
 
 
+    /**
+     * Returns true if meta entries should be visible.
+     *
+     * @return true if meta entries should be visible
+     */
     public boolean isShowDirectoryMetaEntries()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -135,6 +209,11 @@
     }
 
 
+    /**
+     * Returns true if entry lables should be abbreviated.
+     *
+     * @return true if entry lables should be abbreviated
+     */
     public boolean isEntryAbbreviate()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -142,6 +221,11 @@
     }
 
 
+    /**
+     * Gets the entry's maximum label length.
+     * 
+     * @return the entry's maximum label length
+     */
     public int getEntryAbbreviateMaxLength()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -149,6 +233,12 @@
     }
 
 
+    /**
+     * Gets the entry label, one of BrowserUIConstants.SHOW_DN, 
+     * BrowserUIConstants.SHOW_RDN or BrowserUIConstants.SHOW_RDN_VALUE.
+     * 
+     * @return the entry label
+     */
     public int getEntryLabel()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -156,6 +246,11 @@
     }
 
 
+    /**
+     * Returns true if search result lables should be abbreviated.
+     *
+     * @return true if search result lables should be abbreviated
+     */
     public boolean isSearchResultAbbreviate()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -163,6 +258,11 @@
     }
 
 
+    /**
+     * Gets the search result's maximum label length.
+     * 
+     * @return the search result's maximum label length
+     */
     public int getSearchResultAbbreviateMaxLength()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -170,6 +270,12 @@
     }
 
 
+    /**
+     * Gets the search result label, one of BrowserUIConstants.SHOW_DN, 
+     * BrowserUIConstants.SHOW_RDN or BrowserUIConstants.SHOW_RDN_VALUE.
+     * 
+     * @return the entry label
+     */
     public int getSearchResultLabel()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getInt(
@@ -177,6 +283,12 @@
     }
 
 
+    /**
+     * Returns true if the base entries should be expanded when
+     * opening connection.
+     *
+     * @return true if the base entries should be expanded
+     */
     public boolean isExpandBaseEntries()
     {
         return BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
@@ -184,6 +296,12 @@
     }
 
 
+    /**
+     * Returns true if the browser should check for children
+     * while browsing the directory.
+     *
+     * @return true if the browser should check for children
+     */
     public boolean isCheckForChildren()
     {
         Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
@@ -191,13 +309,25 @@
     }
 
 
-    public boolean isDerefAliasWhileBrowsing()
+    /**
+     * Returns true if the browser should dereference aliases and referrals.
+     * 
+     *
+     * @return true if the browser should dereference aliases and referrals
+     */
+    public boolean isDerefAliasesAndReferralsWhileBrowsing()
     {
         Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
         return coreStore.getBoolean( BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS );
     }
 
 
+    /**
+     * Returns true if subentries should be fetched while browsing.
+     * 
+     *
+     * @return true if subentries should be fetched while browsing
+     */
     public boolean isFetchSubentries()
     {
         Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
@@ -205,20 +335,26 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void propertyChange( PropertyChangeEvent event )
     {
-        if ( this.viewer != null )
+        if ( viewer != null )
         {
-            this.viewer.refresh();
+            viewer.refresh();
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void propertyChange( org.eclipse.core.runtime.Preferences.PropertyChangeEvent event )
     {
-        if ( this.viewer != null )
+        if ( viewer != null )
         {
-            this.viewer.refresh();
+            viewer.refresh();
         }
     }
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSearchResultPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSearchResultPage.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSearchResultPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSearchResultPage.java Thu Feb 22 12:52:24 2007
@@ -27,62 +27,82 @@
 import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
 
 
+/**
+ * A BrowserSearchResultPage is a container for search results or other nested browser search result pages.
+ * It is used when folding searches with many results. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserSearchResultPage
 {
 
+    /** The tree sorter */
     private BrowserSorter sorter;
 
+    /** The index of the first child search result in this page */
     private int first;
 
+    /** The index of the last child search result in this page */
     private int last;
 
+    /** The parent search */
     private ISearch search;
 
+    /** The parent search result page or null if not nested */
     private BrowserSearchResultPage parentSearchResultPage;
 
+    /** The sub pages */
     private BrowserSearchResultPage[] subpages;
 
 
-    public BrowserSearchResultPage( ISearch search, int first, int last, BrowserSorter sorter )
-    {
-        this( search, first, last, null, sorter );
-    }
-
-
-    public BrowserSearchResultPage( ISearch search, int first, int last, BrowserSearchResultPage[] subcontainers,
+    /**
+     * Creates a new instance of BrowserSearchResultPage.
+     *
+     * @param search the parent search
+     * @param first the index of the first child search result in this page
+     * @param last the index of the last child search result in this page
+     * @param subcontainers the sub pages
+     * @param sorter the sorter
+     */
+    public BrowserSearchResultPage( ISearch search, int first, int last, BrowserSearchResultPage[] subpages,
         BrowserSorter sorter )
     {
         this.search = search;
         this.first = first;
         this.last = last;
-        this.subpages = subcontainers;
-
+        this.subpages = subpages;
         this.sorter = sorter;
 
-        if ( this.subpages != null )
+        if ( subpages != null )
         {
-            for ( int i = 0; i < this.subpages.length; i++ )
-                subcontainers[i].parentSearchResultPage = this;
+            for ( int i = 0; i < subpages.length; i++ )
+            {
+                subpages[i].parentSearchResultPage = this;
+            }
         }
     }
 
 
-    public Object[] get()
+    /**
+     * Gets the children, either the sub pages or 
+     * the search results contained in this page.
+     *
+     * @return the children
+     */
+    public Object[] getChildren()
     {
-        if ( this.subpages != null )
+        if ( subpages != null )
         {
-            // return subpages
-            return this.subpages;
+            return subpages;
         }
         else
         {
-            // return children
-
             // 1. get children
-            ISearchResult[] children = this.search.getSearchResults();
+            ISearchResult[] children = search.getSearchResults();
 
             // 2. sort
-            this.sorter.sort( null, children );
+            sorter.sort( null, children );
 
             // 3. extraxt range
             if ( children != null )
@@ -102,39 +122,62 @@
     }
 
 
+    /**
+     * Gets the first.
+     * 
+     * @return the first
+     */
     public int getFirst()
     {
-        return this.first;
+        return first;
     }
 
 
+    /**
+     * Gets the last.
+     * 
+     * @return the last
+     */
     public int getLast()
     {
-        return this.last;
+        return last;
     }
 
 
+    /**
+     * Gets the search.
+     * 
+     * @return the search
+     */
     public ISearch getSearch()
     {
-        return this.search;
+        return search;
     }
 
 
-    public BrowserSearchResultPage getParentOf( ISearchResult searchReslt )
+    /**
+     * Gets the parent page if the given search result is contained in this page
+     * or one of the sub pages.
+     * 
+     * @param searchResult the search result
+     * 
+     * @return the parent page of the given search result.
+     */
+    public BrowserSearchResultPage getParentOf( ISearchResult searchResult )
     {
-        if ( this.subpages != null )
+        if ( subpages != null )
         {
             BrowserSearchResultPage ep = null;
             for ( int i = 0; i < subpages.length && ep == null; i++ )
             {
-                ep = subpages[i].getParentOf( searchReslt );
+                ep = subpages[i].getParentOf( searchResult );
             }
             return ep;
         }
         else
         {
-            ISearchResult[] sr = ( ISearchResult[] ) this.get();
-            if ( sr != null && Arrays.asList( sr ).contains( searchReslt ) )
+            ISearchResult[] sr = ( ISearchResult[] ) getChildren();
+            if ( sr != null && Arrays.asList( sr ).contains( searchResult ) )
             {
                 return this;
             }
@@ -146,16 +189,23 @@
     }
 
 
+    /**
+     * Gets the direct parent, either a page or the search.
+     * 
+     * @return the direct parent
+     */
     public Object getParent()
     {
-        return ( this.parentSearchResultPage != null ) ? ( Object ) this.parentSearchResultPage
-            : ( Object ) this.search;
+        return ( parentSearchResultPage != null ) ? ( Object ) parentSearchResultPage : ( Object ) search;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString()
     {
-        return this.search.toString() + "[" + this.first + "..." + this.last + "]" + this.hashCode();
+        return search.toString() + "[" + first + "..." + last + "]" + hashCode();
     }
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorter.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorter.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorter.java Thu Feb 22 12:52:24 2007
@@ -29,39 +29,60 @@
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
 import org.apache.directory.ldapstudio.browser.core.model.RDN;
-
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerSorter;
 
 
+/**
+ * The BrowserSorter implements the sorter for the browser widget. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserSorter extends ViewerSorter
 {
 
-    private TreeViewer viewer;
-
+    /** The browser preferences, used to get the sort settings */
     private BrowserPreferences preferences;
 
 
+    /**
+     * Creates a new instance of BrowserSorter.
+     *
+     * @param preferences the browser preferences, used to get the sort settings
+     */
     public BrowserSorter( BrowserPreferences preferences )
     {
         this.preferences = preferences;
     }
 
 
+    /**
+     * Connects the tree viewer to this sorter.
+     *
+     * @param viewer the tree viewer
+     */
     public void connect( TreeViewer viewer )
     {
-        this.viewer = viewer;
-        this.viewer.setSorter( this );
+        viewer.setSorter( this );
     }
 
 
+    /**
+     * Disposes this sorter.
+     */
     public void dispose()
     {
-        this.viewer = null;
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * For performance reasons this implemention first checks if sorting is enabled 
+     * and if the number of elements is less than the sort limit.
+     */
     public void sort( final Viewer viewer, final Object[] elements )
     {
         if ( elements != null && ( preferences.getSortLimit() <= 0 || elements.length < preferences.getSortLimit() )
@@ -72,6 +93,11 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This method is used to categorize leaf entries, meta entries and normal entries.
+     */
     public int category( Object element )
     {
         if ( preferences.isLeafEntriesFirst() || preferences.isMetaEntriesLast() )
@@ -110,62 +136,67 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation compares IEntry or ISearchResult objects. Depending on
+     * the sort settings it delegates comparation to {@link #compareRdns(IEntry, IEntry)}
+     * or {@link #compareRdnValues(IEntry, IEntry)}.
+     */
     public int compare( Viewer viewer, Object o1, Object o2 )
     {
-
         if ( o1 == null && o2 == null )
         {
-            return this.equal();
+            return equal();
         }
         else if ( o1 == null && o2 != null )
         {
-            return this.lessThan();
+            return lessThan();
         }
         else if ( o1 != null && o2 == null )
         {
-            return this.greaterThan();
+            return greaterThan();
         }
         else if ( o1 instanceof IEntry || o2 instanceof IEntry )
         {
-
             if ( !( o1 instanceof IEntry ) && !( o2 instanceof IEntry ) )
             {
-                return this.equal();
+                return equal();
             }
             else if ( !( o1 instanceof IEntry ) && ( o2 instanceof IEntry ) )
             {
-                return this.lessThan();
+                return lessThan();
             }
             else if ( ( o1 instanceof IEntry ) && !( o2 instanceof IEntry ) )
             {
-                return this.greaterThan();
+                return greaterThan();
             }
             else
             {
                 IEntry entry1 = ( IEntry ) o1;
                 IEntry entry2 = ( IEntry ) o2;
 
-                int cat1 = this.category( entry1 );
-                int cat2 = this.category( entry2 );
+                int cat1 = category( entry1 );
+                int cat2 = category( entry2 );
                 if ( cat1 != cat2 )
                 {
                     return cat1 - cat2;
                 }
                 else if ( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_NONE )
                 {
-                    return this.equal();
+                    return equal();
                 }
                 else if ( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN )
                 {
-                    return this.compareRdns( entry1, entry2 );
+                    return compareRdns( entry1, entry2 );
                 }
                 else if ( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN_VALUE )
                 {
-                    return this.compareRdnValues( entry1, entry2 );
+                    return compareRdnValues( entry1, entry2 );
                 }
                 else
                 {
-                    return this.equal();
+                    return equal();
                 }
             }
         }
@@ -173,55 +204,61 @@
         {
             if ( !( o1 instanceof ISearchResult ) && !( o2 instanceof ISearchResult ) )
             {
-                return this.equal();
+                return equal();
             }
             else if ( !( o1 instanceof ISearchResult ) && ( o2 instanceof ISearchResult ) )
             {
-                return this.lessThan();
+                return lessThan();
             }
             else if ( ( o1 instanceof ISearchResult ) && !( o2 instanceof ISearchResult ) )
             {
-                return this.greaterThan();
+                return greaterThan();
             }
             else
             {
                 ISearchResult sr1 = ( ISearchResult ) o1;
                 ISearchResult sr2 = ( ISearchResult ) o2;
 
-                int cat1 = this.category( sr1 );
-                int cat2 = this.category( sr2 );
+                int cat1 = category( sr1 );
+                int cat2 = category( sr2 );
                 if ( cat1 != cat2 )
                 {
                     return cat1 - cat2;
                 }
                 else if ( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_NONE )
                 {
-                    return this.equal();
+                    return equal();
                 }
                 else if ( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN )
                 {
-                    return this.compareRdns( sr1.getEntry(), sr2.getEntry() );
+                    return compareRdns( sr1.getEntry(), sr2.getEntry() );
                 }
                 else if ( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN_VALUE )
                 {
-                    return this.compareRdnValues( sr1.getEntry(), sr2.getEntry() );
+                    return compareRdnValues( sr1.getEntry(), sr2.getEntry() );
                 }
                 else
                 {
-                    return this.equal();
+                    return equal();
                 }
             }
         }
         else
         {
-            return this.equal();
+            return equal();
         }
     }
 
 
+    /**
+     * Compares the string representation of the RDNs of two IEntry objects.
+     *  
+     * @param entry1 the first entry
+     * @param entry2 the second entry
+     * @return a negative integer, zero, or a positive integer
+     */
     private int compareRdns( IEntry entry1, IEntry entry2 )
     {
-
         RDN rdn1 = entry1.getRdn();
         RDN rdn2 = entry2.getRdn();
 
@@ -244,6 +281,14 @@
     }
 
 
+    /**
+     * Compares the RDN values of two IEntry objects.
+     * Numeric values are compared as numeric.
+     *  
+     * @param entry1 the first entry
+     * @param entry2 the second entry
+     * @return a negative integer, zero, or a positive integer
+     */
     private int compareRdnValues( IEntry entry1, IEntry entry2 )
     {
 
@@ -291,24 +336,48 @@
     }
 
 
+    /**
+     * Returns +1 or -1, depending on the sort order.
+     *
+     * @return +1 or -1, depending on the sort order
+     */
     private int lessThan()
     {
         return preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING ? -1 : 1;
     }
 
 
+    /**
+     * Returns 0.
+     *
+     * @return 0
+     */
     private int equal()
     {
         return 0;
     }
 
 
+    /**
+     * Returns +1 or -1, depending on the sort order.
+     *
+     * @return +1 or -1, depending on the sort order
+     */
     private int greaterThan()
     {
         return preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING ? 1 : -1;
     }
 
 
+    /**
+     * Compares the two strings using the Strings's compareToIgnoreCase method, 
+     * pays attention for the sort order.
+     *
+     * @param s1 the first string to compare
+     * @param s2 the second string to compare
+     * @return a negative integer, zero, or a positive integer
+     * @see java.lang.String#compareToIgnoreCase(String)
+     */
     private int compare( String s1, String s2 )
     {
         return preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING ? s1.compareToIgnoreCase( s2 )
@@ -316,6 +385,16 @@
     }
 
 
+    /**
+     * Compares the two numbers using the BigInteger compareTo method, 
+     * pays attention for the sort order.
+     *
+     * @param bi1 the first number to compare
+     * @param bi1 the second number to compare
+     * @return -1, 0 or 1 as this BigInteger is numerically less than, equal
+     *         to, or greater than
+     * @see java.math.BigInteger#compareTo(BigInteger)
+     */
     private int compare( BigInteger bi1, BigInteger bi2 )
     {
         return preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING ? bi1.compareTo( bi2 ) : bi2

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorterDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorterDialog.java?view=diff&rev=510647&r1=510646&r2=510647
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorterDialog.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserSorterDialog.java Thu Feb 22 12:52:24 2007
@@ -25,7 +25,6 @@
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
 import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -44,32 +43,55 @@
 import org.eclipse.swt.widgets.Text;
 
 
+/**
+ * This class represents the dialog used to change the browser's sort settings.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserSorterDialog extends Dialog
 {
 
+    /** The dialog title. */
     public static final String DIALOG_TITLE = "Browser Sorting";
 
+    /** The Constant SORT_BY_NONE. */
     public static final String SORT_BY_NONE = "No Sorting";
 
+    /** The Constant SORT_BY_RDN. */
     public static final String SORT_BY_RDN = "RDN";
 
+    /** The Constant SORT_BY_RDN_VALUE. */
     public static final String SORT_BY_RDN_VALUE = "RDN Value";
 
+    /** The browser preferences. */
     private BrowserPreferences preferences;
 
+    /** The sort by combo. */
     private Combo sortByCombo;
 
+    /** The sort acending button. */
     private Button sortAcendingButton;
 
+    /** The sort descending button. */
     private Button sortDescendingButton;
 
+    /** The leaf entries first button. */
     private Button leafEntriesFirstButton;
 
+    /** The meta entries last button. */
     private Button metaEntriesLastButton;
 
+    /** The sort limit text. */
     private Text sortLimitText;
 
 
+    /**
+     * Creates a new instance of BrowserSorterDialog.
+     *
+     * @param parentShell the parent shell
+     * @param preferences the browser preferences
+     */
     public BrowserSorterDialog( Shell parentShell, BrowserPreferences preferences )
     {
         super( parentShell );
@@ -77,6 +99,11 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation calls its super implementation and sets the dialog title.
+     */
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
@@ -84,30 +111,35 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation save the changed settings when OK is pressed.
+     */
     protected void buttonPressed( int buttonId )
     {
         if ( buttonId == IDialogConstants.OK_ID )
         {
-            int sortLimit = this.preferences.getSortLimit();
+            int sortLimit = preferences.getSortLimit();
             try
             {
-                sortLimit = Integer.parseInt( this.sortLimitText.getText().trim() );
+                sortLimit = Integer.parseInt( sortLimitText.getText().trim() );
             }
             catch ( NumberFormatException nfe )
             {
             }
 
             IPreferenceStore store = BrowserUIPlugin.getDefault().getPreferenceStore();
-            store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST, this.leafEntriesFirstButton
+            store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST, leafEntriesFirstButton
                 .getSelection() );
-            store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_META_ENTRIES_LAST, this.metaEntriesLastButton
+            store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_META_ENTRIES_LAST, metaEntriesLastButton
                 .getSelection() );
             store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_SORT_LIMIT, sortLimit );
             store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_SORT_ORDER,
-                this.sortDescendingButton.getSelection() ? BrowserCoreConstants.SORT_ORDER_DESCENDING
+                sortDescendingButton.getSelection() ? BrowserCoreConstants.SORT_ORDER_DESCENDING
                     : BrowserCoreConstants.SORT_ORDER_ASCENDING );
             store.setValue( BrowserUIConstants.PREFERENCE_BROWSER_SORT_BY,
-                this.sortByCombo.getSelectionIndex() == 2 ? BrowserCoreConstants.SORT_BY_RDN_VALUE : this.sortByCombo
+                sortByCombo.getSelectionIndex() == 2 ? BrowserCoreConstants.SORT_BY_RDN_VALUE : sortByCombo
                     .getSelectionIndex() == 1 ? BrowserCoreConstants.SORT_BY_RDN : BrowserCoreConstants.SORT_BY_NONE );
         }
         else
@@ -119,6 +151,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected Control createDialogArea( Composite parent )
     {
 
@@ -132,12 +167,12 @@
         leafEntriesFirstButton = BaseWidgetUtils.createCheckbox( groupingGroup, "Leaf enties first", 1 );
         leafEntriesFirstButton
             .setToolTipText( "This option displays entries without children before entries with children." );
-        leafEntriesFirstButton.setSelection( this.preferences.isLeafEntriesFirst() );
+        leafEntriesFirstButton.setSelection( preferences.isLeafEntriesFirst() );
 
         metaEntriesLastButton = BaseWidgetUtils.createCheckbox( groupingGroup, "Meta entries last", 1 );
         metaEntriesLastButton
             .setToolTipText( "This option displays meta entries after normal entries. Meta entries are e.g. the root DSE or the schema entry." );
-        metaEntriesLastButton.setSelection( this.preferences.isMetaEntriesLast() );
+        metaEntriesLastButton.setSelection( preferences.isMetaEntriesLast() );
 
         Group sortingGroup = BaseWidgetUtils.createGroup( composite, "Sort entries", 1 );
 
@@ -145,8 +180,8 @@
         BaseWidgetUtils.createLabel( sortByComposite, "Sort by", 1 );
         sortByCombo = BaseWidgetUtils.createReadonlyCombo( sortByComposite, new String[]
             { SORT_BY_NONE, SORT_BY_RDN, SORT_BY_RDN_VALUE }, 0, 1 );
-        sortByCombo.select( this.preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN_VALUE ? 2
-            : this.preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN ? 1 : 0 );
+        sortByCombo.select( preferences.getSortBy() == BrowserCoreConstants.SORT_BY_RDN_VALUE ? 2 : preferences
+            .getSortBy() == BrowserCoreConstants.SORT_BY_RDN ? 1 : 0 );
         sortByCombo.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
@@ -158,19 +193,18 @@
         } );
 
         sortAcendingButton = BaseWidgetUtils.createRadiobutton( sortByComposite, "Ascending", 1 );
-        sortAcendingButton.setSelection( this.preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING );
+        sortAcendingButton.setSelection( preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING );
         sortAcendingButton.setEnabled( sortByCombo.getSelectionIndex() != 0 );
 
         sortDescendingButton = BaseWidgetUtils.createRadiobutton( sortByComposite, "Descending", 1 );
-        sortDescendingButton
-            .setSelection( this.preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_DESCENDING );
+        sortDescendingButton.setSelection( preferences.getSortOrder() == BrowserCoreConstants.SORT_ORDER_DESCENDING );
         sortDescendingButton.setEnabled( sortByCombo.getSelectionIndex() != 0 );
 
         Composite sortLimitComposite = BaseWidgetUtils.createColumnContainer( sortingGroup, 2, 1 );
         String sortLimitTooltip = "If there are more than the specified number of children they won't be sorted. Hint: For performance reason the maximum value should be 10.000!";
         Label sortLimitLabel = BaseWidgetUtils.createLabel( sortLimitComposite, "Sort limit:", 1 );
         sortLimitLabel.setToolTipText( sortLimitTooltip );
-        sortLimitText = BaseWidgetUtils.createText( sortLimitComposite, "" + this.preferences.getSortLimit(), 5, 1 );
+        sortLimitText = BaseWidgetUtils.createText( sortLimitComposite, "" + preferences.getSortLimit(), 5, 1 );
         sortLimitText.setToolTipText( sortLimitTooltip );
         sortLimitText.setEnabled( sortByCombo.getSelectionIndex() != 0 );
         sortLimitText.addVerifyListener( new VerifyListener()



Mime
View raw message