directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1097108 - /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
Date Wed, 27 Apr 2011 13:46:40 GMT
Author: pamarcelot
Date: Wed Apr 27 13:46:39 2011
New Revision: 1097108

URL: http://svn.apache.org/viewvc?rev=1097108&view=rev
Log:
Extracted boolean to variables and reorganized if/else branches for a better code readability.

Modified:
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java?rev=1097108&r1=1097107&r2=1097108&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
Wed Apr 27 13:46:39 2011
@@ -184,16 +184,22 @@ public class NewEntryDnWizardPage extend
 
             Dn parentDn = null;
 
-            if ( ( wizard.getSelectedEntry() != null )
-                && ( newEntry.getDn().equals( wizard.getSelectedEntry().getDn() )
) && !Dn.isNullOrEmpty( newEntry.getDn().getParent() ) )
-            {
-                parentDn = newEntry.getDn().getParent();
-            }
-            else if ( wizard.getSelectedEntry() != null )
+            boolean hasSelectedEntry = wizard.getSelectedEntry() != null;
+            boolean newEntryParentDnNotNullOrEmpty = !Dn.isNullOrEmpty( newEntry.getDn().getParent()
);
+            boolean newEntryDnEqualsSelectedEntryDn = newEntry.getDn().equals( wizard.getSelectedEntry().getDn()
);
+
+            if ( hasSelectedEntry )
             {
-                parentDn = wizard.getSelectedEntry().getDn();
+                if ( newEntryDnEqualsSelectedEntryDn && newEntryParentDnNotNullOrEmpty
)
+                {
+                    parentDn = newEntry.getDn().getParent();
+                }
+                else
+                {
+                    parentDn = wizard.getSelectedEntry().getDn();
+                }
             }
-            else if ( !Dn.isNullOrEmpty( parentDn ) )
+            else if ( newEntryParentDnNotNullOrEmpty )
             {
                 parentDn = newEntry.getDn().getParent();
             }



Mime
View raw message