directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1804081 [2/6] - in /directory/studio/branches/studio-value: ./ dist/ eclipse-trgt-platform/template/ features/apacheds.feature/ features/ldapbrowser.feature/ features/ldifeditor.feature/ features/nls.feature/ features/openldap.feature/ fea...
Date Fri, 04 Aug 2017 08:59:17 GMT
Modified: directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java Fri Aug  4 08:59:15 2017
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
+import java.util.function.Consumer;
 
 import javax.naming.ContextNotEmptyException;
 import javax.naming.NameAlreadyBoundException;
@@ -49,6 +50,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.entry.Modification;
 import org.apache.directory.api.ldap.model.entry.ModificationOperation;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException;
 import org.apache.directory.api.ldap.model.filter.ExprNode;
 import org.apache.directory.api.ldap.model.filter.FilterParser;
 import org.apache.directory.api.ldap.model.message.AddRequest;
@@ -68,12 +70,14 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.ModifyRequest;
 import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
 import org.apache.directory.api.ldap.model.message.ModifyResponse;
+import org.apache.directory.api.ldap.model.message.Referral;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.api.ldap.model.message.ResultResponse;
 import org.apache.directory.api.ldap.model.message.SearchRequest;
 import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.url.LdapUrl;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.SaslCramMd5Request;
@@ -94,6 +98,7 @@ import org.apache.directory.studio.conne
 import org.apache.directory.studio.connection.core.Messages;
 import org.apache.directory.studio.connection.core.Utils;
 import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
+import org.apache.directory.studio.connection.core.io.ConnectionWrapperUtils;
 import org.apache.directory.studio.connection.core.io.StudioNamingEnumeration;
 import org.apache.directory.studio.connection.core.io.StudioTrustManager;
 import org.apache.directory.studio.connection.core.io.jndi.CancelException;
@@ -216,14 +221,20 @@ public class DirectoryApiConnectionWrapp
             {
                 try
                 {
-                    ldapConnection = new LdapNetworkConnection( ldapConnectionConfig );
+                    // Set lower timeout for connecting
+                    long oldTimeout = ldapConnectionConfig.getTimeout();
+                    ldapConnectionConfig.setTimeout( Math.min( oldTimeout, 5000L ) );
 
                     // Connecting
+                    ldapConnection = new LdapNetworkConnection( ldapConnectionConfig );
                     boolean connected = ldapConnection.connect();
                     if ( !connected )
                     {
                         throw new Exception( Messages.DirectoryApiConnectionWrapper_UnableToConnect );
                     }
+
+                    // Set old timeout again
+                    ldapConnectionConfig.setTimeout( oldTimeout );
                 }
                 catch ( Exception e )
                 {
@@ -533,9 +544,8 @@ public class DirectoryApiConnectionWrapp
 
                     // Returning the result of the search
                     namingEnumeration = new CursorStudioNamingEnumeration( connection, cursor, searchBase, filter,
-                        searchControls,
-                        aliasesDereferencingMethod, referralsHandlingMethod, controls, requestNum, monitor,
-                        referralsInfo );
+                        searchControls, aliasesDereferencingMethod, referralsHandlingMethod, controls, requestNum,
+                        monitor, referralsInfo );
                 }
                 catch ( Exception e )
                 {
@@ -712,6 +722,16 @@ public class DirectoryApiConnectionWrapp
                     // Performing the modify operation
                     ModifyResponse modifyResponse = ldapConnection.modify( request );
 
+                    // Handle referral
+                    Consumer<ReferralHandlingData> consumer = referralHandlingData -> {
+                        referralHandlingData.connectionWrapper.modifyEntry( referralHandlingData.referralDn,
+                            modificationItems, controls, monitor, referralHandlingData.newReferralsInfo );
+                    };
+                    if ( checkAndHandleReferral( modifyResponse, monitor, referralsInfo, consumer ) )
+                    {
+                        return;
+                    }
+
                     // Checking the response
                     checkResponse( modifyResponse );
                 }
@@ -845,6 +865,16 @@ public class DirectoryApiConnectionWrapp
                     // Performing the rename operation
                     ModifyDnResponse modifyDnResponse = ldapConnection.modifyDn( request );
 
+                    // Handle referral
+                    Consumer<ReferralHandlingData> consumer = referralHandlingData -> {
+                        referralHandlingData.connectionWrapper.renameEntry( oldDn, newDn, deleteOldRdn, controls,
+                            monitor, referralHandlingData.newReferralsInfo );
+                    };
+                    if ( checkAndHandleReferral( modifyDnResponse, monitor, referralsInfo, consumer ) )
+                    {
+                        return;
+                    }
+
                     // Checking the response
                     checkResponse( modifyDnResponse );
                 }
@@ -914,6 +944,16 @@ public class DirectoryApiConnectionWrapp
                     // Performing the add operation
                     AddResponse addResponse = ldapConnection.add( request );
 
+                    // Handle referral
+                    Consumer<ReferralHandlingData> consumer = referralHandlingData -> {
+                        referralHandlingData.connectionWrapper.createEntry( referralHandlingData.referralDn, attributes,
+                            controls, monitor, referralHandlingData.newReferralsInfo );
+                    };
+                    if ( checkAndHandleReferral( addResponse, monitor, referralsInfo, consumer ) )
+                    {
+                        return;
+                    }
+
                     // Checking the response
                     checkResponse( addResponse );
                 }
@@ -982,6 +1022,16 @@ public class DirectoryApiConnectionWrapp
                     // Performing the delete operation
                     DeleteResponse deleteResponse = ldapConnection.delete( request );
 
+                    // Handle referral
+                    Consumer<ReferralHandlingData> consumer = referralHandlingData -> {
+                        referralHandlingData.connectionWrapper.deleteEntry( referralHandlingData.referralDn, controls,
+                            monitor, referralHandlingData.newReferralsInfo );
+                    };
+                    if ( checkAndHandleReferral( deleteResponse, monitor, referralsInfo, consumer ) )
+                    {
+                        return;
+                    }
+
                     // Checking the response
                     checkResponse( deleteResponse );
                 }
@@ -1078,6 +1128,62 @@ public class DirectoryApiConnectionWrapp
         }
     }
 
+
+    private boolean checkAndHandleReferral( ResultResponse response, StudioProgressMonitor monitor,
+        ReferralsInfo referralsInfo, Consumer<ReferralHandlingData> consumer ) throws NamingException, LdapURLEncodingException
+    {
+        if ( response == null )
+        {
+            return false;
+        }
+
+        LdapResult ldapResult = response.getLdapResult();
+        if ( ldapResult == null || !ResultCodeEnum.REFERRAL.equals( ldapResult.getResultCode() ) )
+        {
+            return false;
+        }
+
+        if ( referralsInfo == null )
+        {
+            referralsInfo = new ReferralsInfo( true );
+        }
+
+        Referral referral = ldapResult.getReferral();
+        referralsInfo.addReferral( referral );
+        Referral nextReferral = referralsInfo.getNextReferral();
+
+        Connection referralConnection = ConnectionWrapperUtils.getReferralConnection( nextReferral, monitor, this );
+        if ( referralConnection == null )
+        {
+            monitor.setCanceled( true );
+            return true;
+        }
+
+        List<String> urls = new ArrayList<String>( referral.getLdapUrls() );
+        String referralDn = new LdapUrl( urls.get( 0 ) ).getDn().getName();
+        ReferralHandlingData referralHandlingData = new ReferralHandlingData( referralConnection.getConnectionWrapper(),
+            referralDn, referralsInfo );
+        consumer.accept( referralHandlingData );
+
+        return true;
+    }
+
+
+    static class ReferralHandlingData
+    {
+        ConnectionWrapper connectionWrapper;
+        String referralDn;
+        ReferralsInfo newReferralsInfo;
+
+
+        ReferralHandlingData( ConnectionWrapper connectionWrapper, String referralDn, ReferralsInfo newReferralsInfo )
+        {
+            this.connectionWrapper = connectionWrapper;
+            this.referralDn = referralDn;
+            this.newReferralsInfo = newReferralsInfo;
+        }
+    }
+
 
     private void checkConnectionAndRunAndMonitor( final InnerRunnable runnable, final StudioProgressMonitor monitor )
         throws Exception

Modified: directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java Fri Aug  4 08:59:15 2017
@@ -355,9 +355,8 @@ public class JNDIConnectionWrapper imple
                     NamingEnumeration<SearchResult> result = searchCtx.search( JNDIConnectionWrapper
                         .getSaveJndiName( searchBase ), filter, searchControls );
                     namingEnumeration = new JndiStudioNamingEnumeration( connection, searchCtx, result, null,
-                        searchBase,
-                        filter, searchControls, aliasesDereferencingMethod, referralsHandlingMethod, controls,
-                        requestNum, monitor, referralsInfo );
+                        searchBase, filter, searchControls, aliasesDereferencingMethod, referralsHandlingMethod,
+                        controls, requestNum, monitor, referralsInfo );
                 }
                 catch ( PartialResultException e )
                 {
@@ -1539,7 +1538,7 @@ public class JNDIConnectionWrapper imple
     {
         if ( initialReferralsInfo == null )
         {
-            initialReferralsInfo = new ReferralsInfo();
+            initialReferralsInfo = new ReferralsInfo( true );
         }
 
         Referral referral = handleReferralException( referralException, initialReferralsInfo, null );

Modified: directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java Fri Aug  4 08:59:15 2017
@@ -148,6 +148,10 @@ public class JndiStudioNamingEnumeration
             {
                 done = true;
                 logResultDoneException = re;
+                if ( referralsInfo == null )
+                {
+                    referralsInfo = new ReferralsInfo( false );
+                }
                 referralsInfo = JNDIConnectionWrapper.handleReferralException( re, referralsInfo );
                 if ( referralsInfo.hasMoreReferrals() )
                 {
@@ -263,7 +267,7 @@ public class JndiStudioNamingEnumeration
     }
 
 
-    private boolean checkReferral()
+    private boolean checkReferral() throws NamingException
     {
         try
         {
@@ -281,18 +285,24 @@ public class JndiStudioNamingEnumeration
             {
                 delegate = new NamingEnumeration<SearchResult>()
                 {
-
-                    List<String> urls = new ArrayList<String>();
+                    List<String> urls;
+                    
+                    private NamingEnumeration<SearchResult> init() throws NamingException
                     {
-                        while ( referralsInfo.hasMoreReferrals() )
+                        urls = new ArrayList<String>();
                         {
-                            Referral referral = referralsInfo.getNextReferral();
-                            for ( IJndiLogger logger : ConnectionCorePlugin.getDefault().getJndiLoggers() )
+                            while ( referralsInfo.hasMoreReferrals() )
                             {
-                                logger.logSearchResultReference( connection, referral, referralsInfo, requestNum, null );
+                                Referral referral = referralsInfo.getNextReferral();
+                                for ( IJndiLogger logger : ConnectionCorePlugin.getDefault().getJndiLoggers() )
+                                {
+                                    logger.logSearchResultReference( connection, referral, referralsInfo, requestNum,
+                                        null );
+                                }
+                                urls.addAll( referral.getLdapUrls() );
                             }
-                            urls.addAll( referral.getLdapUrls() );
                         }
+                        return this;
                     }
 
 
@@ -338,7 +348,7 @@ public class JndiStudioNamingEnumeration
                         urls.clear();
                         referralsInfo = null;
                     }
-                };
+                }.init();
             }
             else if ( referralsHandlingMethod == ReferralHandlingMethod.FOLLOW )
             {

Modified: directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java Fri Aug  4 08:59:15 2017
@@ -41,16 +41,24 @@ public class ReferralsInfo
 
     private Set<String> processedUrls = new HashSet<String>();
 
+    private boolean throwExceptionOnLoop;
+
+
+    /**
+     * Creates a new instance of ReferralsInfo.
+     *
+     * @param throwExceptionOnLoop if an exception should be thrown when a referral loop is detected.
+     */
+    public ReferralsInfo( boolean throwExceptionOnLoop )
+    {
+        this.throwExceptionOnLoop = throwExceptionOnLoop;
+    }
+
 
     /**
      * Adds the referral entry to the list of referrals to be processed.
      * 
-     * If the URLs are already in the list or if the URL was already processed
-     * a NamingException will be thrown
-     * 
      * @param referral the referral
-     * 
-     * @throws LinkLoopException if a loop was encountered.
      */
     public void addReferral( Referral referral )
     {
@@ -59,19 +67,18 @@ public class ReferralsInfo
 
 
     /**
-     * Gets the next referral URL or null.
+     * Gets the next referral or null.
      * 
-     * @return the next referral URL or null
+     * @return the next referral or null
+     * @throws LinkLoopException 
      */
-    public Referral getNextReferral()
+    public Referral getNextReferral() throws LinkLoopException
     {
+        handleAlreadyProcessedUrls();
         if ( !referralsToProcess.isEmpty() )
         {
             Referral referral = referralsToProcess.removeFirst();
-            for ( String url : referral.getLdapUrls() )
-            {
-                processedUrls.add( url );
-            }
+            processedUrls.addAll( referral.getLdapUrls() );
             return referral;
         }
         else
@@ -85,9 +92,39 @@ public class ReferralsInfo
      * Checks for more referrals.
      * 
      * @return true, if there are more referrals
+     * @throws LinkLoopException 
      */
-    public boolean hasMoreReferrals()
+    public boolean hasMoreReferrals() throws LinkLoopException
     {
+        handleAlreadyProcessedUrls();
         return !referralsToProcess.isEmpty();
     }
+
+
+    private void handleAlreadyProcessedUrls() throws LinkLoopException
+    {
+        while ( !referralsToProcess.isEmpty() )
+        {
+            Referral referral = referralsToProcess.getFirst();
+            boolean alreadyProcessed = referral.getLdapUrls().stream().anyMatch( url -> processedUrls.contains( url ) );
+            if ( alreadyProcessed )
+            {
+                // yes, already processed, remove the current referral and continue with filtering
+                if ( throwExceptionOnLoop )
+                {
+                    throw new LinkLoopException( "Referral " + referral.getLdapUrls() + " already processed" );
+                }
+                else
+                {
+                    referralsToProcess.removeFirst();
+                }
+            }
+            else
+            {
+                // no, not yet processed, done with filtering
+                return;
+            }
+        }
+    }
+
 }

Modified: directory/studio/branches/studio-value/plugins/connection.core/src/main/resources/org/apache/directory/studio/connection/core/OIDDescriptions.properties
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.core/src/main/resources/org/apache/directory/studio/connection/core/OIDDescriptions.properties?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.core/src/main/resources/org/apache/directory/studio/connection/core/OIDDescriptions.properties (original)
+++ directory/studio/branches/studio-value/plugins/connection.core/src/main/resources/org/apache/directory/studio/connection/core/OIDDescriptions.properties Fri Aug  4 08:59:15 2017
@@ -768,6 +768,7 @@
 2.16.840.1.113719.1.14.100.91=GetNamedPasswordRequest 
 2.16.840.1.113719.1.14.100.92=GetNamedPasswordResponse
 2.16.840.1.113719.1.14.100.35=CloseChunkedResultRequest
+2.16.840.1.113719.1.14.100.93=GetJvmStatsRequest
 
 # From TID
 2.16.840.1.113719.1.27.101.5=Simple Password Control

Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java Fri Aug  4 08:59:15 2017
@@ -48,9 +48,9 @@ public class UIAuthHandler implements IA
     public ICredentials getCredentials( final ConnectionParameter connectionParameter )
     {
         // Checking if the bind principal is null or empty (no authentication)
-        if ( Strings.isEmpty( connectionParameter.getBindPrincipal() ) ) //$NON-NLS-1$
+        if ( Strings.isEmpty( connectionParameter.getBindPrincipal() ) )
         {
-            return new Credentials( StringUtils.EMPTY, StringUtils.EMPTY, connectionParameter ); //$NON-NLS-1$ //$NON-NLS-2$
+            return new Credentials( StringUtils.EMPTY, StringUtils.EMPTY, connectionParameter );
         }
         else
         {
@@ -73,7 +73,7 @@ public class UIAuthHandler implements IA
                 String password = passwordsKeyStoreManager.getConnectionPassword( connectionParameter.getId() );
 
                 // Checking if the bind password is available (the user chose to store the password)
-                if ( Strings.isEmpty( password ) ) //$NON-NLS-1$
+                if ( !Strings.isEmpty( password ) )
                 {
                     return new Credentials( connectionParameter.getBindPrincipal(),
                         password, connectionParameter );

Modified: directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java (original)
+++ directory/studio/branches/studio-value/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java Fri Aug  4 08:59:15 2017
@@ -294,7 +294,7 @@ public class CertificateListComposite ex
         buttonContainer.setLayoutData( new GridData( GridData.FILL, GridData.FILL, false, false ) );
 
         // The View Button 
-        Button viewButton = BaseWidgetUtils.createButton( buttonContainer, Messages
+        viewButton = BaseWidgetUtils.createButton( buttonContainer, Messages
             .getString( "CertificateListComposite.ViewButton" ), 1 );//$NON-NLS-1$
         
         viewButton.setEnabled( false );

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java Fri Aug  4 08:59:15 2017
@@ -24,6 +24,7 @@ package org.apache.directory.studio.ldap
 import java.io.File;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.directory.api.util.FileUtils;
 import org.apache.directory.studio.common.ui.CommonUIUtils;
@@ -103,12 +104,12 @@ public class HexDialog extends Dialog
             // Checking if the data is "text-editable"
             if ( isEditable( currentData ) )
             {
-                TextDialog dialog = new TextDialog( getShell(), new String( currentData ) );
+                TextDialog dialog = new TextDialog( getShell(), new String( currentData, StandardCharsets.UTF_8 ) );
 
                 if ( dialog.open() == TextDialog.OK )
                 {
                     String text = dialog.getText();
-                    currentData = text.getBytes();
+                    currentData = text.getBytes( StandardCharsets.UTF_8 );
                     hexText.setText( toFormattedHex( currentData ) );
                 }
             }
@@ -177,14 +178,7 @@ public class HexDialog extends Dialog
             return false;
         }
 
-        try
-        {
-            return !( new String( b, "UTF-8" ).contains( "\uFFFD" ) );
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            return false;
-        }
+        return !( new String( b, StandardCharsets.UTF_8 ).contains( "\uFFFD" ) );
     }
 
 

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java Fri Aug  4 08:59:15 2017
@@ -40,7 +40,6 @@ import org.eclipse.swt.widgets.Text;
  */
 public class TextDialog extends Dialog
 {
-
     /** The dialog title. */
     private static final String DIALOG_TITLE = Messages.getString( "TextDialog.TextEditor" ); //$NON-NLS-1$
 
@@ -72,6 +71,7 @@ public class TextDialog extends Dialog
     /**
      * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
      */
+    @Override
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -83,6 +83,7 @@ public class TextDialog extends Dialog
     /**
      * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
      */
+    @Override
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
@@ -93,6 +94,7 @@ public class TextDialog extends Dialog
     /**
      * @see org.eclipse.jface.dialogs.Dialog#okPressed()
      */
+    @Override
     protected void okPressed()
     {
         returnValue = text.getText();
@@ -103,6 +105,7 @@ public class TextDialog extends Dialog
     /**
      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
      */
+    @Override
     protected Control createDialogArea( Composite parent )
     {
         // create composite
@@ -121,6 +124,7 @@ public class TextDialog extends Dialog
         text.setLayoutData( gd );
 
         applyDialogFont( composite );
+        
         return composite;
     }
 
@@ -134,5 +138,4 @@ public class TextDialog extends Dialog
     {
         return returnValue;
     }
-
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.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/entryeditor/OpenBestEditorAction.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/OpenBestEditorAction.java Fri Aug  4 08:59:15 2017
@@ -107,7 +107,7 @@ public class OpenBestEditorAction extend
      */
     public String getText()
     {
-        if ( bestValueEditor != null )
+        if ( isEnabled() )
         {
             return bestValueEditor.getValueEditorName();
         }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java Fri Aug  4 08:59:15 2017
@@ -108,7 +108,6 @@ public class AttributeTypeWizardPage ext
         super( pageName );
         super.setTitle( Messages.getString( "AttributeTypeWizardPage.AttributeType" ) ); //$NON-NLS-1$
         super.setDescription( Messages.getString( "AttributeTypeWizardPage.AttributeTypeDescription" ) ); //$NON-NLS-1$
-        // super.setImageDescriptor(BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_ATTRIBUTE_WIZARD));
         super.setPageComplete( false );
 
         this.wizard = wizard;
@@ -126,13 +125,13 @@ public class AttributeTypeWizardPage ext
         possibleAttributeTypesSubschemaOnly = names.toArray( new String[0] );
         Arrays.sort( possibleAttributeTypesSubschemaOnly );
 
-        Set<String> set = new HashSet<String>( Arrays.asList( possibleAttributeTypesSubschemaOnly ) );
+        Set<String> set = new HashSet<>( Arrays.asList( possibleAttributeTypesSubschemaOnly ) );
         IAttribute[] existingAttributes = initialEntry.getAttributes();
         for ( int i = 0; existingAttributes != null && i < existingAttributes.length; i++ )
         {
             set.remove( existingAttributes[i].getDescription() );
         }
-        possibleAttributeTypesSubschemaOnlyAndExistingHidden = ( String[] ) set.toArray( new String[set.size()] );
+        possibleAttributeTypesSubschemaOnlyAndExistingHidden = set.toArray( new String[set.size()] );
         Arrays.sort( possibleAttributeTypesSubschemaOnlyAndExistingHidden );
 
         String attributeDescription = initialAttributeDescription;
@@ -158,9 +157,11 @@ public class AttributeTypeWizardPage ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setVisible( boolean visible )
     {
         super.setVisible( visible );
+
         if ( visible )
         {
             validate();
@@ -171,6 +172,7 @@ public class AttributeTypeWizardPage ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void createControl( Composite parent )
     {
         Composite composite = new Composite( parent, SWT.NONE );
@@ -208,6 +210,7 @@ public class AttributeTypeWizardPage ext
         // attribute type listener
         attributeTypeCombo.addModifyListener( new ModifyListener()
         {
+            @Override
             public void modifyText( ModifyEvent e )
             {
                 validate();
@@ -217,6 +220,7 @@ public class AttributeTypeWizardPage ext
         // filter listener
         showSubschemAttributesOnlyButton.addSelectionListener( new SelectionAdapter()
         {
+            @Override
             public void widgetSelected( SelectionEvent e )
             {
                 updateFilter();
@@ -225,6 +229,7 @@ public class AttributeTypeWizardPage ext
         } );
         hideExistingAttributesButton.addSelectionListener( new SelectionAdapter()
         {
+            @Override
             public void widgetSelected( SelectionEvent e )
             {
                 updateFilter();
@@ -280,7 +285,7 @@ public class AttributeTypeWizardPage ext
      */
     String getAttributeType()
     {
-        if ( attributeTypeCombo == null | attributeTypeCombo.isDisposed() )
+        if ( attributeTypeCombo == null || attributeTypeCombo.isDisposed() )
         {
             return ""; //$NON-NLS-1$
         }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java Fri Aug  4 08:59:15 2017
@@ -27,7 +27,6 @@ import org.eclipse.osgi.util.NLS;
 
 
 /**
- * 
  * Abstract base class for value editors that handle binary values
  * in a dialog. 
  *
@@ -58,14 +57,17 @@ public abstract class AbstractDialogBina
         }
         else
         {
-            if ( value == null )
+            Object rawValue = getRawValue( value );
+
+            if ( rawValue == null )
             {
-                return NULL; //$NON-NLS-1$
+                return NULL;
             }
-            else if ( value.isBinary() )
+            else if ( rawValue instanceof byte[] )
             {
-                byte[] data = value.getBinaryValue();
-                return NLS.bind( Messages.getString( "AbstractDialogBinaryValueEditor.BinaryDateNBytes" ), data.length ); //$NON-NLS-1$
+                byte[] data = ( byte[] ) rawValue;
+                return NLS.bind( Messages.getString( "AbstractDialogBinaryValueEditor.BinaryDateNBytes" ), //$NON-NLS-1$
+                    data.length );
             }
             else
             {

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java Fri Aug  4 08:59:15 2017
@@ -26,7 +26,6 @@ import org.apache.directory.studio.ldapb
 
 
 /**
- * 
  * Abstract base class for value editors that handle string values
  * in a dialog. 
  *
@@ -51,15 +50,7 @@ public abstract class AbstractDialogStri
     public String getDisplayValue( IValue value )
     {
         Object obj = getRawValue( value );
-        
-        if ( obj == null )
-        {
-            return NULL;
-        }
-        else
-        {
-            return obj.toString();
-        }
+        return StringValueEditorUtils.getDisplayValue( obj );
     }
 
 
@@ -90,44 +81,7 @@ public abstract class AbstractDialogStri
      */
     public Object getRawValue( IValue value )
     {
-        if ( value == null )
-        {
-            return null;
-        }
-        else if ( value.isString() )
-        {
-            return value.getStringValue();
-        }
-        else if ( value.isBinary() && isEditable( value.getBinaryValue() ) )
-        {
-            return value.getStringValue();
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-
-    /**
-     * Small helper.
-     */
-    private boolean isEditable( byte[] b )
-    {
-        if ( b == null )
-        {
-            return false;
-        }
-
-        for ( int i = 0; i < b.length; i++ )
-        {
-            if ( ( b[i] > '\u007F' ) || ( ( b[i] < '\u0020' ) && ( b[i] != '\n' ) && ( b[i] != '\r' ) ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
+        return StringValueEditorUtils.getRawValue( value );
     }
 
 
@@ -139,13 +93,6 @@ public abstract class AbstractDialogStri
      */
     public Object getStringOrBinaryValue( Object rawValue )
     {
-        if ( rawValue instanceof String )
-        {
-            return rawValue;
-        }
-        else
-        {
-            return null;
-        }
+        return StringValueEditorUtils.getStringOrBinaryValue( rawValue );
     }
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java Fri Aug  4 08:59:15 2017
@@ -38,7 +38,7 @@ import org.eclipse.jface.viewers.TextCel
 /**
  * 
  * Abstract base class for value editors that handle string values
- * withing the table or tree control. 
+ * within the table or tree control. 
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -80,21 +80,22 @@ public abstract class AbstractInPlaceStr
      * This implementation of getDisplayValue() returns a 
      * comma-separated list of all values. 
      */
+    @Override
     public String getDisplayValue( AttributeHierarchy attributeHierarchy )
     {
         if ( attributeHierarchy == null )
         {
-            return "NULL"; //$NON-NLS-1$
+            return NULL;
         }
 
-        List<IValue> valueList = new ArrayList<IValue>();
+        List<IValue> valueList = new ArrayList<>();
         
         for ( IAttribute attribute : attributeHierarchy )
         {
             valueList.addAll( Arrays.asList( attribute.getValues() ) );
         }
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         boolean isFirst = true;
         
         for ( IValue value : valueList )
@@ -120,18 +121,11 @@ public abstract class AbstractInPlaceStr
      * 
      * This implementation just returns the raw value
      */
+    @Override
     public String getDisplayValue( IValue value )
     {
         Object obj = getRawValue( value );
-        
-        if ( obj == null ) 
-        {
-            return "NULL";
-        }
-        else
-        {
-            return obj.toString();
-        }
+        return StringValueEditorUtils.getDisplayValue( obj );
     }
 
 
@@ -142,6 +136,7 @@ public abstract class AbstractInPlaceStr
      * in attributeHierarchy or calls getRawValue(IValue) if attributeHierarchy
      * contains exactly one value. Otherwise null is returned.
      */
+    @Override
     public Object getRawValue( AttributeHierarchy attributeHierarchy )
     {
         if ( ( attributeHierarchy != null ) && ( attributeHierarchy.size() == 1 ) )
@@ -170,6 +165,7 @@ public abstract class AbstractInPlaceStr
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean hasValue( IValue value )
     {
         return ( value != null ) && ( value.isString() || value.isBinary() );
@@ -182,43 +178,10 @@ public abstract class AbstractInPlaceStr
      * This implementation returns the string value 
      * of the given value. 
      */
+    @Override
     public Object getRawValue( IValue value )
     {
-        if ( value != null )
-        {
-            if ( value.isString() )
-            {
-                return value.getStringValue();
-            }
-            else if ( value.isBinary() && isEditable( value.getBinaryValue() ) )
-            {
-                return value.getStringValue();
-            }
-        }
-
-        return null;
-    }
-
-
-    /**
-     * Small helper.
-     */
-    private boolean isEditable( byte[] b )
-    {
-        if ( b == null )
-        {
-            return false;
-        }
-
-        for ( int i = 0; i < b.length; i++ )
-        {
-            if ( ( b[i] > '\u007F') || ( ( b[i] < '\u0020' ) && ( b[i] != '\n' ) && ( b[i] != '\r' ) ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
+        return StringValueEditorUtils.getRawValue( value );
     }
 
 
@@ -228,22 +191,17 @@ public abstract class AbstractInPlaceStr
      * This implementation always return the string value
      * as String.
      */
+    @Override
     public Object getStringOrBinaryValue( Object rawValue )
     {
-        if ( rawValue instanceof String )
-        {
-            return rawValue;
-        }
-        else
-        {
-            return null;
-        }
+        return StringValueEditorUtils.getStringOrBinaryValue( rawValue );
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public CellEditor getCellEditor()
     {
         return this;
@@ -253,6 +211,7 @@ public abstract class AbstractInPlaceStr
     /**
      * {@inheritDoc}
      */
+    @Override
     protected Object doGetValue()
     {
         if ( EMPTY.equals( text.getText() ) )
@@ -269,20 +228,24 @@ public abstract class AbstractInPlaceStr
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void doSetValue( Object value )
     {
         if ( value instanceof IValue.EmptyValue )
         {
-            value = ( ( IValue.EmptyValue ) value ).getStringValue();
+            super.doSetValue( ( ( IValue.EmptyValue ) value ).getStringValue() );
+        }
+        else
+        {
+            super.doSetValue( value );
         }
-        
-        super.doSetValue( value );
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setValueEditorName( String name )
     {
         this.name = name;
@@ -292,6 +255,7 @@ public abstract class AbstractInPlaceStr
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getValueEditorName()
     {
         return name;
@@ -301,6 +265,7 @@ public abstract class AbstractInPlaceStr
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setValueEditorImageDescriptor( ImageDescriptor imageDescriptor )
     {
         this.imageDescriptor = imageDescriptor;
@@ -310,6 +275,7 @@ public abstract class AbstractInPlaceStr
     /**
      * {@inheritDoc}
      */
+    @Override
     public ImageDescriptor getValueEditorImageDescriptor()
     {
         return imageDescriptor;

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java Fri Aug  4 08:59:15 2017
@@ -198,5 +198,5 @@ public interface IValueEditor
 
     // A constant for the emtpy string and null string.
     String EMPTY = ""; //$NON-NLS-1$
-    String NULL = "NULL"; //$NON-NLS-1$
+    String NULL = ">>> Error, the configured value editor can not handle this value! <<<"; //$NON-NLS-1$
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java Fri Aug  4 08:59:15 2017
@@ -32,25 +32,29 @@ import org.eclipse.swt.widgets.Shell;
  */
 public class TextValueEditor extends AbstractDialogStringValueEditor
 {
-
     /**
      * {@inheritDoc}
      * 
      * This implementation opens the TextDialog.
      */
+    @Override
     public boolean openDialog( Shell shell )
     {
         Object value = getValue();
+        
         if ( value instanceof String )
         {
             TextDialog dialog = new TextDialog( shell, ( String ) value );
-            if ( dialog.open() == TextDialog.OK && !"".equals( dialog.getText() ) ) //$NON-NLS-1$
+            String text = dialog.getText();
+            
+            if ( ( dialog.open() == TextDialog.OK ) && ( text != null ) && ( text.length() != 0 ) )
             {
-                setValue( dialog.getText() );
+                setValue( text );
+                
                 return true;
             }
         }
+        
         return false;
     }
-
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapAndFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapAndFilterComponent.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapAndFilterComponent.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapAndFilterComponent.java Fri Aug  4 08:59:15 2017
@@ -68,7 +68,7 @@ public class LdapAndFilterComponent exte
         {
             return Messages.LdapAndFilterComponent_MissingAndCharacter;
         }
-        else if ( filterList == null || filterList.isEmpty() )
+        else if ( filterList.isEmpty() )
         {
             return Messages.LdapAndFilterComponent_MissingFilters;
         }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapFilterComponent.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapFilterComponent.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapFilterComponent.java Fri Aug  4 08:59:15 2017
@@ -23,7 +23,6 @@ package org.apache.directory.studio.ldap
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterToken;
@@ -44,7 +43,7 @@ public abstract class LdapFilterComponen
     protected LdapFilterToken startToken;
 
     /** The filter list. */
-    protected List<LdapFilter> filterList;
+    protected final List<LdapFilter> filterList;
 
 
     /**
@@ -162,9 +161,8 @@ public abstract class LdapFilterComponen
             return false;
         }
 
-        for ( Iterator<LdapFilter> it = filterList.iterator(); it.hasNext(); )
+        for ( LdapFilter filter : filterList )
         {
-            LdapFilter filter = it.next();
             if ( filter == null || !filter.isValid() )
             {
                 return false;
@@ -200,9 +198,8 @@ public abstract class LdapFilterComponen
         else
         {
             List<LdapFilter> invalidFilterList = new ArrayList<LdapFilter>();
-            for ( Iterator<LdapFilter> it = filterList.iterator(); it.hasNext(); )
+            for ( LdapFilter filter : filterList )
             {
-                LdapFilter filter = it.next();
                 if ( filter != null )
                 {
                     invalidFilterList.addAll( Arrays.asList( filter.getInvalidFilters() ) );
@@ -226,9 +223,8 @@ public abstract class LdapFilterComponen
         {
             tokenList.add( startToken );
         }
-        for ( Iterator<LdapFilter> it = filterList.iterator(); it.hasNext(); )
+        for ( LdapFilter filter : filterList )
         {
-            LdapFilter filter = it.next();
             if ( filter != null )
             {
                 tokenList.addAll( Arrays.asList( filter.getTokens() ) );
@@ -259,11 +255,10 @@ public abstract class LdapFilterComponen
         {
             return parent;
         }
-        else if ( filterList != null || !filterList.isEmpty() )
+        else if ( !filterList.isEmpty() )
         {
-            for ( Iterator<LdapFilter> it = filterList.iterator(); it.hasNext(); )
+            for ( LdapFilter filter : filterList )
             {
-                LdapFilter filter = it.next();
                 if ( filter != null && filter.getFilter( offset ) != null )
                 {
                     return filter.getFilter( offset );

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapNotFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapNotFilterComponent.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapNotFilterComponent.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapNotFilterComponent.java Fri Aug  4 08:59:15 2017
@@ -86,7 +86,7 @@ public class LdapNotFilterComponent exte
         {
             return Messages.LdapNotFilterComponent_MissingNotCharacter;
         }
-        else if ( filterList == null || filterList.isEmpty() )
+        else if ( filterList.isEmpty() )
         {
             return Messages.LdapNotFilterComponent_MissingFilterExpression;
         }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapOrFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapOrFilterComponent.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapOrFilterComponent.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/filter/LdapOrFilterComponent.java Fri Aug  4 08:59:15 2017
@@ -68,7 +68,7 @@ public class LdapOrFilterComponent exten
         {
             return Messages.LdapOrFilterComponent_MissingOrCharacter;
         }
-        else if ( filterList == null || filterList.isEmpty() )
+        else if ( filterList.isEmpty() )
         {
             return Messages.LdapOrFilterComponent_MissingFilters;
         }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/about.ini
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/about.ini?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/about.ini (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/about.ini Fri Aug  4 08:59:15 2017
@@ -1,2 +1,2 @@
 featureImage=studio.png
-aboutText=Apache Directory Studio LDAP Browser - Tools for browsing and editing LDAP servers.\n\nVersion: ${unqualifiedVersion}.${buildQualifier}\n\nCopyright \u00A9 2006-2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.\nVisit http://directory.apache.org/studio
+aboutText=Apache Directory Studio LDAP Browser - Tools for browsing and editing LDAP servers.\n\nVersion: ${unqualifiedVersion}.${buildQualifier}\n\nCopyright \u00A9 2006-2016 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.\nVisit http://directory.apache.org/studio

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java Fri Aug  4 08:59:15 2017
@@ -108,23 +108,24 @@ public class EntryEditorManager
     public static final String PRIORITIES_SEPARATOR = ","; //$NON-NLS-1$
 
     /** The list of entry editors */
-    private Map<String, EntryEditorExtension> entryEditorExtensions = new HashMap<String, EntryEditorExtension>();
+    private Map<String, EntryEditorExtension> entryEditorExtensions = new HashMap<>();
 
     /** The shared reference copies for open-save-close editors; original entry -> reference copy */
-    private Map<IEntry, IEntry> oscSharedReferenceCopies = new HashMap<IEntry, IEntry>();
+    private Map<IEntry, IEntry> oscSharedReferenceCopies = new HashMap<>();
 
     /** The shared working copies for open-save-close editors; original entry -> working copy */
-    private Map<IEntry, IEntry> oscSharedWorkingCopies = new HashMap<IEntry, IEntry>();
+    private Map<IEntry, IEntry> oscSharedWorkingCopies = new HashMap<>();
 
     /** The shared reference copies for auto-save editors; original entry -> reference copy */
-    private Map<IEntry, IEntry> autoSaveSharedReferenceCopies = new HashMap<IEntry, IEntry>();
+    private Map<IEntry, IEntry> autoSaveSharedReferenceCopies = new HashMap<>();
 
     /** The shared working copies for auto-save editors; original entry -> working copy */
-    private Map<IEntry, IEntry> autoSaveSharedWorkingCopies = new HashMap<IEntry, IEntry>();
+    private Map<IEntry, IEntry> autoSaveSharedWorkingCopies = new HashMap<>();
 
     /** The comparator for entry editors */
     private Comparator<EntryEditorExtension> entryEditorComparator = new Comparator<EntryEditorExtension>()
     {
+        @Override
         public int compare( EntryEditorExtension o1, EntryEditorExtension o2 )
         {
             if ( o1 == null )
@@ -163,6 +164,7 @@ public class EntryEditorManager
     /** The listener for workbench part update */
     private IPartListener2 partListener = new IPartListener2()
     {
+        @Override
         public void partActivated( IWorkbenchPartReference partRef )
         {
             cleanupCopies( partRef.getPage() );
@@ -222,38 +224,45 @@ public class EntryEditorManager
         }
 
 
+        @Override
         public void partOpened( IWorkbenchPartReference partRef )
         {
         }
 
 
+        @Override
         public void partClosed( IWorkbenchPartReference partRef )
         {
             cleanupCopies( partRef.getPage() );
         }
 
 
+        @Override
         public void partInputChanged( IWorkbenchPartReference partRef )
         {
             cleanupCopies( partRef.getPage() );
         }
 
 
+        @Override
         public void partHidden( IWorkbenchPartReference partRef )
         {
         }
 
 
+        @Override
         public void partDeactivated( IWorkbenchPartReference partRef )
         {
         }
 
 
+        @Override
         public void partBroughtToTop( IWorkbenchPartReference partRef )
         {
         }
 
 
+        @Override
         public void partVisible( IWorkbenchPartReference partRef )
         {
         }
@@ -262,6 +271,7 @@ public class EntryEditorManager
     /** The listener for entry update */
     private EntryUpdateListener entryUpdateListener = new EntryUpdateListener()
     {
+        @Override
         public void entryUpdated( EntryModificationEvent event )
         {
             IEntry modifiedEntry = event.getModifiedEntry();
@@ -353,32 +363,35 @@ public class EntryEditorManager
                 // check all editors: if the input does not exist any more then close the editor
                 IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                 // Collecting editor references to close
-                List<IEditorReference> editorReferences = new ArrayList<IEditorReference>();
+                List<IEditorReference> editorReferences = new ArrayList<>();
                 
                 for ( IEditorReference ref : activePage.getEditorReferences() )
                 {
                     IEntryEditor editor = getEntryEditor( ref );
-                    EntryEditorInput entryEditorInput = editor.getEntryEditorInput();
-                    
-                    if ( entryEditorInput != null )
+                    if ( editor != null )
                     {
-                    	IEntry resolvedEntry = entryEditorInput.getResolvedEntry();
-	                    
-	                    if ( ( editor != null ) && ( resolvedEntry != null ) )
-	                    {
-	                        IBrowserConnection bc = resolvedEntry.getBrowserConnection();
-	                        Dn dn = resolvedEntry.getDn();
-	                        
-	                        if ( bc.getEntryFromCache( dn ) == null )
-	                        {
-	                            editorReferences.add( ref );
-	                        }
-	                    }
+                        EntryEditorInput entryEditorInput = editor.getEntryEditorInput();
+
+                        if ( entryEditorInput != null )
+                        {
+                            IEntry resolvedEntry = entryEditorInput.getResolvedEntry();
+
+                            if ( ( editor != null ) && ( resolvedEntry != null ) )
+                            {
+                                IBrowserConnection bc = resolvedEntry.getBrowserConnection();
+                                Dn dn = resolvedEntry.getDn();
+
+                                if ( bc.getEntryFromCache( dn ) == null )
+                                {
+                                    editorReferences.add( ref );
+                                }
+                            }
+                        }
                     }
                 }
 
                 // Closing the corresponding editor references
-                if ( editorReferences.size() > 0 )
+                if ( !editorReferences.isEmpty() )
                 {
                     activePage.closeEditors( editorReferences.toArray( new IEditorReference[0] ), false );
                 }
@@ -463,16 +476,18 @@ public class EntryEditorManager
     /** The listener for connection update */
     private ConnectionUpdateListener connectionUpdateListener = new ConnectionUpdateAdapter()
     {
+        @Override
         public void connectionClosed( Connection connection )
         {
             closeEditorsBelongingToConnection( connection );
-        };
+        }
 
 
+        @Override
         public void connectionRemoved( Connection connection )
         {
             closeEditorsBelongingToConnection( connection );
-        };
+        }
     };
 
 
@@ -507,7 +522,7 @@ public class EntryEditorManager
      */
     private void initEntryEditorExtensions()
     {
-        entryEditorExtensions = new HashMap<String, EntryEditorExtension>();
+        entryEditorExtensions = new HashMap<>();
 
         IExtensionRegistry registry = Platform.getExtensionRegistry();
         IExtensionPoint extensionPoint = registry.getExtensionPoint( BrowserUIConstants.ENTRY_EDITOR_EXTENSION_POINT );
@@ -621,7 +636,7 @@ public class EntryEditorManager
         Collection<EntryEditorExtension> entryEditorExtensions = getEntryEditorExtensions();
 
         // Creating the sorted entry editors list
-        ArrayList<EntryEditorExtension> sortedEntryEditorsList = new ArrayList<EntryEditorExtension>(
+        ArrayList<EntryEditorExtension> sortedEntryEditorsList = new ArrayList<>(
             entryEditorExtensions.size() );
 
         // Adding the remaining entry editors
@@ -650,7 +665,7 @@ public class EntryEditorManager
             .getEntryEditorExtensions();
 
         // Creating the sorted entry editors list
-        Collection<EntryEditorExtension> sortedEntryEditorsList = new ArrayList<EntryEditorExtension>(
+        Collection<EntryEditorExtension> sortedEntryEditorsList = new ArrayList<>(
             entryEditorExtensions.size() );
 
         // Getting the user's priorities
@@ -665,7 +680,7 @@ public class EntryEditorManager
             {
 
                 // Creating a map where entry editors are accessible via their ID
-                Map<String, EntryEditorExtension> entryEditorsMap = new HashMap<String, EntryEditorExtension>();
+                Map<String, EntryEditorExtension> entryEditorsMap = new HashMap<>();
                 
                 for ( EntryEditorExtension entryEditorExtension : entryEditorExtensions )
                 {
@@ -690,7 +705,7 @@ public class EntryEditorManager
             // We are then adding them at the end of the sorted list.
 
             // Creating a list of remaining entry editors
-            List<EntryEditorExtension> remainingEntryEditors = new ArrayList<EntryEditorExtension>();
+            List<EntryEditorExtension> remainingEntryEditors = new ArrayList<>();
             
             for ( EntryEditorExtension entryEditorExtension : entryEditorExtensions )
             {
@@ -729,7 +744,7 @@ public class EntryEditorManager
             IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
 
             // Collecting editor references to close
-            List<IEditorReference> editorReferences = new ArrayList<IEditorReference>();
+            List<IEditorReference> editorReferences = new ArrayList<>();
             
             for ( IEditorReference ref : activePage.getEditorReferences() )
             {
@@ -747,7 +762,7 @@ public class EntryEditorManager
             }
 
             // Closing the corresponding editor references
-            if ( editorReferences.size() > 0 )
+            if ( !editorReferences.isEmpty() )
             {
                 activePage.closeEditors( editorReferences.toArray( new IEditorReference[0] ), false );
             }
@@ -793,8 +808,8 @@ public class EntryEditorManager
         
         if ( referenceCopy != null )
         {
-            EntryEditorUtils.ensureAttributesInitialized( entry );
             EventRegistry.suspendEventFiringInCurrentThread();
+            EntryEditorUtils.ensureAttributesInitialized( entry );
             new CompoundModification().replaceAttributes( entry, referenceCopy, this );
             EventRegistry.resumeEventFiringInCurrentThread();
             oscSharedReferenceCopies.put( entry, referenceCopy );
@@ -816,9 +831,9 @@ public class EntryEditorManager
 
     private void updateAutoSaveSharedReferenceCopy( IEntry entry )
     {
+        EventRegistry.suspendEventFiringInCurrentThread();
         EntryEditorUtils.ensureAttributesInitialized( entry );
         IEntry workingCopy = autoSaveSharedReferenceCopies.get( entry );
-        EventRegistry.suspendEventFiringInCurrentThread();
         new CompoundModification().replaceAttributes( entry, workingCopy, this );
         EventRegistry.resumeEventFiringInCurrentThread();
     }
@@ -834,7 +849,7 @@ public class EntryEditorManager
 
     private List<IEntryEditor> getOscEditors( IEntry workingCopy )
     {
-        List<IEntryEditor> oscEditors = new ArrayList<IEntryEditor>();
+        List<IEntryEditor> oscEditors = new ArrayList<>();
         IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
             .getEditorReferences();
         
@@ -855,7 +870,7 @@ public class EntryEditorManager
 
     private List<IEntryEditor> getAutoSaveEditors( IEntry workingCopy )
     {
-        List<IEntryEditor> autoSaveEditors = new ArrayList<IEntryEditor>();
+        List<IEntryEditor> autoSaveEditors = new ArrayList<>();
         IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
             .getEditorReferences();
         
@@ -880,9 +895,7 @@ public class EntryEditorManager
         
         if ( part instanceof IEntryEditor )
         {
-            IEntryEditor entryEditor = ( IEntryEditor ) part;
-            
-            return entryEditor;
+            return ( IEntryEditor ) part;
         }
         
         return null;
@@ -898,8 +911,7 @@ public class EntryEditorManager
             
             if ( part == activeEditor )
             {
-                IWorkbenchPartReference reference = part.getSite().getPage().getReference( part );
-                return reference;
+                return part.getSite().getPage().getReference( part );
             }
         }
         
@@ -1066,8 +1078,8 @@ public class EntryEditorManager
     private void cleanupCopies( IWorkbenchPage page )
     {
         // cleanup unused copies (OSC + auto-save)
-        Set<IEntry> oscEntries = new HashSet<IEntry>();
-        Set<IEntry> autoSaveEntries = new HashSet<IEntry>();
+        Set<IEntry> oscEntries = new HashSet<>();
+        Set<IEntry> autoSaveEntries = new HashSet<>();
         IEditorReference[] editorReferences = page.getEditorReferences();
         
         for ( IEditorReference ref : editorReferences )

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java Fri Aug  4 08:59:15 2017
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.entryeditors;
 
 
+import org.apache.directory.studio.connection.ui.RunnableContextRunner;
 import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
-import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.eclipse.core.runtime.IStatus;
@@ -45,17 +45,13 @@ public class EntryEditorUtils
      *      the job associated with the attributes initialization, 
      *      or <code>null</code> if the attributes were already initialized
      */
-    public static StudioBrowserJob ensureAttributesInitialized( IEntry entry )
+    public static void ensureAttributesInitialized( IEntry entry )
     {
         if ( !entry.isAttributesInitialized() )
         {
             InitializeAttributesRunnable runnable = new InitializeAttributesRunnable( entry );
-            StudioBrowserJob job = new StudioBrowserJob( runnable );
-            job.execute();
-            return job;
+            RunnableContextRunner.execute( runnable, null, true );
         }
-
-        return null;
     }
 
 

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java Fri Aug  4 08:59:15 2017
@@ -240,4 +240,5 @@ public final class BrowserUIConstants
     public static final String WIZARD_NEW_SEARCH = BrowserUIPlugin.getDefault().getPluginProperties()
         .getString( "NewWizard_NewSearchWizard_id" ); //$NON-NLS-1$
 
+    public static final int INPUT_CHANGED = 1342730831;
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java Fri Aug  4 08:59:15 2017
@@ -27,9 +27,7 @@ import org.apache.directory.studio.entry
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidget;
-import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.util.IPropertyChangeListener;
@@ -40,7 +38,6 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.INavigationLocation;
 import org.eclipse.ui.INavigationLocationProvider;
@@ -78,6 +75,7 @@ public abstract class EntryEditor extend
 
     IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener()
     {
+        @Override
         public void propertyChange( org.eclipse.jface.util.PropertyChangeEvent event )
         {
             // set the input again if the auto-save option has been changed
@@ -96,6 +94,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void init( IEditorSite site, IEditorInput input ) throws PartInitException
     {
         setSite( site );
@@ -107,6 +106,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setInput( IEditorInput input )
     {
         super.setInput( input );
@@ -126,6 +126,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void createPartControl( Composite parent )
     {
         Composite composite = new Composite( parent, SWT.NONE );
@@ -163,6 +164,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setFocus()
     {
         mainWidget.setFocus();
@@ -172,6 +174,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public Object getAdapter( Class required )
     {
         if ( IContentOutlinePage.class.equals( required ) )
@@ -191,6 +194,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void dispose()
     {
         if ( configuration != null )
@@ -215,6 +219,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void doSave( final IProgressMonitor monitor )
     {
         if ( !isAutoSave() )
@@ -228,6 +233,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void doSaveAs()
     {
     }
@@ -236,6 +242,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isDirty()
     {
         return getEntryEditorInput().isSharedWorkingCopyDirty( this );
@@ -245,6 +252,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isSaveAsAllowed()
     {
         return false;
@@ -309,6 +317,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public INavigationLocation createEmptyNavigationLocation()
     {
         return null;
@@ -318,6 +327,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public INavigationLocation createNavigationLocation()
     {
         return new EntryEditorNavigationLocation( this );
@@ -340,6 +350,7 @@ public abstract class EntryEditor extend
      * 
      * {@inheritDoc}
      */
+    @Override
     public boolean canHandle( IEntry entry )
     {
         return true;
@@ -349,6 +360,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public EntryEditorInput getEntryEditorInput()
     {
         return EntryEditorUtils.getEntryEditorInput( getEditorInput() );
@@ -358,6 +370,7 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void workingCopyModified( Object source )
     {
         if ( mainWidget != null && !mainWidget.getViewer().isCellEditorActive() )
@@ -401,51 +414,30 @@ public abstract class EntryEditor extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public void showEditorInput( IEditorInput input )
     {
         if ( input instanceof EntryEditorInput )
         {
-            // If the editor is dirty, let's ask for a save before changing the input
-            if ( isDirty() )
-            {
-                if ( !EntryEditorUtils.askSaveSharedWorkingCopyBeforeInputChange( this ) )
-                {
-                    return;
-                }
-            }
-
             /*
-             * Workaround to make link-with-editor working for the single-tab editor:
-             * The call of firePropertyChange is used to inform the link-with-editor action.
-             * However firePropertyChange also modifies the navigation history.
-             * Thus, a dummy input with the real entry but a null extension is set.
-             * This avoids to modification of the navigation history.
-             * Afterwards the real input is set.
+             * Optimization: no need to set the input again if the same input is already set
              */
-            EntryEditorInput eei = ( EntryEditorInput ) input;
-            IEntry entry = eei.getEntryInput();
-            ISearchResult searchResult = eei.getSearchResultInput();
-            IBookmark bookmark = eei.getBookmarkInput();
-            EntryEditorInput dummyInput;
-            if ( entry != null )
+            if ( getEntryEditorInput() != null
+                && getEntryEditorInput().getResolvedEntry() == ( ( EntryEditorInput ) input ).getResolvedEntry() )
             {
-                dummyInput = new EntryEditorInput( entry, null );
+                return;
             }
-            else if ( searchResult != null )
-            {
-                dummyInput = new EntryEditorInput( searchResult, null );
-            }
-            else
+
+            // If the editor is dirty, let's ask for a save before changing the input
+            if ( isDirty() && !EntryEditorUtils.askSaveSharedWorkingCopyBeforeInputChange( this ) )
             {
-                dummyInput = new EntryEditorInput( bookmark, null );
+                return;
             }
-            setInput( dummyInput );
-            firePropertyChange( IEditorPart.PROP_INPUT );
 
             // now set the real input and mark history location
             setInput( input );
             getSite().getPage().getNavigationHistory().markLocation( this );
+            firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
         }
     }
-
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java Fri Aug  4 08:59:15 2017
@@ -28,9 +28,8 @@ import org.apache.directory.studio.ldapb
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
-import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.apache.directory.studio.ldifeditor.editor.LdifEditor;
 import org.apache.directory.studio.ldifeditor.editor.LdifOutlinePage;
 import org.apache.directory.studio.utils.ActionUtils;
@@ -41,7 +40,6 @@ import org.eclipse.jface.action.IMenuMan
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.INavigationLocation;
 import org.eclipse.ui.IShowEditorInput;
@@ -356,36 +354,10 @@ public abstract class LdifEntryEditor ex
                     }
                 }
 
-                /*
-                 * Workaround to make link-with-editor working for the single-tab editor:
-                 * The call of firePropertyChange is used to inform the link-with-editor action.
-                 * However firePropertyChange also modifies the navigation history.
-                 * Thus, a dummy input with the real entry but a null extension is set.
-                 * This avoids to modification of the navigation history.
-                 * Afterwards the real input is set.
-                 */
-                IEntry entry = eei.getEntryInput();
-                ISearchResult searchResult = eei.getSearchResultInput();
-                IBookmark bookmark = eei.getBookmarkInput();
-                EntryEditorInput dummyInput;
-                if ( entry != null )
-                {
-                    dummyInput = new EntryEditorInput( entry, null );
-                }
-                else if ( searchResult != null )
-                {
-                    dummyInput = new EntryEditorInput( searchResult, null );
-                }
-                else
-                {
-                    dummyInput = new EntryEditorInput( bookmark, null );
-                }
-                doSetInput( dummyInput );
-                firePropertyChange( IEditorPart.PROP_INPUT );
-
                 // now set the real input and mark history location
                 doSetInput( input );
                 getSite().getPage().getNavigationHistory().markLocation( this );
+                firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
             }
         }
         catch ( CoreException e )

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java Fri Aug  4 08:59:15 2017
@@ -37,7 +37,6 @@ import org.apache.directory.studio.ldapb
  */
 public class MultiTabEntryEditor extends EntryEditor
 {
-
     /**
      * Gets the ID of the MultiTabEntryEditor.
      * 
@@ -49,10 +48,13 @@ public class MultiTabEntryEditor extends
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public boolean isAutoSave()
     {
         return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_MULTI_TAB );
     }
-
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java Fri Aug  4 08:59:15 2017
@@ -33,7 +33,6 @@ import org.apache.directory.studio.ldapb
  */
 public class SingleTabEntryEditor extends EntryEditor
 {
-
     /**
      * Gets the ID of the SingleTabEntryEditor.
      * 
@@ -45,10 +44,13 @@ public class SingleTabEntryEditor extend
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public boolean isAutoSave()
     {
         return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_AUTOSAVE_SINGLE_TAB );
     }
-
 }

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java (original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java Fri Aug  4 08:59:15 2017
@@ -170,22 +170,17 @@ public class SearchResultEditor extends
         if ( input instanceof SearchResultEditorInput )
         {
             /*
-             * Workaround to make link-with-editor working for the single-tab editor:
-             * The call of firePropertyChange is used to inform the link-with-editor action.
-             * However firePropertyChange also modifies the navigation history.
-             * Thus, a dummy input with the real search but dummy flag is set.
-             * This avoids to modification of the navigation history.
-             * Afterwards the real input is set.
+             * Optimization: no need to set the input again if the same input is already set
              */
-            SearchResultEditorInput srei = ( SearchResultEditorInput ) input;
-            ISearch search = srei.getSearch();
-            SearchResultEditorInput dummyInput = new SearchResultEditorInput( search, true );
-            setInput( dummyInput );
-            firePropertyChange( IEditorPart.PROP_INPUT );
+            if ( getEditorInput() != null && getEditorInput().equals( input ) )
+            {
+                return;
+            }
 
             // now set the real input and mark history location
             setInput( input );
             getSite().getPage().getNavigationHistory().markLocation( this );
+            firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
         }
     }
 



Mime
View raw message