directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r479670 - /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java
Date Mon, 27 Nov 2006 15:58:53 GMT
Author: pamarcelot
Date: Mon Nov 27 07:58:52 2006
New Revision: 479670

URL: http://svn.apache.org/viewvc?view=rev&rev=479670
Log:
Correcting a bug where if changes couldn't be updated on the server, then the error message
was displayed twice.

Modified:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java?view=diff&rev=479670&r1=479669&r2=479670
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java
Mon Nov 27 07:58:52 2006
@@ -57,7 +57,8 @@
     private Table table;
     private TableEditor tableEditor;
     private Text textEditor;
-    private String originalValue;
+    // A flag to not update twice the server
+    private boolean done = false;
 
 
     /**
@@ -129,7 +130,10 @@
         {
             public void focusLost( FocusEvent fe )
             {
-                saveChangesAndDisposeEditor();
+                if ( !done )
+                {
+                    saveChangesAndDisposeEditor();
+                }
             }
         } );
     }
@@ -140,9 +144,6 @@
      */
     private void showEditor()
     {
-        // Backup of the original value
-        originalValue = getAttributeValue();
-
         tableEditor.setEditor( textEditor, view.getViewer().getTable().getSelection()[0],
COLUMN_TO_EDIT );
         textEditor.setText( getAttributeValue() );
         textEditor.selectAll();
@@ -155,8 +156,7 @@
      */
     private void saveChangesAndDisposeEditor()
     {
-        String newText = textEditor.getText();
-        if ( !originalValue.equals( newText ) )
+        if ( !getAttributeValue().equals( textEditor.getText()) )
         {
             saveChanges();
         }
@@ -245,6 +245,7 @@
                 }
                 else
                 {
+                    done = true;
                     // Displaying an error
                     MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                         "Error !", "An error has ocurred.\n" + modifyResponse.getLdapResult().getErrorMessage()
);
@@ -254,6 +255,7 @@
             {
                 ErrorResponse errorResponse = ( ErrorResponse ) ldapResponse;
 
+                done = true;
                 // Displaying an error
                 MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Error !",
                     "An error has ocurred.\n" + errorResponse.getMessage() );
@@ -261,6 +263,7 @@
         }
         catch ( Exception e )
         {
+            done = true;
             // Displaying an error
             MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Error !",
                 "An error has ocurred.\n" + e.getMessage() );



Mime
View raw message