You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/11/21 17:01:37 UTC
svn commit: r477719 - in
/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser: resources/icons/
src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/
src/main/java/org/apache/directory/ldapstudio/browser/view/
src/main/java/o...
Author: pamarcelot
Date: Tue Nov 21 08:01:36 2006
New Revision: 477719
URL: http://svn.apache.org/viewvc?view=rev&rev=477719
Log:
Adding a new 'Running' state for a ConnectionWrapper that add a green triangle when a connection is currently running. Connections Icons have been updated too.
Modified:
directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/resources/icons/connection_error.gif
directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/ImageKeys.java
directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java
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/resources/icons/connection_error.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/resources/icons/connection_error.gif?view=diff&rev=477719&r1=477718&r2=477719
==============================================================================
Binary files - no diff available.
Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java?view=diff&rev=477719&r1=477718&r2=477719
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java Tue Nov 21 08:01:36 2006
@@ -28,6 +28,7 @@
import org.apache.directory.ldapstudio.browser.view.views.ConnectionWizard;
import org.apache.directory.ldapstudio.browser.view.views.ConnectionWizard.ConnectionWizardType;
import org.apache.directory.ldapstudio.browser.view.views.wrappers.ConnectionWrapper;
+import org.apache.directory.ldapstudio.browser.view.views.wrappers.ConnectionWrapper.ConnectionWrapperState;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
@@ -79,7 +80,7 @@
}
// Updating the state of the Connection since it has changed (this causes the icon to change)
- connectionWrapper.setHasError( false );
+ connectionWrapper.setState( ConnectionWrapperState.NONE );
connectionWrapper.connectionChanged();
selectedConnection.notifyListeners();
Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/ImageKeys.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/ImageKeys.java?view=diff&rev=477719&r1=477718&r2=477719
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/ImageKeys.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/ImageKeys.java Tue Nov 21 08:01:36 2006
@@ -31,6 +31,7 @@
public static final String CONNECTION_DELETE = "resources/icons/connection_delete.gif"; //$NON-NLS-1$
public static final String CONNECTION_EDIT = "resources/icons/connection_edit.gif"; //$NON-NLS-1$
public static final String CONNECTION_NEW = "resources/icons/connection_new.gif"; //$NON-NLS-1$
+ public static final String CONNECTION_RUNNING = "resources/icons/connection_running.gif"; //$NON-NLS-1$
public static final String ENTRY = "resources/icons/entry.gif"; //$NON-NLS-1$
public static final String ENTRY_NEW = "resources/icons/entry_new.gif"; //$NON-NLS-1$
public static final String ENTRY_DELETE = "resources/icons/entry_delete.gif"; //$NON-NLS-1$
Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java?view=diff&rev=477719&r1=477718&r2=477719
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java Tue Nov 21 08:01:36 2006
@@ -161,7 +161,7 @@
// Prefix User DN with Base DN
Label prefixUserDNLabel = new Label( userGroup, SWT.NONE );
prefixUserDN = new Button( userGroup, SWT.CHECK );
- prefixUserDN.setText( "Prefix User DN with Base DN" );
+ prefixUserDN.setText( "Append Base DN to User DN" );
prefixUserDN.setLayoutData( new GridData( GridData.FILL, SWT.NONE, true, false ) );
// Password
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=477719&r1=477718&r2=477719
==============================================================================
--- 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 08:01:36 2006
@@ -47,22 +47,38 @@
*/
public class ConnectionWrapper implements Comparable<ConnectionWrapper>, DisplayableTreeViewerElement
{
+ /**
+ * This enum represents the different states of a ConnectionWrapper
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+ public enum ConnectionWrapperState{ NONE, RUNNING, ERROR }
+
+ /** The parent element */
private Object parent;
-
+
+ /** The children list */
private List<EntryWrapper> children;
-
+
/** The wrapped conneection */
private Connection connection;
+
+ /** The state of the ConnectionWrapper*/
+ private ConnectionWrapperState state;
- /** The hasError Flag */
- private boolean hasError = false;
-
+ /** The DSML Engine used to connect to the server*/
private Dsmlv2Engine engine;
+ /**
+ * Creates a new instance of ConnectionWrapper.
+ *
+ * @param connection the connection to wrap
+ */
public ConnectionWrapper( Connection connection )
{
this.connection = connection;
+ this.state = ConnectionWrapperState.NONE;
}
@@ -80,11 +96,24 @@
*/
public Image getDisplayImage()
{
- if ( hasError() )
+ if ( state == ConnectionWrapperState.NONE )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION ).createImage();
+ }
+ else if ( state == ConnectionWrapperState.RUNNING )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION_RUNNING ).createImage();
+ }
+ else if ( state == ConnectionWrapperState.ERROR )
{
- return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION_ERROR )
- .createImage();
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION_ERROR ).createImage();
}
+
+// if ( hasError() )
+// {
+// return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION_ERROR )
+// .createImage();
+// }
return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION ).createImage();
}
@@ -175,14 +204,6 @@
if ( ldapResult.getResultCode() == 0 )
{
- // 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();
@@ -191,32 +212,33 @@
baseDNWrapper.setIsBaseDN( true );
children.add( baseDNWrapper );
+
+ setState( ConnectionWrapperState.RUNNING );
+ browserView.getViewer().update( this, null );
}
else
{
+ setState( ConnectionWrapperState.ERROR );
+ clearChildren();
+ browserView.getViewer().update( this, null );
+
// Displaying an error
MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Error !", "An error has ocurred.\n" + ldapResult.getErrorMessage() );
-
- setHasError( true );
- clearChildren();
-
- browserView.getViewer().update( this, null );
return null;
}
}
else if ( ldapResponse instanceof ErrorResponse )
{
- setHasError( true );
+ setState( ConnectionWrapperState.ERROR );
clearChildren();
+ browserView.getViewer().update( this, null );
ErrorResponse errorResponse = ( ErrorResponse ) ldapResponse;
// Displaying an error
MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Error !", "An error has ocurred.\n" + errorResponse.getMessage() );
- browserView.getViewer().update( this, null );
-
return null;
}
}
@@ -250,24 +272,23 @@
engine = null;
}
-
+
/**
- * Gets the hasError Flag
- * @return
+ * Sets the current state of the ConnectionWrapper
+ * @param state the state to set
*/
- public boolean hasError()
+ public void setState( ConnectionWrapperState state )
{
- return hasError;
+ this.state = state;
}
-
-
+
/**
- * Sets the hasError Flag
- * @param hasError the value of the flag
+ * Gets the current state of the ConnectionWrapper
+ * @return the state of the ConnectionWrapper
*/
- public void setHasError( boolean hasError )
+ public ConnectionWrapperState getState()
{
- this.hasError = hasError;
+ return this.state;
}
/**