directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r594684 - in /directory/studio/trunk: studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/ studio-ldapbrowser-commo...
Date Tue, 13 Nov 2007 22:46:13 GMT
Author: seelmann
Date: Tue Nov 13 14:46:12 2007
New Revision: 594684

URL: http://svn.apache.org/viewvc?rev=594684&view=rev
Log:
Fix for DIRSTUDIO-235: Using Character.isISOControl() to determine whether a character is
printable or not

Modified:
    directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/BookmarkPropertyPage.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SearchPropertyPage.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/ValuePropertyPage.java

Modified: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Utils.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
(original)
+++ directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
Tue Nov 13 14:46:12 2007
@@ -31,7 +31,8 @@
 {
 
     /**
-     * Shortens the given label to the given maximum length.
+     * Shortens the given label to the given maximum length
+     * and filters non-printable characters.
      * 
      * @param label the label
      * @param maxLength the max length
@@ -44,6 +45,8 @@
         {
             return null;
         }
+
+        // shorten label
         if ( maxLength < 3 )
         {
             return "...";
@@ -54,15 +57,22 @@
                 + label.substring( label.length() - maxLength / 2, label.length() );
 
         }
+
+        // filter non-printable characters
         StringBuffer sb = new StringBuffer( maxLength + 3 );
         for ( int i = 0; i < label.length(); i++ )
         {
             char c = label.charAt( i );
-            if ( c > 31 && c < 127 )
-                sb.append( c );
-            else
+            if ( Character.isISOControl( c ) )
+            {
                 sb.append( '.' );
+            }
+            else
+            {
+                sb.append( c );
+            }
         }
+
         return sb.toString();
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java
Tue Nov 13 14:46:12 2007
@@ -22,8 +22,7 @@
 
 
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
-
+import org.apache.directory.studio.connection.core.Utils;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.jface.preference.PreferenceDialog;
 import org.eclipse.jface.resource.ImageDescriptor;

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
Tue Nov 13 14:46:12 2007
@@ -36,7 +36,7 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.BaseDNEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DirectoryMetadataEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.ReferralBaseEntry;
-import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
+import org.apache.directory.studio.connection.core.Utils;
 import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.viewers.IColorProvider;
 import org.eclipse.jface.viewers.IFontProvider;

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
Tue Nov 13 14:46:12 2007
@@ -202,33 +202,4 @@
         return false;
     }
 
-
-    public static String shorten( String label, int maxLength )
-    {
-        if ( label == null )
-        {
-            return null;
-        }
-        if ( maxLength < 3 )
-        {
-            return "...";
-        }
-        if ( label.length() > maxLength )
-        {
-            label = label.substring( 0, maxLength / 2 ) + "..."
-                + label.substring( label.length() - maxLength / 2, label.length() );
-
-        }
-        StringBuffer sb = new StringBuffer( maxLength + 3 );
-        for ( int i = 0; i < label.length(); i++ )
-        {
-            char c = label.charAt( i );
-            if ( c > 31 && c < 127 )
-                sb.append( c );
-            else
-                sb.append( '.' );
-        }
-        return sb.toString();
-    }
-
 }

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/BookmarkPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/BookmarkPropertyPage.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/BookmarkPropertyPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/BookmarkPropertyPage.java
Tue Nov 13 14:46:12 2007
@@ -26,7 +26,7 @@
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
 import org.apache.directory.studio.ldapbrowser.common.widgets.search.EntryWidget;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
-import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
+import org.apache.directory.studio.connection.core.Utils;
 
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.swt.events.ModifyEvent;

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SearchPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SearchPropertyPage.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SearchPropertyPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SearchPropertyPage.java
Tue Nov 13 14:46:12 2007
@@ -29,7 +29,7 @@
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Search;
-import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
+import org.apache.directory.studio.connection.core.Utils;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbenchPropertyPage;

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/ValuePropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/ValuePropertyPage.java?rev=594684&r1=594683&r2=594684&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/ValuePropertyPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/ValuePropertyPage.java
Tue Nov 13 14:46:12 2007
@@ -91,8 +91,8 @@
 
         if ( value != null )
         {
-
-            super.setMessage( "Value " + Utils.shorten( value.toString(), 30 ) );
+            super.setMessage( "Value "
+                + org.apache.directory.studio.connection.core.Utils.shorten( value.toString(),
30 ) );
 
             descriptionText.setText( value.getAttribute().getDescription() );
             // valueText.setText(LdifUtils.mustEncode(value.getBinaryValue())?"Binary":value.getStringValue());



Mime
View raw message