directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1805161 - /directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
Date Wed, 16 Aug 2017 09:43:20 GMT
Author: elecharny
Date: Wed Aug 16 09:43:20 2017
New Revision: 1805161

URL: http://svn.apache.org/viewvc?rev=1805161&view=rev
Log:
o Switched to LDAP API Value branch
o Some sonar warning fixing

Modified:
    directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java?rev=1805161&r1=1805160&r2=1805161&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
(original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
Wed Aug 16 09:43:20 2017
@@ -31,8 +31,6 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.studio.common.ui.widgets.AbstractWidget;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
-import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
 import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.ui.widgets.ExtendedContentAssistCommandAdapter;
 import org.apache.directory.studio.ldapbrowser.common.widgets.search.EntryWidget;
@@ -66,12 +64,6 @@ public class DnBuilderWidget extends Abs
     /** The attribute names that could be selected from drop-down list. */
     private String[] attributeNames;
 
-    /** The initial Rdn. */
-    private Rdn currentRdn;
-
-    /** The initial parent Dn. */
-    private Dn currentParentDn;
-
     /** True if the Rdn input elements should be shown. */
     private boolean showRDN;
 
@@ -111,6 +103,7 @@ public class DnBuilderWidget extends Abs
     // Listeners
     private SelectionListener rdnAddButtonSelectionListener = new SelectionAdapter()
     {
+        @Override
         public void widgetSelected( SelectionEvent e )
         {
             int index = rdnLineList.size();
@@ -130,6 +123,7 @@ public class DnBuilderWidget extends Abs
 
     private SelectionListener rdnDeleteButtonSelectionListener = new SelectionAdapter()
     {
+        @Override
         public void widgetSelected( SelectionEvent e )
         {
             int index = 0;
@@ -180,8 +174,8 @@ public class DnBuilderWidget extends Abs
     public void setInput( IBrowserConnection browserConnection, String[] attributeNames,
Rdn rdn, Dn parentDn )
     {
         this.attributeNames = attributeNames;
-        this.currentRdn = rdn;
-        this.currentParentDn = parentDn;
+        Rdn currentRdn = rdn;
+        Dn currentParentDn = parentDn;
 
         if ( showRDN )
         {
@@ -221,20 +215,22 @@ public class DnBuilderWidget extends Abs
                     removeRdnLineListeners( i );
 
                     rdnLineList.get( i ).rdnTypeCombo.setText( ava.getType() );
-                    rdnLineList.get( i ).rdnValueText.setText( (String)ava.getValue().getNormValue()
);
+                    rdnLineList.get( i ).rdnValueText.setText( (String)ava.getValue().getNormalized()
);
 
                     addRdnLineListeners( i );
 
                     if ( i == 0 )
                     {
-                        if ( "".equals( rdnLineList.get( i ).rdnTypeCombo ) ) //$NON-NLS-1$
+                        RdnLine rdnLine = rdnLineList.get( i );
+                        
+                        if ( rdnLine.rdnTypeCombo != null ) //$NON-NLS-1$
                         {
-                            rdnLineList.get( i ).rdnTypeCombo.setFocus();
+                            rdnLine.rdnTypeCombo.setFocus();
                         }
                         else
                         {
-                            rdnLineList.get( i ).rdnValueText.selectAll();
-                            rdnLineList.get( i ).rdnValueText.setFocus();
+                            rdnLine.rdnValueText.selectAll();
+                            rdnLine.rdnValueText.setFocus();
                         }
                     }
                     i++;
@@ -293,13 +289,7 @@ public class DnBuilderWidget extends Abs
                 Messages.getString( "DnBuilderWidget.Parent" ), 1 ); //$NON-NLS-1$
             parentEntryWidget = new EntryWidget();
             parentEntryWidget.createWidget( composite );
-            parentEntryWidget.addWidgetModifyListener( new WidgetModifyListener()
-            {
-                public void widgetModified( WidgetModifyEvent event )
-                {
-                    validate();
-                }
-            } );
+            parentEntryWidget.addWidgetModifyListener( event -> validate() );
 
             BaseWidgetUtils.createSpacer( composite, 3 );
         }
@@ -309,7 +299,7 @@ public class DnBuilderWidget extends Abs
         {
             rdnLabel = BaseWidgetUtils.createLabel( composite, Messages.getString( "DnBuilderWidget.RDN"
), 1 ); //$NON-NLS-1$
             rdnComposite = BaseWidgetUtils.createColumnContainer( composite, 5, 2 );
-            rdnLineList = new ArrayList<RdnLine>();
+            rdnLineList = new ArrayList<>();
             BaseWidgetUtils.createSpacer( composite, 3 );
         }
 
@@ -424,6 +414,7 @@ public class DnBuilderWidget extends Abs
             else
             {
                 Dn dn;
+                
                 if ( showParent && showRDN )
                 {
                     try
@@ -473,7 +464,7 @@ public class DnBuilderWidget extends Abs
      */
     private void addRdnLine( Composite rdnComposite, int index )
     {
-        RdnLine[] rdnLines = ( RdnLine[] ) rdnLineList.toArray( new RdnLine[rdnLineList.size()]
);
+        RdnLine[] rdnLines = rdnLineList.toArray( new RdnLine[rdnLineList.size()] );
 
         if ( rdnLines.length > 0 )
         {



Mime
View raw message