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 2011/04/27 15:46:40 UTC
svn commit: r1097108 -
/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
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();
}