directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1198844 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionDetailsPage.java
Date Mon, 07 Nov 2011 18:02:58 GMT
Author: pamarcelot
Date: Mon Nov  7 18:02:58 2011
New Revision: 1198844

URL: http://svn.apache.org/viewvc?rev=1198844&view=rev
Log:
Cleaning and reorder events to synchronize the UI correctly.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionDetailsPage.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionDetailsPage.java?rev=1198844&r1=1198843&r2=1198844&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionDetailsPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionDetailsPage.java
Mon Nov  7 18:02:58 2011
@@ -88,9 +88,6 @@ public class PartitionDetailsPage implem
     /** The Indexes List */
     private List<IndexBean> indexesList;
 
-    /** The dirty flag */
-    private boolean dirty = false;
-
     // UI fields
     private Text idText;
     private Text cacheSizeText;
@@ -108,9 +105,8 @@ public class PartitionDetailsPage implem
     {
         public void modifyText( ModifyEvent e )
         {
-            masterDetailsBlock.setEditorDirty();
-            dirty = true;
             commit( true );
+            masterDetailsBlock.setEditorDirty();
         }
     };
 
@@ -119,9 +115,8 @@ public class PartitionDetailsPage implem
     {
         public void widgetSelected( SelectionEvent e )
         {
-            masterDetailsBlock.setEditorDirty();
-            dirty = true;
             commit( true );
+            masterDetailsBlock.setEditorDirty();
         }
     };
 
@@ -270,6 +265,7 @@ public class PartitionDetailsPage implem
      */
     private void createIndexesSection( Composite parent, FormToolkit toolkit )
     {
+        // Section
         Section indexedAttributesSection = toolkit.createSection( parent, Section.DESCRIPTION
| Section.TITLE_BAR );
         indexedAttributesSection.marginWidth = 10;
         indexedAttributesSection.setText( "Indexed Attributes" );
@@ -280,6 +276,7 @@ public class PartitionDetailsPage implem
         indexedAttributesClient.setLayout( new GridLayout( 2, false ) );
         indexedAttributesSection.setClient( indexedAttributesClient );
 
+        // TableViewer
         Table indexedAttributesTable = toolkit.createTable( indexedAttributesClient, SWT.NONE
);
         GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
         gd.heightHint = 80;
@@ -314,19 +311,31 @@ public class PartitionDetailsPage implem
             };
         } );
 
-        GridData buttonsGD = new GridData( SWT.FILL, SWT.BEGINNING, false, false );
-        buttonsGD.widthHint = IDialogConstants.BUTTON_WIDTH;
-
+        // Add button
         indexesAddButton = toolkit.createButton( indexedAttributesClient, "Add", SWT.PUSH
);
-        indexesAddButton.setLayoutData( buttonsGD );
+        indexesAddButton.setLayoutData( createNewButtonGridData() );
 
+        // Edit button
         indexesEditButton = toolkit.createButton( indexedAttributesClient, "Edit", SWT.PUSH
);
         indexesEditButton.setEnabled( false );
-        indexesEditButton.setLayoutData( buttonsGD );
+        indexesEditButton.setLayoutData( createNewButtonGridData());
 
+        // Delete button
         indexesDeleteButton = toolkit.createButton( indexedAttributesClient, "Delete", SWT.PUSH
);
         indexesDeleteButton.setEnabled( false );
-        indexesDeleteButton.setLayoutData( buttonsGD );
+        indexesDeleteButton.setLayoutData( createNewButtonGridData() );
+    }
+    
+    /**
+     * Create a new button grid data.
+     *
+     * @return the new button grid data
+     */
+    private GridData createNewButtonGridData()
+    {
+        GridData gd = new GridData( SWT.FILL, SWT.BEGINNING, false, false );
+        gd.widthHint = IDialogConstants.BUTTON_WIDTH;
+        return gd;
     }
 
 
@@ -401,8 +410,7 @@ public class PartitionDetailsPage implem
             }
             catch ( LdapInvalidDnException e )
             {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
+                // Stay silent
             }
             input.setJdbmPartitionOptimizerEnabled( enableOptimizerCheckbox.getSelection()
);
             input.setPartitionSyncOnWrite( synchOnWriteCheckbox.getSelection() );
@@ -432,7 +440,7 @@ public class PartitionDetailsPage implem
      */
     public boolean isDirty()
     {
-        return dirty;
+        return false;
     }
 
 
@@ -510,7 +518,6 @@ public class PartitionDetailsPage implem
             {
                 indexesTableViewer.refresh();
                 masterDetailsBlock.setEditorDirty();
-                dirty = true;
             }
         }
     }
@@ -532,7 +539,6 @@ public class PartitionDetailsPage implem
             indexesTableViewer.refresh();
             indexesTableViewer.setSelection( new StructuredSelection( dialog.getIndex() )
);
             masterDetailsBlock.setEditorDirty();
-            dirty = true;
         }
     }
 
@@ -553,7 +559,6 @@ public class PartitionDetailsPage implem
                 indexesList.remove( selectedIndex );
                 indexesTableViewer.refresh();
                 masterDetailsBlock.setEditorDirty();
-                dirty = true;
             }
         }
     }



Mime
View raw message