directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r477624 - /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
Date Tue, 21 Nov 2006 11:06:38 GMT
Author: pamarcelot
Date: Tue Nov 21 03:06:38 2006
New Revision: 477624

URL: http://svn.apache.org/viewvc?view=rev&rev=477624
Log:
Updating ConnectionWrapper. An error '-1' was thrown when the Base dn could not be resolved.
If a connection was 'in error', we had to click 'refresh' to try to connect again which prevented
using a simple double-click. Those 2 bugs are now fixed.

Modified:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java?view=diff&rev=477624&r1=477623&r2=477624
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
Tue Nov 21 03:06:38 2006
@@ -29,6 +29,7 @@
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
 import org.apache.directory.ldapstudio.browser.view.views.BrowserView;
 import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.graphics.Image;
@@ -133,6 +134,10 @@
         {
             children = new ArrayList<EntryWrapper>();
 
+            // Getting the Browser View
+            BrowserView browserView = ( BrowserView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                .getActivePage().findView( BrowserView.ID );
+
             try
             {
                 // Initialization of the DSML Engine and the DSML Response Parser
@@ -158,34 +163,46 @@
 
                 if ( ldapResponse instanceof SearchResponse )
                 {
-                    // Updating the HasError Flag and updating the UI
-                    if ( hasError() )
+                    SearchResponse searchResponse = ( SearchResponse ) ldapResponse;
+
+                    LdapResult ldapResult = searchResponse.getSearchResultDone().getLdapResult();
+
+                    if ( ldapResult.getResultCode() == 0 )
                     {
-                        setHasError( false );
+                        // Updating the HasError Flag and updating the UI
+                        if ( hasError() )
+                        {
+                            setHasError( false );
+
+                            browserView.getViewer().update( this, null );
+                        }
+
+                        // Getting the Base DN
+                        SearchResultEntry baseDN = ( ( SearchResponse ) ldapResponse ).getCurrentSearchResultEntry();
+
+                        EntryWrapper baseDNWrapper = new EntryWrapper( baseDN );
+                        baseDNWrapper.setParent( this );
+                        baseDNWrapper.setIsBaseDN( true );
 
-                        // Getting the Browser View
-                        BrowserView browserView = ( BrowserView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-                            .getActivePage().findView( BrowserView.ID );
-                        browserView.getViewer().update( this, null );
+                        children.add( baseDNWrapper );
                     }
+                    else
+                    {
+                        // Displaying an error
+                        MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                            "Error !", "An error has ocurred.\n" + ldapResult.getErrorMessage()
);
 
-                    // Getting the Base DN
-                    SearchResultEntry baseDN = ( ( SearchResponse ) ldapResponse ).getCurrentSearchResultEntry();
-
-                    EntryWrapper baseDNWrapper = new EntryWrapper( baseDN );
-                    baseDNWrapper.setParent( this );
-                    baseDNWrapper.setIsBaseDN( true );
+                        setHasError( true );
+                        clearChildren();
 
-                    children.add( baseDNWrapper );
+                        browserView.getViewer().update( this, null );
+                        return null;
+                    }
                 }
                 else if ( ldapResponse instanceof ErrorResponse )
                 {
                     setHasError( true );
                     clearChildren();
-
-                    // Getting the Browser View
-                    BrowserView browserView = ( BrowserView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-                        .getActivePage().findView( BrowserView.ID );
 
                     ErrorResponse errorResponse = ( ErrorResponse ) ldapResponse;
                     // Displaying an error



Mime
View raw message