directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1198766 - in /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2: actions/ editor/
Date Mon, 07 Nov 2011 15:04:02 GMT
Author: pamarcelot
Date: Mon Nov  7 15:04:01 2011
New Revision: 1198766

URL: http://svn.apache.org/viewvc?rev=1198766&view=rev
Log:
Added deletion confirmation on the partitions and indexes delete buttons.
Better labeling in the Import configuration action and Overview editor pagE.

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

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java?rev=1198766&r1=1198765&r2=1198766&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java
Mon Nov  7 15:04:01 2011
@@ -106,7 +106,7 @@ public class EditorImportConfigurationAc
                 if ( !MessageDialog
                     .openConfirm(
                         editor.getSite().getShell(),
-                        "Unsaved modifications",
+                        "Unsaved Modifications",
                         "The configuration has unsaved modifications. All recent changes
will be lost. Are you sure you want to continue?" ) )
                 {
                     return;

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.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/OverviewPage.java?rev=1198766&r1=1198765&r2=1198766&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
Mon Nov  7 15:04:01 2011
@@ -406,7 +406,15 @@ public class OverviewPage extends Server
         changePasswordPortText.setText( "" + changePasswordServerBean.getTransports()[0].getSystemPort()
);
 
         List<PartitionBean> partitions = directoryServiceBean.getPartitions();
-        partitionsLabel.setText( NLS.bind( "There are {0} partitions defined:", partitions.size()
) );
+        if ( partitions.size() == 1 )
+        {
+            partitionsLabel.setText( "There is one partition defined:" );
+        }
+        else
+        {
+            partitionsLabel.setText( NLS.bind( "There are {0} partitions defined:", partitions.size()
) );
+        }
+
         partitionsTableViewer.setInput( partitions.toArray() );
 
         allowAnonymousAccessCheckbox.setSelection( directoryServiceBean.isDsAllowAnonymousAccess()
);

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=1198766&r1=1198765&r2=1198766&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 15:04:01 2011
@@ -31,6 +31,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.studio.apacheds.configuration.v2.dialogs.IndexDialog;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -507,7 +508,7 @@ public class PartitionDetailsPage implem
     {
         JdbmIndexBean<String, Entry> newIndex = new JdbmIndexBean<String, Entry>();
         newIndex.setIndexAttributeId( "" ); //$NON-NLS-1$
-        newIndex.setIndexCacheSize( 1000 );
+        newIndex.setIndexCacheSize( 100 );
 
         IndexDialog dialog = new IndexDialog( newIndex );
         if ( Dialog.OK == dialog.open() )
@@ -531,10 +532,14 @@ public class PartitionDetailsPage implem
         {
             JdbmIndexBean<String, Entry> selectedIndex = ( JdbmIndexBean<String,
Entry> ) selection.getFirstElement();
 
-            indexesList.remove( selectedIndex );
-            indexesTableViewer.refresh();
-            masterDetailsBlock.setEditorDirty();
-            dirty = true;
+            if ( MessageDialog.openConfirm( mform.getForm().getShell(), "Confirm Delete",
+                NLS.bind( "Are you sure you want to delete index ''{0}''?", selectedIndex.getIndexAttributeId()
) ) )
+            {
+                indexesList.remove( selectedIndex );
+                indexesTableViewer.refresh();
+                masterDetailsBlock.setEditorDirty();
+                dirty = true;
+            }
         }
     }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.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/PartitionsMasterDetailsBlock.java?rev=1198766&r1=1198765&r2=1198766&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java
Mon Nov  7 15:04:01 2011
@@ -30,11 +30,13 @@ import org.apache.directory.server.confi
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.name.Dn;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -158,8 +160,13 @@ public class PartitionsMasterDetailsBloc
             {
                 viewer.refresh();
 
-                deleteButton.setEnabled( !event.getSelection().isEmpty() );
+                // Getting the selection of the table viewer
                 StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+
+                // Delete button is enabled when something is selected
+                deleteButton.setEnabled( !selection.isEmpty() );
+
+                // Delete button is not enabled in the case of the system partition
                 if ( !selection.isEmpty() )
                 {
                     JdbmPartitionBean partition = ( JdbmPartitionBean ) selection.getFirstElement();
@@ -175,45 +182,7 @@ public class PartitionsMasterDetailsBloc
         {
             public void widgetSelected( SelectionEvent e )
             {
-                String newId = getNewId();
-
-                JdbmPartitionBean newPartitionBean = new JdbmPartitionBean();
-                newPartitionBean.setPartitionId( newId );
-                try
-                {
-                    newPartitionBean.setPartitionSuffix( new Dn( "dc=" + newId + ",dc=com"
) );
-                }
-                catch ( LdapInvalidDnException e1 )
-                {
-                    // TODO Auto-generated catch block
-                    e1.printStackTrace();
-                }
-
-                // Default values
-                newPartitionBean.setPartitionCacheSize( 100 );
-                newPartitionBean.setJdbmPartitionOptimizerEnabled( true );
-                newPartitionBean.setPartitionSyncOnWrite( true );
-                List<IndexBean> indexes = new ArrayList<IndexBean>();
-                indexes.add( createJdbmIndex( "apacheAlias", 100 ) );
-                indexes.add( createJdbmIndex( "apacheOneAlias", 100 ) );
-                indexes.add( createJdbmIndex( "apacheOneLevel", 100 ) );
-                indexes.add( createJdbmIndex( "apachePresence", 100 ) );
-                indexes.add( createJdbmIndex( "apacheRdn", 100 ) );
-                indexes.add( createJdbmIndex( "apacheSubAlias", 100 ) );
-                indexes.add( createJdbmIndex( "apacheSubLevel", 100 ) );
-                indexes.add( createJdbmIndex( "dc", 100 ) );
-                indexes.add( createJdbmIndex( "entryCSN", 100 ) );
-                indexes.add( createJdbmIndex( "entryUUID", 100 ) );
-                indexes.add( createJdbmIndex( "krbPrincipalName", 100 ) );
-                indexes.add( createJdbmIndex( "objectClass", 100 ) );
-                indexes.add( createJdbmIndex( "ou", 100 ) );
-                indexes.add( createJdbmIndex( "uid", 100 ) );
-                newPartitionBean.setIndexes( indexes );
-
-                page.getConfigBean().getDirectoryServiceBean().addPartitions( newPartitionBean
);
-                viewer.refresh();
-                viewer.setSelection( new StructuredSelection( newPartitionBean ) );
-                setEditorDirty();
+                addNewPartition();
             }
         } );
 
@@ -221,22 +190,59 @@ public class PartitionsMasterDetailsBloc
         {
             public void widgetSelected( SelectionEvent e )
             {
-                StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
-                if ( !selection.isEmpty() )
-                {
-                    JdbmPartitionBean partition = ( JdbmPartitionBean ) selection.getFirstElement();
-                    if ( !PartitionsPage.isSystemPartition( partition ) )
-                    {
-                        page.getConfigBean().getDirectoryServiceBean().getPartitions().remove(
partition );
-                        setEditorDirty();
-                    }
-                }
+                deleteSelectedPartition();
             }
         } );
     }
 
 
     /**
+     * This method is called when the 'Add' button is clicked.
+     */
+    private void addNewPartition()
+    {
+        String newId = getNewId();
+
+        JdbmPartitionBean newPartitionBean = new JdbmPartitionBean();
+        newPartitionBean.setPartitionId( newId );
+        try
+        {
+            newPartitionBean.setPartitionSuffix( new Dn( "dc=" + newId + ",dc=com" ) );
+        }
+        catch ( LdapInvalidDnException e1 )
+        {
+            // Will never happen
+        }
+
+        // Default values
+        newPartitionBean.setPartitionCacheSize( 100 );
+        newPartitionBean.setJdbmPartitionOptimizerEnabled( true );
+        newPartitionBean.setPartitionSyncOnWrite( true );
+        List<IndexBean> indexes = new ArrayList<IndexBean>();
+        indexes.add( createJdbmIndex( "apacheAlias", 100 ) );
+        indexes.add( createJdbmIndex( "apacheOneAlias", 100 ) );
+        indexes.add( createJdbmIndex( "apacheOneLevel", 100 ) );
+        indexes.add( createJdbmIndex( "apachePresence", 100 ) );
+        indexes.add( createJdbmIndex( "apacheRdn", 100 ) );
+        indexes.add( createJdbmIndex( "apacheSubAlias", 100 ) );
+        indexes.add( createJdbmIndex( "apacheSubLevel", 100 ) );
+        indexes.add( createJdbmIndex( "dc", 100 ) );
+        indexes.add( createJdbmIndex( "entryCSN", 100 ) );
+        indexes.add( createJdbmIndex( "entryUUID", 100 ) );
+        indexes.add( createJdbmIndex( "krbPrincipalName", 100 ) );
+        indexes.add( createJdbmIndex( "objectClass", 100 ) );
+        indexes.add( createJdbmIndex( "ou", 100 ) );
+        indexes.add( createJdbmIndex( "uid", 100 ) );
+        newPartitionBean.setIndexes( indexes );
+
+        page.getConfigBean().getDirectoryServiceBean().addPartitions( newPartitionBean );
+        viewer.refresh();
+        viewer.setSelection( new StructuredSelection( newPartitionBean ) );
+        setEditorDirty();
+    }
+
+
+    /**
      * Gets a new ID for a new Partition.
      *
      * @return 
@@ -268,6 +274,31 @@ public class PartitionsMasterDetailsBloc
 
 
     /**
+     * This method is called when the 'Delete' button is clicked.
+     */
+    private void deleteSelectedPartition()
+    {
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( !selection.isEmpty() )
+        {
+            JdbmPartitionBean partition = ( JdbmPartitionBean ) selection.getFirstElement();
+            if ( !PartitionsPage.isSystemPartition( partition ) )
+            {
+                if ( MessageDialog.openConfirm(
+                    page.getManagedForm().getForm().getShell(),
+                    "Confirm Delete",
+                    NLS.bind( "Are you sure you want to delete partition ''{0} ({1})''?",
partition.getPartitionId(),
+                        partition.getPartitionSuffix() ) ) )
+                {
+                    page.getConfigBean().getDirectoryServiceBean().getPartitions().remove(
partition );
+                    setEditorDirty();
+                }
+            }
+        }
+    }
+
+
+    /**
      * Create a JDBM Index with the given index attribute id and cache size.
      *
      * @param indexAttributeId the attribute id
@@ -294,7 +325,9 @@ public class PartitionsMasterDetailsBloc
     }
 
 
-    @Override
+    /**
+     * {@inheritDoc}
+     */
     protected void createToolBarActions( IManagedForm managedForm )
     {
         // TODO Auto-generated method stub



Mime
View raw message