You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/04/08 18:22:29 UTC
svn commit: r1672118 -
/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
Author: elecharny
Date: Wed Apr 8 16:22:28 2015
New Revision: 1672118
URL: http://svn.apache.org/r1672118
Log:
o Minor cleanup
Modified:
directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java?rev=1672118&r1=1672117&r2=1672118&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java Wed Apr 8 16:22:28 2015
@@ -47,10 +47,9 @@ import org.eclipse.swt.widgets.Composite
/**
* The EntryWidget could be used to select an entry.
- * It is composed
+ * It is composed of :
* <ul>
- * <li>a combo to manually enter an Dn or to choose one from
- * the history
+ * <li>a combo to manually enter an Dn or to choose one from the history
* <li>an up button to switch to the parent's Dn
* <li>a browse button to open a {@link SelectEntryDialog}
* </ul>
@@ -86,8 +85,8 @@ public class EntryWidget extends Browser
*/
public EntryWidget()
{
- this.browserConnection = null;
- this.dn = null;
+ browserConnection = null;
+ dn = null;
}
@@ -188,9 +187,11 @@ public class EntryWidget extends Browser
{
// get root entry
IEntry rootEntry = browserConnection.getRootDSE();
+
if ( suffix != null && suffix.size() > 0 )
{
rootEntry = browserConnection.getEntryFromCache( suffix );
+
if ( rootEntry == null )
{
ReadEntryRunnable runnable = new ReadEntryRunnable( browserConnection, suffix );
@@ -219,9 +220,11 @@ public class EntryWidget extends Browser
// get initial entry
IEntry entry = rootEntry;
+
if ( initialDn != null && initialDn.size() > 0 )
{
entry = browserConnection.getEntryFromCache( initialDn );
+
if ( entry == null )
{
ReadEntryRunnable runnable = new ReadEntryRunnable( browserConnection, initialDn );
@@ -240,10 +243,12 @@ public class EntryWidget extends Browser
if ( selectedEntry != null )
{
dn = selectedEntry.getDn();
+
if ( useLocalName && suffix != null && suffix.size() > 0 )
{
dn = DnUtils.getPrefixName( dn, suffix );
}
+
dnChanged();
internalSetEnabled();
notifyListeners();
@@ -262,7 +267,7 @@ public class EntryWidget extends Browser
*/
private void dnChanged()
{
- if ( dnCombo != null && entryBrowseButton != null )
+ if ( ( dnCombo != null ) && ( entryBrowseButton != null ) )
{
dnCombo.setText( dn != null ? dn.getName() : "" ); //$NON-NLS-1$
}
@@ -272,13 +277,13 @@ public class EntryWidget extends Browser
/**
* Sets the enabled state of the widget.
*
- * @param b true to enable the widget, false to disable the widget
+ * @param enabled true to enable the widget, false to disable the widget
*/
- public void setEnabled( boolean b )
+ public void setEnabled( boolean enabled )
{
- dnCombo.setEnabled( b );
+ dnCombo.setEnabled( enabled );
- if ( b )
+ if ( enabled )
{
this.dnChanged();
}
@@ -362,7 +367,7 @@ public class EntryWidget extends Browser
*/
public void setInput( IBrowserConnection browserConnection, Dn dn, Dn suffix, boolean useLocalName )
{
- if ( this.browserConnection != browserConnection || this.dn != dn || this.suffix != suffix )
+ if ( ( this.browserConnection != browserConnection ) || ( this.dn != dn ) || ( this.suffix != suffix ) )
{
this.browserConnection = browserConnection;
this.dn = dn;
@@ -371,5 +376,4 @@ public class EntryWidget extends Browser
dnChanged();
}
}
-
}