You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/12/18 18:32:09 UTC

svn commit: r488355 [9/10] - in /directory/sandbox/pamarcelot/ldapstudio: ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/ ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/ ldapstudio-browse...

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/UnixCrypt.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/UnixCrypt.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/UnixCrypt.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/UnixCrypt.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,506 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+/*
+ * @(#)UnixCrypt.java	0.9 96/11/25
+ *
+ * Copyright (c) 1996 Aki Yoshida. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software
+ * for non-commercial or commercial purposes and without fee is
+ * hereby granted provided that this copyright notice appears in
+ * all copies.
+ */
+
+/**
+ * Unix crypt(3C) utility
+ *
+ * @version 	0.9, 11/25/96
+ * @author 	Aki Yoshida
+ */
+
+/**
+ * modified April 2001
+ * by Iris Van den Broeke, Daniel Deville
+ */
+
+package org.apache.directory.ldapstudio.browser.core.utils;
+
+
+/* ------------------------------------------------------------ */
+/**
+ * Unix Crypt. Implements the one way cryptography used by Unix systems for
+ * simple password protection.
+ * 
+ * @version $Id: UnixCrypt.java,v 1.1 2006/07/07 19:09:16 stefan Exp $
+ * @author Greg Wilkins (gregw)
+ */
+public class UnixCrypt
+{
+
+    /* (mostly) Standard DES Tables from Tom Truscott */
+    private static final byte[] IP =
+        { /* initial permutation */
+        58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40,
+            32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5,
+            63, 55, 47, 39, 31, 23, 15, 7 };
+
+    /* The final permutation is the inverse of IP - no table is necessary */
+    private static final byte[] ExpandTr =
+        { /* expansion operation */
+        32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20,
+            21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 };
+
+    private static final byte[] PC1 =
+        { /* permuted choice table 1 */
+        57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
+
+        63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 };
+
+    private static final byte[] Rotates =
+        { /* PC1 rotation schedule */
+        1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 };
+
+    private static final byte[] PC2 =
+        { /* permuted choice table 2 */
+        9, 18, 14, 17, 11, 24, 1, 5, 22, 25, 3, 28, 15, 6, 21, 10, 35, 38, 23, 19, 12, 4, 26, 8, 43, 54, 16, 7, 27, 20,
+            13, 2,
+
+            0, 0, 41, 52, 31, 37, 47, 55, 0, 0, 30, 40, 51, 45, 33, 48, 0, 0, 44, 49, 39, 56, 34, 53, 0, 0, 46, 42, 50,
+            36, 29, 32 };
+
+    private static final byte[][] S =
+        { /* 48->32 bit substitution tables */
+                /* S[1] */
+                { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5,
+                    3, 8, 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14,
+                    10, 0, 6, 13 },
+                /* S[2] */
+                { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9,
+                    11, 5, 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7,
+                    12, 0, 5, 14, 9 },
+                /* S[3] */
+                { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11,
+                    15, 1, 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14,
+                    3, 11, 5, 2, 12 },
+                /* S[4] */
+                { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10,
+                    14, 9, 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5,
+                    11, 12, 7, 2, 14 },
+                /* S[5] */
+                { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9,
+                    8, 6, 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0,
+                    9, 10, 4, 5, 3 },
+                /* S[6] */
+                { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11,
+                    3, 8, 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1,
+                    7, 6, 0, 8, 13 },
+                /* S[7] */
+                { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15,
+                    8, 6, 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15,
+                    14, 2, 3, 12 },
+                /* S[8] */
+                { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14,
+                    9, 2, 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9,
+                    0, 3, 5, 6, 11 } };
+
+    private static final byte[] P32Tr =
+        { /* 32-bit permutation function */
+        16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11,
+            4, 25 };
+
+    private static final byte[] CIFP =
+        { /*
+         * compressed/interleaved
+         * permutation
+         */
+        1, 2, 3, 4, 17, 18, 19, 20, 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 25, 26, 27, 28, 13, 14, 15, 16, 29, 30,
+            31, 32,
+
+            33, 34, 35, 36, 49, 50, 51, 52, 37, 38, 39, 40, 53, 54, 55, 56, 41, 42, 43, 44, 57, 58, 59, 60, 45, 46, 47,
+            48, 61, 62, 63, 64 };
+
+    private static final byte[] ITOA64 =
+        { /* 0..63 => ascii-64 */
+        ( byte ) '.', ( byte ) '/', ( byte ) '0', ( byte ) '1', ( byte ) '2', ( byte ) '3', ( byte ) '4', ( byte ) '5',
+            ( byte ) '6', ( byte ) '7', ( byte ) '8', ( byte ) '9', ( byte ) 'A', ( byte ) 'B', ( byte ) 'C',
+            ( byte ) 'D', ( byte ) 'E', ( byte ) 'F', ( byte ) 'G', ( byte ) 'H', ( byte ) 'I', ( byte ) 'J',
+            ( byte ) 'K', ( byte ) 'L', ( byte ) 'M', ( byte ) 'N', ( byte ) 'O', ( byte ) 'P', ( byte ) 'Q',
+            ( byte ) 'R', ( byte ) 'S', ( byte ) 'T', ( byte ) 'U', ( byte ) 'V', ( byte ) 'W', ( byte ) 'X',
+            ( byte ) 'Y', ( byte ) 'Z', ( byte ) 'a', ( byte ) 'b', ( byte ) 'c', ( byte ) 'd', ( byte ) 'e',
+            ( byte ) 'f', ( byte ) 'g', ( byte ) 'h', ( byte ) 'i', ( byte ) 'j', ( byte ) 'k', ( byte ) 'l',
+            ( byte ) 'm', ( byte ) 'n', ( byte ) 'o', ( byte ) 'p', ( byte ) 'q', ( byte ) 'r', ( byte ) 's',
+            ( byte ) 't', ( byte ) 'u', ( byte ) 'v', ( byte ) 'w', ( byte ) 'x', ( byte ) 'y', ( byte ) 'z' };
+
+    /* ===== Tables that are initialized at run time ==================== */
+
+    private static byte[] A64TOI = new byte[128]; /* ascii-64 => 0..63 */
+
+    /* Initial key schedule permutation */
+    private static long[][] PC1ROT = new long[16][16];
+
+    /* Subsequent key schedule rotation permutations */
+    private static long[][][] PC2ROT = new long[2][16][16];
+
+    /* Initial permutation/expansion table */
+    private static long[][] IE3264 = new long[8][16];
+
+    /* Table that combines the S, P, and E operations. */
+    private static long[][] SPE = new long[8][64];
+
+    /* compressed/interleaved => final permutation table */
+    private static long[][] CF6464 = new long[16][16];
+
+    /* ==================================== */
+
+    static
+    {
+        byte[] perm = new byte[64];
+        byte[] temp = new byte[64];
+
+        // inverse table.
+        for ( int i = 0; i < 64; i++ )
+            A64TOI[ITOA64[i]] = ( byte ) i;
+
+        // PC1ROT - bit reverse, then PC1, then Rotate, then PC2
+        for ( int i = 0; i < 64; i++ )
+            perm[i] = ( byte ) 0;;
+        for ( int i = 0; i < 64; i++ )
+        {
+            int k;
+            if ( ( k = ( int ) PC2[i] ) == 0 )
+                continue;
+            k += Rotates[0] - 1;
+            if ( ( k % 28 ) < Rotates[0] )
+                k -= 28;
+            k = ( int ) PC1[k];
+            if ( k > 0 )
+            {
+                k--;
+                k = ( k | 0x07 ) - ( k & 0x07 );
+                k++;
+            }
+            perm[i] = ( byte ) k;
+        }
+        init_perm( PC1ROT, perm, 8, 8 );
+
+        // PC2ROT - PC2 inverse, then Rotate, then PC2
+        for ( int j = 0; j < 2; j++ )
+        {
+            int k;
+            for ( int i = 0; i < 64; i++ )
+                perm[i] = temp[i] = 0;
+            for ( int i = 0; i < 64; i++ )
+            {
+                if ( ( k = ( int ) PC2[i] ) == 0 )
+                    continue;
+                temp[k - 1] = ( byte ) ( i + 1 );
+            }
+            for ( int i = 0; i < 64; i++ )
+            {
+                if ( ( k = ( int ) PC2[i] ) == 0 )
+                    continue;
+                k += j;
+                if ( ( k % 28 ) <= j )
+                    k -= 28;
+                perm[i] = temp[k];
+            }
+
+            init_perm( PC2ROT[j], perm, 8, 8 );
+        }
+
+        // Bit reverse, intial permupation, expantion
+        for ( int i = 0; i < 8; i++ )
+        {
+            for ( int j = 0; j < 8; j++ )
+            {
+                int k = ( j < 2 ) ? 0 : IP[ExpandTr[i * 6 + j - 2] - 1];
+                if ( k > 32 )
+                    k -= 32;
+                else if ( k > 0 )
+                    k--;
+                if ( k > 0 )
+                {
+                    k--;
+                    k = ( k | 0x07 ) - ( k & 0x07 );
+                    k++;
+                }
+                perm[i * 8 + j] = ( byte ) k;
+            }
+        }
+
+        init_perm( IE3264, perm, 4, 8 );
+
+        // Compression, final permutation, bit reverse
+        for ( int i = 0; i < 64; i++ )
+        {
+            int k = IP[CIFP[i] - 1];
+            if ( k > 0 )
+            {
+                k--;
+                k = ( k | 0x07 ) - ( k & 0x07 );
+                k++;
+            }
+            perm[k - 1] = ( byte ) ( i + 1 );
+        }
+
+        init_perm( CF6464, perm, 8, 8 );
+
+        // SPE table
+        for ( int i = 0; i < 48; i++ )
+            perm[i] = P32Tr[ExpandTr[i] - 1];
+        for ( int t = 0; t < 8; t++ )
+        {
+            for ( int j = 0; j < 64; j++ )
+            {
+                int k = ( ( ( j >> 0 ) & 0x01 ) << 5 ) | ( ( ( j >> 1 ) & 0x01 ) << 3 ) | ( ( ( j >> 2 ) & 0x01 ) << 2 )
+                    | ( ( ( j >> 3 ) & 0x01 ) << 1 ) | ( ( ( j >> 4 ) & 0x01 ) << 0 ) | ( ( ( j >> 5 ) & 0x01 ) << 4 );
+                k = S[t][k];
+                k = ( ( ( k >> 3 ) & 0x01 ) << 0 ) | ( ( ( k >> 2 ) & 0x01 ) << 1 ) | ( ( ( k >> 1 ) & 0x01 ) << 2 )
+                    | ( ( ( k >> 0 ) & 0x01 ) << 3 );
+                for ( int i = 0; i < 32; i++ )
+                    temp[i] = 0;
+                for ( int i = 0; i < 4; i++ )
+                    temp[4 * t + i] = ( byte ) ( ( k >> i ) & 0x01 );
+                long kk = 0;
+                for ( int i = 24; --i >= 0; )
+                    kk = ( ( kk << 1 ) | ( ( long ) temp[perm[i] - 1] ) << 32 | ( ( long ) temp[perm[i + 24] - 1] ) );
+
+                SPE[t][j] = to_six_bit( kk );
+            }
+        }
+    }
+
+
+    /**
+     * You can't call the constructer.
+     */
+    private UnixCrypt()
+    {
+    }
+
+
+    /**
+     * Returns the transposed and split code of a 24-bit code into a 4-byte
+     * code, each having 6 bits.
+     */
+    private static int to_six_bit( int num )
+    {
+        return ( ( ( num << 26 ) & 0xfc000000 ) | ( ( num << 12 ) & 0xfc0000 ) | ( ( num >> 2 ) & 0xfc00 ) | ( ( num >> 16 ) & 0xfc ) );
+    }
+
+
+    /**
+     * Returns the transposed and split code of two 24-bit code into two
+     * 4-byte code, each having 6 bits.
+     */
+    private static long to_six_bit( long num )
+    {
+        return ( ( ( num << 26 ) & 0xfc000000fc000000L ) | ( ( num << 12 ) & 0xfc000000fc0000L )
+            | ( ( num >> 2 ) & 0xfc000000fc00L ) | ( ( num >> 16 ) & 0xfc000000fcL ) );
+    }
+
+
+    /**
+     * Returns the permutation of the given 64-bit code with the specified
+     * permutataion table.
+     */
+    private static long perm6464( long c, long[][] p )
+    {
+        long out = 0L;
+        for ( int i = 8; --i >= 0; )
+        {
+            int t = ( int ) ( 0x00ff & c );
+            c >>= 8;
+            long tp = p[i << 1][t & 0x0f];
+            out |= tp;
+            tp = p[( i << 1 ) + 1][t >> 4];
+            out |= tp;
+        }
+        return out;
+    }
+
+
+    /**
+     * Returns the permutation of the given 32-bit code with the specified
+     * permutataion table.
+     */
+    private static long perm3264( int c, long[][] p )
+    {
+        long out = 0L;
+        for ( int i = 4; --i >= 0; )
+        {
+            int t = ( int ) ( 0x00ff & c );
+            c >>= 8;
+            long tp = p[i << 1][t & 0x0f];
+            out |= tp;
+            tp = p[( i << 1 ) + 1][t >> 4];
+            out |= tp;
+        }
+        return out;
+    }
+
+
+    /**
+     * Returns the key schedule for the given key.
+     */
+    private static long[] des_setkey( long keyword )
+    {
+        long K = perm6464( keyword, PC1ROT );
+        long[] KS = new long[16];
+        KS[0] = K & ~0x0303030300000000L;
+
+        for ( int i = 1; i < 16; i++ )
+        {
+            KS[i] = K;
+            K = perm6464( K, PC2ROT[Rotates[i] - 1] );
+
+            KS[i] = K & ~0x0303030300000000L;
+        }
+        return KS;
+    }
+
+
+    /**
+     * Returns the DES encrypted code of the given word with the specified
+     * environment.
+     */
+    private static long des_cipher( long in, int salt, int num_iter, long[] KS )
+    {
+        salt = to_six_bit( salt );
+        long L = in;
+        long R = L;
+        L &= 0x5555555555555555L;
+        R = ( R & 0xaaaaaaaa00000000L ) | ( ( R >> 1 ) & 0x0000000055555555L );
+        L = ( ( ( ( L << 1 ) | ( L << 32 ) ) & 0xffffffff00000000L ) | ( ( R | ( R >> 32 ) ) & 0x00000000ffffffffL ) );
+
+        L = perm3264( ( int ) ( L >> 32 ), IE3264 );
+        R = perm3264( ( int ) ( L & 0xffffffff ), IE3264 );
+
+        while ( --num_iter >= 0 )
+        {
+            for ( int loop_count = 0; loop_count < 8; loop_count++ )
+            {
+                long kp;
+                long B;
+                long k;
+
+                kp = KS[( loop_count << 1 )];
+                k = ( ( R >> 32 ) ^ R ) & salt & 0xffffffffL;
+                k |= ( k << 32 );
+                B = ( k ^ R ^ kp );
+
+                L ^= ( SPE[0][( int ) ( ( B >> 58 ) & 0x3f )] ^ SPE[1][( int ) ( ( B >> 50 ) & 0x3f )]
+                    ^ SPE[2][( int ) ( ( B >> 42 ) & 0x3f )] ^ SPE[3][( int ) ( ( B >> 34 ) & 0x3f )]
+                    ^ SPE[4][( int ) ( ( B >> 26 ) & 0x3f )] ^ SPE[5][( int ) ( ( B >> 18 ) & 0x3f )]
+                    ^ SPE[6][( int ) ( ( B >> 10 ) & 0x3f )] ^ SPE[7][( int ) ( ( B >> 2 ) & 0x3f )] );
+
+                kp = KS[( loop_count << 1 ) + 1];
+                k = ( ( L >> 32 ) ^ L ) & salt & 0xffffffffL;
+                k |= ( k << 32 );
+                B = ( k ^ L ^ kp );
+
+                R ^= ( SPE[0][( int ) ( ( B >> 58 ) & 0x3f )] ^ SPE[1][( int ) ( ( B >> 50 ) & 0x3f )]
+                    ^ SPE[2][( int ) ( ( B >> 42 ) & 0x3f )] ^ SPE[3][( int ) ( ( B >> 34 ) & 0x3f )]
+                    ^ SPE[4][( int ) ( ( B >> 26 ) & 0x3f )] ^ SPE[5][( int ) ( ( B >> 18 ) & 0x3f )]
+                    ^ SPE[6][( int ) ( ( B >> 10 ) & 0x3f )] ^ SPE[7][( int ) ( ( B >> 2 ) & 0x3f )] );
+            }
+            // swap L and R
+            L ^= R;
+            R ^= L;
+            L ^= R;
+        }
+        L = ( ( ( ( L >> 35 ) & 0x0f0f0f0fL ) | ( ( ( L & 0xffffffff ) << 1 ) & 0xf0f0f0f0L ) ) << 32 | ( ( ( R >> 35 ) & 0x0f0f0f0fL ) | ( ( ( R & 0xffffffff ) << 1 ) & 0xf0f0f0f0L ) ) );
+
+        L = perm6464( L, CF6464 );
+
+        return L;
+    }
+
+
+    /**
+     * Initializes the given permutation table with the mapping table.
+     */
+    private static void init_perm( long[][] perm, byte[] p, int chars_in, int chars_out )
+    {
+        for ( int k = 0; k < chars_out * 8; k++ )
+        {
+
+            int l = p[k] - 1;
+            if ( l < 0 )
+                continue;
+            int i = l >> 2;
+            l = 1 << ( l & 0x03 );
+            for ( int j = 0; j < 16; j++ )
+            {
+                int s = ( ( k & 0x07 ) + ( ( 7 - ( k >> 3 ) ) << 3 ) );
+                if ( ( j & l ) != 0x00 )
+                    perm[i][j] |= ( 1L << s );
+            }
+        }
+    }
+
+
+    /**
+     * Encrypts String into crypt (Unix) code.
+     * 
+     * @param key
+     *                the key to be encrypted
+     * @param setting
+     *                the salt to be used
+     * @return the encrypted String
+     */
+    public static String crypt( String key, String setting )
+    {
+        long constdatablock = 0L; /* encryption constant */
+        byte[] cryptresult = new byte[13]; /* encrypted result */
+        long keyword = 0L;
+        int keylen = key.length();
+
+        for ( int i = 0; i < 8; i++ )
+        {
+            keyword = ( keyword << 8 ) | ( ( i < keylen ) ? 2 * key.charAt( i ) : 0 );
+        }
+
+        long[] KS = des_setkey( keyword );
+
+        int salt = 0;
+        for ( int i = 2; --i >= 0; )
+        {
+            char c = ( i < setting.length() ) ? setting.charAt( i ) : '.';
+            cryptresult[i] = ( byte ) c;
+            salt = ( salt << 6 ) | ( int ) ( 0x00ff & A64TOI[c] );
+        }
+
+        long rsltblock = des_cipher( constdatablock, salt, 25, KS );
+
+        cryptresult[12] = ITOA64[( ( ( int ) rsltblock ) << 2 ) & 0x3f];
+        rsltblock >>= 4;
+        for ( int i = 12; --i >= 2; )
+        {
+            cryptresult[i] = ITOA64[( ( int ) rsltblock ) & 0x3f];
+            rsltblock >>= 6;
+        }
+
+        return new String( cryptresult );
+        // return new String(cryptresult, 0x00, 0, 13);
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/Utils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/Utils.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/Utils.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/Utils.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,232 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.utils;
+
+
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class Utils
+{
+
+    public static String[] stringToArray( String s )
+    {
+        if ( s == null )
+        {
+            return null;
+        }
+        else
+        {
+            List attributeList = new ArrayList();
+
+            StringBuffer temp = new StringBuffer();
+            for ( int i = 0; i < s.length(); i++ )
+            {
+                char c = s.charAt( i );
+
+                if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-'
+                    || c == '.' || c == ';' )
+                {
+                    temp.append( c );
+                }
+                else
+                {
+                    if ( temp.length() > 0 )
+                    {
+                        attributeList.add( temp.toString() );
+                        temp = new StringBuffer();
+                    }
+                }
+            }
+            if ( temp.length() > 0 )
+            {
+                attributeList.add( temp.toString() );
+            }
+
+            return ( String[] ) attributeList.toArray( new String[attributeList.size()] );
+        }
+
+        // else {
+        // s = s.trim();
+        // s = s.replaceAll(" ", "");
+        // s = s.replaceAll(",,", ",");
+        // String[] a;
+        // if(s.length() > 0) {
+        // a = s.split(",", 0);
+        // }
+        // else {
+        // a = new String[0];
+        // }
+        // return a;
+        // }
+    }
+
+
+    public static String arrayToString( String[] array )
+    {
+        if ( array == null || array.length == 0 )
+        {
+            return "";
+        }
+        else
+        {
+            StringBuffer sb = new StringBuffer( array[0] );
+            for ( int i = 1; i < array.length; i++ )
+            {
+                sb.append( ", " );
+                sb.append( array[i] );
+            }
+            return sb.toString();
+        }
+    }
+
+
+    public static boolean equals( byte[] data1, byte[] data2 )
+    {
+        if ( data1 == data2 )
+            return true;
+        if ( data1 == null || data2 == null )
+            return false;
+        if ( data1.length != data2.length )
+            return false;
+        for ( int i = 0; i < data1.length; i++ )
+        {
+            if ( data1[i] != data2[i] )
+                return false;
+        }
+        return true;
+    }
+
+
+    public static String getShortenedString( String value, int length )
+    {
+
+        if ( value == null )
+            return "";
+
+        if ( value.length() > length )
+        {
+            value = value.substring( 0, length ) + "...";
+        }
+
+        return value;
+    }
+
+
+    public static String serialize( Object o )
+    {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder( baos );
+        encoder.writeObject( o );
+        encoder.close();
+        String s = LdifUtils.utf8decode( baos.toByteArray() );
+        return s;
+    }
+
+
+    public static Object deserialize( String s )
+    {
+        ByteArrayInputStream bais = new ByteArrayInputStream( LdifUtils.utf8encode( s ) );
+        XMLDecoder decoder = new XMLDecoder( bais );
+        Object o = decoder.readObject();
+        decoder.close();
+        return o;
+    }
+
+
+    public static String getNonNullString( Object o )
+    {
+        return o == null ? "-" : o.toString();
+    }
+
+
+    public static String formatBytes( long bytes )
+    {
+        String size = "";
+        if ( bytes > 1024 * 1024 )
+            size += ( bytes / 1024 / 1024 ) + " MB (" + bytes + " Bytes)";
+        else if ( bytes > 1024 )
+            size += ( bytes / 1024 ) + " KB (" + bytes + " Bytes)";
+        else if ( bytes > 1 )
+            size += bytes + " Bytes";
+        else
+            size += bytes + " Byte";
+        return size;
+    }
+
+
+    public static boolean containsIgnoreCase( Collection c, String s )
+    {
+        if ( c == null || s == null )
+        {
+            return false;
+        }
+
+        Iterator it = c.iterator();
+        while ( it.hasNext() )
+        {
+            Object o = it.next();
+            if ( o instanceof String && ( ( String ) o ).equalsIgnoreCase( s ) )
+            {
+                return true;
+            }
+        }
+
+        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/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java Mon Dec 18 09:32:03 2006
@@ -20,18 +20,15 @@
 
 package org.apache.directory.ldapstudio.browser;
 
-
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
-
 /**
  * The activator class controls the plug-in life cycle
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Activator extends AbstractUIPlugin
-{
+public class Activator extends AbstractUIPlugin {
 
     // The plug-in ID
     public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.browser"; //$NON-NLS-1$
@@ -39,45 +36,39 @@
     // The shared instance
     private static Activator plugin;
 
-
     /**
-     * The constructor
-     */
-    public Activator()
-    {
-        plugin = this;
+         * The constructor
+         */
+    public Activator() {
+	plugin = this;
     }
 
-
     /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-     */
-    public void start( BundleContext context ) throws Exception
-    {
-        super.start( context );
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+         */
+    public void start(BundleContext context) throws Exception {
+	super.start(context);
     }
 
-
     /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-     */
-    public void stop( BundleContext context ) throws Exception
-    {
-        plugin = null;
-        super.stop( context );
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+         */
+    public void stop(BundleContext context) throws Exception {
+	plugin = null;
+	super.stop(context);
     }
 
-
     /**
-     * Returns the shared instance
-     *
-     * @return the shared instance
-     */
-    public static Activator getDefault()
-    {
-        return plugin;
+         * Returns the shared instance
+         * 
+         * @return the shared instance
+         */
+    public static Activator getDefault() {
+	return plugin;
     }
 
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java Mon Dec 18 09:32:03 2006
@@ -20,7 +20,6 @@
 
 package org.apache.directory.ldapstudio.browser.controller;
 
-
 import org.apache.directory.ldapstudio.browser.controller.actions.AttributeDeleteAction;
 import org.apache.directory.ldapstudio.browser.controller.actions.AttributeEditAction;
 import org.apache.directory.ldapstudio.browser.controller.actions.AttributeNewAction;
@@ -42,209 +41,191 @@
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;
 
-
 /**
  * This class is the Controller for the Attributes View.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AttributesViewController implements IMenuListener
-{
+public class AttributesViewController implements IMenuListener {
     private static final AttributesViewController instance;
 
     /** The controlled View */
     private AttributesView view;
 
     private static IAction attributeNewAction;
+
     private static IAction attributeEditAction;
+
     private static IAction attributeDeleteAction;
 
     // Static thread-safe singleton initializer
-    static
-    {
-        try
-        {
-            instance = new AttributesViewController();
-        }
-        catch ( Throwable e )
-        {
-            throw new RuntimeException( e.getMessage() );
-        }
-    }
-
-
-    /**
-     * Use this method to get the singleton instance of the controller
-     * @return
-     */
-    public static AttributesViewController getInstance()
-    {
-        return instance;
-    }
-
-
-    /**
-     * Sets the controlled View
-     * @param view the controlled View
-     */
-    public void setView( final AttributesView view )
-    {
-        this.view = view;
-
-        // Handling selection of the Browser View to update this view
-        view.getSite().getPage().addSelectionListener( BrowserView.ID, new ISelectionListener()
-        {
-            public void selectionChanged( IWorkbenchPart part, ISelection selection )
-            {
-                // Setting the new input
-                view.setInput( ( ( TreeSelection ) selection ).getFirstElement() );
-
-                // Resizing columns to fit
-                view.resizeColumsToFit();
-            }
-        } );
-
-        // Handling the double click modification
-        view.getViewer().getTree().addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetDefaultSelected( SelectionEvent e )
-            {
-                new RenameAttributeAction( view, "Rename attribute" ).run();
-            }
-        } );
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
-     */
-    public void menuAboutToShow( IMenuManager manager )
-    {
-        manager.add( attributeNewAction );
-        manager.add( attributeEditAction );
-        manager.add( attributeDeleteAction );
-    }
-
-
-    /**
-     * Creates all the actions
-     */
-    public void createActions()
-    {
-        // Creating Actions
-        attributeNewAction = new AttributeNewAction( view, "New attribute" );
-        attributeEditAction = new AttributeEditAction( view, "Edit attribute" );
-        attributeDeleteAction = new AttributeDeleteAction( view, "Delete attribute" );
-
-        // Disabling Actions by default
-        attributeNewAction.setEnabled( false );
-        attributeEditAction.setEnabled( false );
-        attributeDeleteAction.setEnabled( false );
-
-        registerUpdateActions();
-    }
-
-
-    /**
-     * Registers a Listener on the Browser View and enable/disable the Actions
-     * according to the selection
-     */
-    private void registerUpdateActions()
-    {
-        // Handling selection of the Browser View to enable/disable the Actions
-        view.getSite().getPage().addSelectionListener( BrowserView.ID, new ISelectionListener()
-        {
-            public void selectionChanged( IWorkbenchPart part, ISelection selection )
-            {
-                Object selectedObject = ( ( TreeSelection ) selection ).getFirstElement();
-                Tree tree = view.getViewer().getTree();
-
-                if ( selectedObject == null )
-                {
-                    attributeNewAction.setEnabled( false );
-                    tree.setEnabled( false );
-                }
-                else
-                {
-                    if ( selectedObject instanceof ConnectionWrapper )
-                    {
-                        attributeNewAction.setEnabled( false );
-                        tree.setEnabled( false );
-                    }
-                    else if ( selectedObject instanceof EntryWrapper )
-                    {
-                        attributeNewAction.setEnabled( true );
-                        tree.setEnabled( true );
-                    }
-                }
-            }
-        } );
-
-        // Handling selection of thencoree Attributes View to enable/disable the Actions
-        view.getSite().getPage().addSelectionListener( AttributesView.ID, new ISelectionListener()
-        {
-            public void selectionChanged( IWorkbenchPart part, ISelection selection )
-            {
-                if ( selection.isEmpty() )
-                {
-                    attributeEditAction.setEnabled( false );
-                    attributeDeleteAction.setEnabled( false );
-                }
-                else
-                {
-                    if ( ( ( StructuredSelection ) selection ).size() == 1 )
-                    {
-                        attributeEditAction.setEnabled( true );
-                        if ( attributeDeleteAction.getText().equals( "Delete attributes" ) )
-                        {
-                            attributeDeleteAction.setText( "Delete attribute" );
-                            attributeDeleteAction.setToolTipText( "Delete attribute" );
-                        }
-                    }
-                    else
-                    {
-                        attributeEditAction.setEnabled( false );
-                        if ( attributeDeleteAction.getText().equals( "Delete attribute" ) )
-                        {
-                            attributeDeleteAction.setText( "Delete attributes" );
-                            attributeDeleteAction.setToolTipText( "Delete attributes" );
-                        }
-                    }
-
-                    attributeDeleteAction.setEnabled( true );
-                }
-            }
-        } );
-    }
-
-
-    /**
-     * Gets the AttibuteNewAction
-     * @return the AttibuteNewAction
-     */
-    public IAction getAttributeNewAction()
-    {
-        return attributeNewAction;
-    }
-
-
-    /**
-     * Gets the AttributeEditAction
-     * @return the AttributeEditAction
-     */
-    public IAction getAttributeEditAction()
-    {
-        return attributeEditAction;
-    }
-
-
-    /**
-     * Gets the AttributeDeleteAction
-     * @return the AttributeDeleteAction
-     */
-    public IAction getAttributeDeleteAction()
-    {
-        return attributeDeleteAction;
+    static {
+	try {
+	    instance = new AttributesViewController();
+	} catch (Throwable e) {
+	    throw new RuntimeException(e.getMessage());
+	}
+    }
+
+    /**
+         * Use this method to get the singleton instance of the controller
+         * 
+         * @return
+         */
+    public static AttributesViewController getInstance() {
+	return instance;
+    }
+
+    /**
+         * Sets the controlled View
+         * 
+         * @param view
+         *                the controlled View
+         */
+    public void setView(final AttributesView view) {
+	this.view = view;
+
+	// Handling selection of the Browser View to update this view
+	view.getSite().getPage().addSelectionListener(BrowserView.ID,
+		new ISelectionListener() {
+		    public void selectionChanged(IWorkbenchPart part,
+			    ISelection selection) {
+			// Setting the new input
+			view.setInput(((TreeSelection) selection)
+				.getFirstElement());
+
+			// Resizing columns to fit
+			view.resizeColumsToFit();
+		    }
+		});
+
+	// Handling the double click modification
+	view.getViewer().getTree().addSelectionListener(new SelectionAdapter() {
+	    public void widgetDefaultSelected(SelectionEvent e) {
+		new RenameAttributeAction(view, "Rename attribute").run();
+	    }
+	});
+    }
+
+    /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
+         */
+    public void menuAboutToShow(IMenuManager manager) {
+	manager.add(attributeNewAction);
+	manager.add(attributeEditAction);
+	manager.add(attributeDeleteAction);
+    }
+
+    /**
+         * Creates all the actions
+         */
+    public void createActions() {
+	// Creating Actions
+	attributeNewAction = new AttributeNewAction(view, "New attribute");
+	attributeEditAction = new AttributeEditAction(view, "Edit attribute");
+	attributeDeleteAction = new AttributeDeleteAction(view,
+		"Delete attribute");
+
+	// Disabling Actions by default
+	attributeNewAction.setEnabled(false);
+	attributeEditAction.setEnabled(false);
+	attributeDeleteAction.setEnabled(false);
+
+	registerUpdateActions();
+    }
+
+    /**
+         * Registers a Listener on the Browser View and enable/disable the
+         * Actions according to the selection
+         */
+    private void registerUpdateActions() {
+	// Handling selection of the Browser View to enable/disable the Actions
+	view.getSite().getPage().addSelectionListener(BrowserView.ID,
+		new ISelectionListener() {
+		    public void selectionChanged(IWorkbenchPart part,
+			    ISelection selection) {
+			Object selectedObject = ((TreeSelection) selection)
+				.getFirstElement();
+			Tree tree = view.getViewer().getTree();
+
+			if (selectedObject == null) {
+			    attributeNewAction.setEnabled(false);
+			    tree.setEnabled(false);
+			} else {
+			    if (selectedObject instanceof ConnectionWrapper) {
+				attributeNewAction.setEnabled(false);
+				tree.setEnabled(false);
+			    } else if (selectedObject instanceof EntryWrapper) {
+				attributeNewAction.setEnabled(true);
+				tree.setEnabled(true);
+			    }
+			}
+		    }
+		});
+
+	// Handling selection of thencoree Attributes View to enable/disable the
+        // Actions
+	view.getSite().getPage().addSelectionListener(AttributesView.ID,
+		new ISelectionListener() {
+		    public void selectionChanged(IWorkbenchPart part,
+			    ISelection selection) {
+			if (selection.isEmpty()) {
+			    attributeEditAction.setEnabled(false);
+			    attributeDeleteAction.setEnabled(false);
+			} else {
+			    if (((StructuredSelection) selection).size() == 1) {
+				attributeEditAction.setEnabled(true);
+				if (attributeDeleteAction.getText().equals(
+					"Delete attributes")) {
+				    attributeDeleteAction
+					    .setText("Delete attribute");
+				    attributeDeleteAction
+					    .setToolTipText("Delete attribute");
+				}
+			    } else {
+				attributeEditAction.setEnabled(false);
+				if (attributeDeleteAction.getText().equals(
+					"Delete attribute")) {
+				    attributeDeleteAction
+					    .setText("Delete attributes");
+				    attributeDeleteAction
+					    .setToolTipText("Delete attributes");
+				}
+			    }
+
+			    attributeDeleteAction.setEnabled(true);
+			}
+		    }
+		});
+    }
+
+    /**
+         * Gets the AttibuteNewAction
+         * 
+         * @return the AttibuteNewAction
+         */
+    public IAction getAttributeNewAction() {
+	return attributeNewAction;
+    }
+
+    /**
+         * Gets the AttributeEditAction
+         * 
+         * @return the AttributeEditAction
+         */
+    public IAction getAttributeEditAction() {
+	return attributeEditAction;
+    }
+
+    /**
+         * Gets the AttributeDeleteAction
+         * 
+         * @return the AttributeDeleteAction
+         */
+    public IAction getAttributeDeleteAction() {
+	return attributeDeleteAction;
     }
 
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java Mon Dec 18 09:32:03 2006
@@ -20,7 +20,6 @@
 
 package org.apache.directory.ldapstudio.browser.controller;
 
-
 import org.apache.directory.ldapstudio.browser.controller.actions.ConnectionDeleteAction;
 import org.apache.directory.ldapstudio.browser.controller.actions.ConnectionEditAction;
 import org.apache.directory.ldapstudio.browser.controller.actions.ConnectionNewAction;
@@ -42,207 +41,190 @@
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;
 
-
 /**
  * This class is the Controller for the Browser View.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class BrowserViewController implements IMenuListener
-{
+public class BrowserViewController implements IMenuListener {
     private static final BrowserViewController instance;
 
     /** The controlled view */
     private BrowserView view;
 
     private static IAction connectionNewAction;
+
     private static IAction connectionEditAction;
+
     private static IAction connectionDeleteAction;
+
     private static IAction refreshAction;
+
     private static IAction entryNewAction;
+
     private static IAction entryDeleteAction;
 
     // Static thread-safe singleton initializer
-    static
-    {
-        try
-        {
-            instance = new BrowserViewController();
-        }
-        catch ( Throwable e )
-        {
-            throw new RuntimeException( e.getMessage() );
-        }
-    }
-
-
-    /**
-     * Use this method to get the singleton instance of the controller
-     * @return
-     */
-    public static BrowserViewController getInstance()
-    {
-        return instance;
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
-     */
-    public void menuAboutToShow( IMenuManager manager )
-    {
-        manager.add( connectionNewAction );
-        manager.add( connectionEditAction );
-        manager.add( connectionDeleteAction );
-        manager.add( new Separator() );
-        manager.add( refreshAction );
-        manager.add( new Separator() );
-        manager.add( entryNewAction );
-        manager.add( entryDeleteAction );
-    }
-
-
-    /**
-     * Sets the controlled View
-     * @param view the controlled View
-     */
-    public void setView( final BrowserView view )
-    {
-        this.view = view;
-
-        // Adding DoubleClick behavior
-        view.getViewer().addDoubleClickListener( new IDoubleClickListener()
-        {
-            public void doubleClick( DoubleClickEvent event )
-            {
-                // What we get from the treeViewer is a StructuredSelection
-                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-
-                // Here's the real object
-                Object objectSelection = selection.getFirstElement();
-
-                view.getViewer().setExpandedState( objectSelection,
-                    !view.getViewer().getExpandedState( objectSelection ) );
-            }
-        } );
-    }
-
-
-    /**
-     * Creates all the actions
-     */
-    public void createActions()
-    {
-        connectionNewAction = new ConnectionNewAction( view, "New connection" );
-        connectionDeleteAction = new ConnectionDeleteAction( view, "Delete connection" );
-        connectionEditAction = new ConnectionEditAction( view, "Edit connection" );
-        refreshAction = new RefreshAction( view, "Refresh" );
-        entryNewAction = new EntryNewAction( view, "New entry" );
-        entryDeleteAction = new EntryDeleteAction( view, "Delete entry" );
-
-        registerUpdateActions();
-    }
-
-
-    /**
-     * Registers a Listener on the Browser View and enable/disable the Actions
-     * according to the selection
-     */
-    private void registerUpdateActions()
-    {
-        // Handling selection of the Browser View to enable/disable the Actions
-        view.getSite().getPage().addSelectionListener( BrowserView.ID, new ISelectionListener()
-        {
-            public void selectionChanged( IWorkbenchPart part, ISelection selection )
-            {
-                Object selectedObject = ( ( TreeSelection ) selection ).getFirstElement();
-
-                if ( selectedObject == null )
-                {
-                    connectionEditAction.setEnabled( false );
-                    connectionDeleteAction.setEnabled( false );
-                    entryNewAction.setEnabled( false );
-                    entryDeleteAction.setEnabled( false );
-                }
-                else
-                {
-                    if ( selectedObject instanceof ConnectionWrapper )
-                    {
-                        connectionEditAction.setEnabled( true );
-                        connectionDeleteAction.setEnabled( true );
-                        entryNewAction.setEnabled( false );
-                        entryDeleteAction.setEnabled( false );
-                    }
-                    else if ( selectedObject instanceof EntryWrapper )
-                    {
-                        connectionEditAction.setEnabled( false );
-                        connectionDeleteAction.setEnabled( false );
-                        entryNewAction.setEnabled( true );
-                        entryDeleteAction.setEnabled( true );
-                    }
-                }
-            }
-        } );
-    }
-
-
-    /**
-     * Gets the ConnectionDeleteAction
-     * @return the ConnectionDeleteAction
-     */
-    public IAction getConnectionDeleteAction()
-    {
-        return connectionDeleteAction;
-    }
-
-
-    /**
-     * Gets the ConnectionNewAction
-     * @return the ConnectionNewAction
-     */
-    public IAction getConnectionNewAction()
-    {
-        return connectionNewAction;
-    }
-
-
-    /**
-     * Gets the ConnectionEditAction
-     * @return the ConnectionEditAction
-     */
-    public IAction getConnectionEditAction()
-    {
-        return connectionEditAction;
-    }
-
-
-    /**
-     * Gets the RefreshAction
-     * @return the RefreshAction
-     */
-    public IAction getRefreshAction()
-    {
-        return refreshAction;
-    }
-
-
-    /**
-     * Gets the EntryDeleteAction
-     * @return the EntryDeleteAction
-     */
-    public IAction getEntryDeleteAction()
-    {
-        return entryDeleteAction;
-    }
-
-
-    /**
-     * Gets the EntryNewAction
-     * @return the EntryNewAction
-     */
-    public IAction getEntryNewAction()
-    {
-        return entryNewAction;
+    static {
+	try {
+	    instance = new BrowserViewController();
+	} catch (Throwable e) {
+	    throw new RuntimeException(e.getMessage());
+	}
+    }
+
+    /**
+         * Use this method to get the singleton instance of the controller
+         * 
+         * @return
+         */
+    public static BrowserViewController getInstance() {
+	return instance;
+    }
+
+    /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
+         */
+    public void menuAboutToShow(IMenuManager manager) {
+	manager.add(connectionNewAction);
+	manager.add(connectionEditAction);
+	manager.add(connectionDeleteAction);
+	manager.add(new Separator());
+	manager.add(refreshAction);
+	manager.add(new Separator());
+	manager.add(entryNewAction);
+	manager.add(entryDeleteAction);
+    }
+
+    /**
+         * Sets the controlled View
+         * 
+         * @param view
+         *                the controlled View
+         */
+    public void setView(final BrowserView view) {
+	this.view = view;
+
+	// Adding DoubleClick behavior
+	view.getViewer().addDoubleClickListener(new IDoubleClickListener() {
+	    public void doubleClick(DoubleClickEvent event) {
+		// What we get from the treeViewer is a StructuredSelection
+		StructuredSelection selection = (StructuredSelection) event
+			.getSelection();
+
+		// Here's the real object
+		Object objectSelection = selection.getFirstElement();
+
+		view.getViewer().setExpandedState(objectSelection,
+			!view.getViewer().getExpandedState(objectSelection));
+	    }
+	});
+    }
+
+    /**
+         * Creates all the actions
+         */
+    public void createActions() {
+	connectionNewAction = new ConnectionNewAction(view, "New connection");
+	connectionDeleteAction = new ConnectionDeleteAction(view,
+		"Delete connection");
+	connectionEditAction = new ConnectionEditAction(view, "Edit connection");
+	refreshAction = new RefreshAction(view, "Refresh");
+	entryNewAction = new EntryNewAction(view, "New entry");
+	entryDeleteAction = new EntryDeleteAction(view, "Delete entry");
+
+	registerUpdateActions();
+    }
+
+    /**
+         * Registers a Listener on the Browser View and enable/disable the
+         * Actions according to the selection
+         */
+    private void registerUpdateActions() {
+	// Handling selection of the Browser View to enable/disable the Actions
+	view.getSite().getPage().addSelectionListener(BrowserView.ID,
+		new ISelectionListener() {
+		    public void selectionChanged(IWorkbenchPart part,
+			    ISelection selection) {
+			Object selectedObject = ((TreeSelection) selection)
+				.getFirstElement();
+
+			if (selectedObject == null) {
+			    connectionEditAction.setEnabled(false);
+			    connectionDeleteAction.setEnabled(false);
+			    entryNewAction.setEnabled(false);
+			    entryDeleteAction.setEnabled(false);
+			} else {
+			    if (selectedObject instanceof ConnectionWrapper) {
+				connectionEditAction.setEnabled(true);
+				connectionDeleteAction.setEnabled(true);
+				entryNewAction.setEnabled(false);
+				entryDeleteAction.setEnabled(false);
+			    } else if (selectedObject instanceof EntryWrapper) {
+				connectionEditAction.setEnabled(false);
+				connectionDeleteAction.setEnabled(false);
+				entryNewAction.setEnabled(true);
+				entryDeleteAction.setEnabled(true);
+			    }
+			}
+		    }
+		});
+    }
+
+    /**
+         * Gets the ConnectionDeleteAction
+         * 
+         * @return the ConnectionDeleteAction
+         */
+    public IAction getConnectionDeleteAction() {
+	return connectionDeleteAction;
+    }
+
+    /**
+         * Gets the ConnectionNewAction
+         * 
+         * @return the ConnectionNewAction
+         */
+    public IAction getConnectionNewAction() {
+	return connectionNewAction;
+    }
+
+    /**
+         * Gets the ConnectionEditAction
+         * 
+         * @return the ConnectionEditAction
+         */
+    public IAction getConnectionEditAction() {
+	return connectionEditAction;
+    }
+
+    /**
+         * Gets the RefreshAction
+         * 
+         * @return the RefreshAction
+         */
+    public IAction getRefreshAction() {
+	return refreshAction;
+    }
+
+    /**
+         * Gets the EntryDeleteAction
+         * 
+         * @return the EntryDeleteAction
+         */
+    public IAction getEntryDeleteAction() {
+	return entryDeleteAction;
+    }
+
+    /**
+         * Gets the EntryNewAction
+         * 
+         * @return the EntryNewAction
+         */
+    public IAction getEntryNewAction() {
+	return entryNewAction;
     }
 
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/PreferenceInitializer.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/PreferenceInitializer.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/PreferenceInitializer.java Mon Dec 18 09:32:03 2006
@@ -20,27 +20,24 @@
 
 package org.apache.directory.ldapstudio.browser.controller;
 
-
 import org.apache.directory.ldapstudio.browser.Activator;
 import org.apache.directory.ldapstudio.browser.view.views.ConnectionWizard;
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
 import org.eclipse.jface.preference.IPreferenceStore;
 
-
 /**
  * This class initializes the preferences on the first start up of the plugin
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PreferenceInitializer extends AbstractPreferenceInitializer
-{
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
 
     @Override
-    public void initializeDefaultPreferences()
-    {
-        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+    public void initializeDefaultPreferences() {
+	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
 
-        store.setDefault( ConnectionWizard.CONNECTIONS_PREFS, "<connections></connections>" );
+	store.setDefault(ConnectionWizard.CONNECTIONS_PREFS,
+		"<connections></connections>");
     }
 
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java Mon Dec 18 09:32:03 2006
@@ -20,7 +20,6 @@
 
 package org.apache.directory.ldapstudio.browser.controller.actions;
 
-
 import java.util.Iterator;
 import java.util.List;
 
@@ -44,108 +43,106 @@
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
-
 /**
  * This class implements the Attribute Delete Action.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AttributeDeleteAction extends Action
-{
+public class AttributeDeleteAction extends Action {
     private AttributesView view;
 
-
     /**
-     * Creates a new instance of AttributeDeleteAction.
-     * @param view the associated view
-     * @param text the associated text
-     */
-    public AttributeDeleteAction( AttributesView view, String text )
-    {
-        super( text );
-        setImageDescriptor( AbstractUIPlugin
-            .imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.ATTRIBUTE_DELETE ) );
-        setToolTipText( "Delete attribute" );
-        this.view = view;
+         * Creates a new instance of AttributeDeleteAction.
+         * 
+         * @param view
+         *                the associated view
+         * @param text
+         *                the associated text
+         */
+    public AttributeDeleteAction(AttributesView view, String text) {
+	super(text);
+	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+		Activator.PLUGIN_ID, ImageKeys.ATTRIBUTE_DELETE));
+	setToolTipText("Delete attribute");
+	this.view = view;
     }
 
-
     @SuppressWarnings("unchecked")
-    public void run()
-    {
-        try
-        {
-            // Getting the selected Entry in the Browser View
-            BrowserView browserView = ( BrowserView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-                .getActivePage().findView( BrowserView.ID );
-            EntryWrapper entryWrapper = ( EntryWrapper ) ( ( TreeSelection ) browserView.getViewer().getSelection() )
-                .getFirstElement();
-            SearchResultEntry entry = entryWrapper.getEntry();
-
-            // Initialization of the DSML Engine and the DSML Response Parser
-            Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
-            Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
-
-            // Getting the selected items
-            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
-            Iterator items = selection.iterator();
-
-            // Iterating on each attribute and generating a request to delete it.
-            String request = null;
-            while ( items.hasNext() )
-            {
-                List<String> item = ( List<String> ) items.next();
-                String attributeName = item.get( 0 );
-                String attributeValue = item.get( 1 );
-
-                request = "<batchRequest>" + 
-                "     <modifyRequest dn=\"" + entry.getObjectName().getNormName().toString() + "\">"+
-                "        <modification name=\"" + attributeName + "\" operation=\"delete\">" + 
-                "            <value>" + attributeValue + "</value>" + 
-                "        </modification>" +
-                "    </modifyRequest>" + 
-                "</batchRequest>";
-
-                parser.setInput( engine.processDSML( request ) );
-                parser.parse();
-
-                LdapResponse ldapResponse = parser.getBatchResponse().getCurrentResponse();
-
-                if ( ldapResponse instanceof ModifyResponse )
-                {
-                    ModifyResponse modifyResponse = ( ModifyResponse ) ldapResponse;
-
-                    if ( modifyResponse.getLdapResult().getResultCode() == 0 )
-                    {
-                        // Removing the selected attribute value
-                        Attributes attributes = entry.getPartialAttributeList();
-                        attributes.get( attributeName ).remove( attributeValue );
-                    }
-                    else
-                    {
-                        // Displaying an error
-                        MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
-                            "Error !", "An error has ocurred.\n" + modifyResponse.getLdapResult().getErrorMessage() );
-                    }
-                }
-                else if ( ldapResponse instanceof ErrorResponse )
-                {
-                    ErrorResponse errorResponse = ( ErrorResponse ) ldapResponse;
-
-                    // Displaying an error
-                    MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
-                        "Error !", "An error has ocurred.\n" + errorResponse.getMessage() );
-                }
-            }
-            // refreshing the UI
-            view.setInput( entryWrapper );
-            view.resizeColumsToFit();
-        }
-        catch ( Exception e )
-        {
-            // Displaying an error
-            MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error !",
-                "An error has ocurred.\n" + e.getMessage() );
-        }
+    public void run() {
+	try {
+	    // Getting the selected Entry in the Browser View
+	    BrowserView browserView = (BrowserView) PlatformUI.getWorkbench()
+		    .getActiveWorkbenchWindow().getActivePage().findView(
+			    BrowserView.ID);
+	    EntryWrapper entryWrapper = (EntryWrapper) ((TreeSelection) browserView
+		    .getViewer().getSelection()).getFirstElement();
+	    SearchResultEntry entry = entryWrapper.getEntry();
+
+	    // Initialization of the DSML Engine and the DSML Response
+                // Parser
+	    Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
+	    Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
+
+	    // Getting the selected items
+	    StructuredSelection selection = (StructuredSelection) view
+		    .getViewer().getSelection();
+	    Iterator items = selection.iterator();
+
+	    // Iterating on each attribute and generating a request to
+                // delete it.
+	    String request = null;
+	    while (items.hasNext()) {
+		List<String> item = (List<String>) items.next();
+		String attributeName = item.get(0);
+		String attributeValue = item.get(1);
+
+		request = "<batchRequest>" + "     <modifyRequest dn=\""
+			+ entry.getObjectName().getNormName().toString()
+			+ "\">" + "        <modification name=\""
+			+ attributeName + "\" operation=\"delete\">"
+			+ "            <value>" + attributeValue + "</value>"
+			+ "        </modification>" + "    </modifyRequest>"
+			+ "</batchRequest>";
+
+		parser.setInput(engine.processDSML(request));
+		parser.parse();
+
+		LdapResponse ldapResponse = parser.getBatchResponse()
+			.getCurrentResponse();
+
+		if (ldapResponse instanceof ModifyResponse) {
+		    ModifyResponse modifyResponse = (ModifyResponse) ldapResponse;
+
+		    if (modifyResponse.getLdapResult().getResultCode() == 0) {
+			// Removing the selected attribute value
+			Attributes attributes = entry.getPartialAttributeList();
+			attributes.get(attributeName).remove(attributeValue);
+		    } else {
+			// Displaying an error
+			MessageDialog.openError(PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getShell(),
+				"Error !", "An error has ocurred.\n"
+					+ modifyResponse.getLdapResult()
+						.getErrorMessage());
+		    }
+		} else if (ldapResponse instanceof ErrorResponse) {
+		    ErrorResponse errorResponse = (ErrorResponse) ldapResponse;
+
+		    // Displaying an error
+		    MessageDialog.openError(PlatformUI.getWorkbench()
+			    .getActiveWorkbenchWindow().getShell(), "Error !",
+			    "An error has ocurred.\n"
+				    + errorResponse.getMessage());
+		}
+	    }
+	    // refreshing the UI
+	    view.setInput(entryWrapper);
+	    view.resizeColumsToFit();
+	} catch (Exception e) {
+	    // Displaying an error
+	    MessageDialog.openError(PlatformUI.getWorkbench()
+		    .getActiveWorkbenchWindow().getShell(), "Error !",
+		    "An error has ocurred.\n" + e.getMessage());
+	}
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeEditAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeEditAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeEditAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeEditAction.java Mon Dec 18 09:32:03 2006
@@ -20,43 +20,42 @@
 
 package org.apache.directory.ldapstudio.browser.controller.actions;
 
-
 import org.apache.directory.ldapstudio.browser.Activator;
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
 import org.apache.directory.ldapstudio.browser.view.views.AttributesView;
 import org.eclipse.jface.action.Action;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
-
 /**
  * This class implements the Attribute Edit Action.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AttributeEditAction extends Action
-{
+public class AttributeEditAction extends Action {
     private AttributesView view;
 
-
     /**
-     * Creates a new instance of AttributeEditAction.
-     * @param view the associated view
-     * @param text the string used as the text for the action
-     */
-    public AttributeEditAction( AttributesView view, String text )
-    {
-        super( text );
-        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.ATTRIBUTE_EDIT ) );
-        setToolTipText( "Edit attribute" );
-        this.view = view;
+         * Creates a new instance of AttributeEditAction.
+         * 
+         * @param view
+         *                the associated view
+         * @param text
+         *                the string used as the text for the action
+         */
+    public AttributeEditAction(AttributesView view, String text) {
+	super(text);
+	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+		Activator.PLUGIN_ID, ImageKeys.ATTRIBUTE_EDIT));
+	setToolTipText("Edit attribute");
+	this.view = view;
     }
 
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.Action#run()
-     */
-    public void run()
-    {
-        new RenameAttributeAction( view, "Rename attribute" ).run();
+    /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.jface.action.Action#run()
+         */
+    public void run() {
+	new RenameAttributeAction(view, "Rename attribute").run();
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeNewAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeNewAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeNewAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeNewAction.java Mon Dec 18 09:32:03 2006
@@ -20,7 +20,6 @@
 
 package org.apache.directory.ldapstudio.browser.controller.actions;
 
-
 import org.apache.directory.ldapstudio.browser.Activator;
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
 import org.apache.directory.ldapstudio.browser.view.views.AttributeAddWizard;
@@ -30,32 +29,28 @@
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
-
 /**
  * This class implements the Attribute New Action.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AttributeNewAction extends Action
-{
+public class AttributeNewAction extends Action {
     private AttributesView view;
 
-
-    public AttributeNewAction( AttributesView view, String text )
-    {
-        super( text );
-        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.ATTRIBUTE_NEW ) );
-        setToolTipText( "New attribute" );
-        this.view = view;
+    public AttributeNewAction(AttributesView view, String text) {
+	super(text);
+	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+		Activator.PLUGIN_ID, ImageKeys.ATTRIBUTE_NEW));
+	setToolTipText("New attribute");
+	this.view = view;
     }
 
-
-    public void run()
-    {
-        // Creating the Wizard and opening it
-        AttributeAddWizard wizard = new AttributeAddWizard();
-        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
-        dialog.create();
-        dialog.open();
+    public void run() {
+	// Creating the Wizard and opening it
+	AttributeAddWizard wizard = new AttributeAddWizard();
+	WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench()
+		.getActiveWorkbenchWindow().getShell(), wizard);
+	dialog.create();
+	dialog.open();
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionDeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionDeleteAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionDeleteAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionDeleteAction.java Mon Dec 18 09:32:03 2006
@@ -20,7 +20,6 @@
 
 package org.apache.directory.ldapstudio.browser.controller.actions;
 
-
 import org.apache.directory.ldapstudio.browser.Activator;
 import org.apache.directory.ldapstudio.browser.model.Connection;
 import org.apache.directory.ldapstudio.browser.model.Connections;
@@ -33,44 +32,39 @@
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
-
 /**
  * This class implements the Connection Delete Action.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ConnectionDeleteAction extends Action
-{
+public class ConnectionDeleteAction extends Action {
     private BrowserView view;
 
-
-    public ConnectionDeleteAction( BrowserView view, String text )
-    {
-        super( text );
-        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-            ImageKeys.CONNECTION_DELETE ) );
-        setToolTipText( "Delete connection" );
-        this.view = view;
+    public ConnectionDeleteAction(BrowserView view, String text) {
+	super(text);
+	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+		Activator.PLUGIN_ID, ImageKeys.CONNECTION_DELETE));
+	setToolTipText("Delete connection");
+	this.view = view;
     }
 
+    public void run() {
+	// Getting the selected connection
+	ConnectionWrapper connectionWrapper = (ConnectionWrapper) ((TreeSelection) view
+		.getViewer().getSelection()).getFirstElement();
+	Connection selectedConnection = connectionWrapper.getConnection();
+
+	boolean answer = MessageDialog.openConfirm(PlatformUI.getWorkbench()
+		.getActiveWorkbenchWindow().getShell(), "Confirm",
+		"Are you sure you want to delete the connection \""
+			+ selectedConnection.getName() + "\"?");
+
+	if (!answer) {
+	    // If the user clicks on the "Cancel" button, we return...
+	    return;
+	}
 
-    public void run()
-    {
-        // Getting the selected connection
-        ConnectionWrapper connectionWrapper = ( ConnectionWrapper ) ( ( TreeSelection ) view.getViewer().getSelection() )
-            .getFirstElement();
-        Connection selectedConnection = connectionWrapper.getConnection();
-
-        boolean answer = MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
-            "Confirm", "Are you sure you want to delete the connection \"" + selectedConnection.getName() + "\"?" );
-
-        if ( !answer )
-        {
-            // If the user clicks on the "Cancel" button, we return...
-            return;
-        }
-
-        // Removing the connection
-        Connections.getInstance().removeConnection( selectedConnection );
+	// Removing the connection
+	Connections.getInstance().removeConnection(selectedConnection);
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java Mon Dec 18 09:32:03 2006
@@ -20,7 +20,6 @@
 
 package org.apache.directory.ldapstudio.browser.controller.actions;
 
-
 import org.apache.directory.ldapstudio.browser.Activator;
 import org.apache.directory.ldapstudio.browser.model.Connection;
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
@@ -36,55 +35,52 @@
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
-
 /**
  * This class implements the Connection Edit Action
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ConnectionEditAction extends Action
-{
+public class ConnectionEditAction extends Action {
     private BrowserView view;
 
-
-    public ConnectionEditAction( BrowserView view, String text )
-    {
-        super( text );
-        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, ImageKeys.CONNECTION_EDIT ) );
-        setToolTipText( "Edit connection" );
-        this.view = view;
+    public ConnectionEditAction(BrowserView view, String text) {
+	super(text);
+	setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+		Activator.PLUGIN_ID, ImageKeys.CONNECTION_EDIT));
+	setToolTipText("Edit connection");
+	this.view = view;
     }
 
+    public void run() {
+	// Getting the selected connection
+	ConnectionWrapper connectionWrapper = (ConnectionWrapper) ((TreeSelection) view
+		.getViewer().getSelection()).getFirstElement();
+	Connection selectedConnection = connectionWrapper.getConnection();
+
+	// Creating the Connection Wizard
+	ConnectionWizard wizard = new ConnectionWizard();
+	wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
+	wizard.setType(ConnectionWizardType.EDIT);
+
+	wizard.setConnection(selectedConnection);
+
+	// Instantiates the wizard container with the wizard and opens it
+	WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench()
+		.getActiveWorkbenchWindow().getShell(), wizard);
+	dialog.create();
+	int result = dialog.open();
+
+	// O is returned when "Finish" is clicked, 1 is returned when "Cancel"
+        // is clicked
+	if (result != 0) {
+	    return;
+	}
+
+	// Updating the state of the Connection since it has changed (this
+        // causes the icon to change)
+	connectionWrapper.setState(ConnectionWrapperState.NONE);
+	connectionWrapper.connectionChanged();
 
-    public void run()
-    {
-        // Getting the selected connection
-        ConnectionWrapper connectionWrapper = ( ConnectionWrapper ) ( ( TreeSelection ) view.getViewer().getSelection() )
-            .getFirstElement();
-        Connection selectedConnection = connectionWrapper.getConnection();
-
-        // Creating the Connection Wizard
-        ConnectionWizard wizard = new ConnectionWizard();
-        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
-        wizard.setType( ConnectionWizardType.EDIT );
-
-        wizard.setConnection( selectedConnection );
-
-        // Instantiates the wizard container with the wizard and opens it
-        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
-        dialog.create();
-        int result = dialog.open();
-
-        // O is returned when "Finish" is clicked, 1 is returned when "Cancel" is clicked
-        if ( result != 0 )
-        {
-            return;
-        }
-
-        // Updating the state of the Connection since it has changed (this causes the icon to change)
-        connectionWrapper.setState( ConnectionWrapperState.NONE );
-        connectionWrapper.connectionChanged();
-
-        selectedConnection.notifyListeners();
+	selectedConnection.notifyListeners();
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionNewAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionNewAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionNewAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionNewAction.java Mon Dec 18 09:32:03 2006
@@ -54,7 +54,7 @@
 	Connection newConnection = new Connection();
 
 	// Creating a new Connection Name with verification that a connection
-        // with
+	// with
 	// the same name doesn't exist yet.
 	String newConnectionString = "New Connection";
 	String testString = newConnectionString;
@@ -81,7 +81,7 @@
 	int result = dialog.open();
 
 	// O is returned when "Finish" is clicked, 1 is returned when "Cancel"
-        // is clicked
+	// is clicked
 	if (result != 0) {
 	    return;
 	}

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/EntryDeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/EntryDeleteAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/EntryDeleteAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/EntryDeleteAction.java Mon Dec 18 09:32:03 2006
@@ -76,7 +76,7 @@
 		EntryWrapper entryWrapper = (EntryWrapper) items.next();
 
 		// Initialization of the DSML Engine and the DSML Response
-                // Parser
+		// Parser
 		Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
 		Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
@@ -92,7 +92,7 @@
 			+ "</batchRequest>";
 
 		// Executing the request and sending the result to the Response
-                // Parser
+		// Parser
 		parser.setInput(engine.processDSML(searchRequest));
 		parser.parse();
 
@@ -111,7 +111,7 @@
 		} else if (ldapResponse instanceof SearchResponse) {
 
 		    // Getting the Search Result Entry List containing our
-                        // objects for the response
+		    // objects for the response
 		    SearchResponse searchResponse = ((SearchResponse) ldapResponse);
 		    List<SearchResultEntry> sreList = searchResponse
 			    .getSearchResultEntryList();
@@ -124,7 +124,7 @@
 		    deleteRequest += "</batchRequest>";
 
 		    // Executing the request and sending the result to the
-                        // Response Parser
+		    // Response Parser
 		    parser.setInput(engine.processDSML(deleteRequest));
 		    parser.parse();
 

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java Mon Dec 18 09:32:03 2006
@@ -143,7 +143,7 @@
          */
     private void showEditor() {
 	// tableEditor.setEditor( textEditor,
-        // view.getViewer().getTable().getSelection()[0], COLUMN_TO_EDIT );
+	// view.getViewer().getTable().getSelection()[0], COLUMN_TO_EDIT );
 	textEditor.setText(getAttributeValue());
 	textEditor.selectAll();
 	textEditor.setFocus();
@@ -211,7 +211,7 @@
 	    SearchResultEntry entry = entryWrapper.getEntry();
 
 	    // Initialization of the DSML Engine and the DSML Response
-                // Parser
+	    // Parser
 	    Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
 	    Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
@@ -242,7 +242,7 @@
 			    .add(textEditor.getText());
 
 		    // TableItem item =
-                        // view.getSelectedAttributeTableItem();
+		    // view.getSelectedAttributeTableItem();
 		    // item.setText( 1, textEditor.getText() );
 		    // view.getViewer().refresh( item );
 		} else {

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/AttributeValueWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/AttributeValueWrapper.java?view=diff&rev=488355&r1=488354&r2=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/AttributeValueWrapper.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/AttributeValueWrapper.java Mon Dec 18 09:32:03 2006
@@ -1,49 +1,46 @@
-
 package org.apache.directory.ldapstudio.browser.view.views.wrappers;
 
 /**
- * AttributeValueWrapper used to display an attribute value in the Attributes View
- *
+ * AttributeValueWrapper used to display an attribute value in the Attributes
+ * View
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class AttributeValueWrapper
-{
+public class AttributeValueWrapper {
     private Object value;
+
     private AttributeWrapper parent;
-    
-    public AttributeValueWrapper( Object value, AttributeWrapper parent)
-    {
-       this.value = value;
-       this.parent = parent;
+
+    public AttributeValueWrapper(Object value, AttributeWrapper parent) {
+	this.value = value;
+	this.parent = parent;
     }
-    
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
-     */
-    public String getColumnText( Object element, int columnIndex )
-    {
-        if ( columnIndex == 0 )
-        {
-            return ""; // The first column needs an entry String
-        }
-        else if ( columnIndex == 1 )
-        {
-            if ( value instanceof String )
-            {
-                return ( String ) value;
-            }
-        }
-        
-        return "";
+
+    /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
+         *      int)
+         */
+    public String getColumnText(Object element, int columnIndex) {
+	if (columnIndex == 0) {
+	    return ""; // The first column needs an entry String
+	} else if (columnIndex == 1) {
+	    if (value instanceof String) {
+		return (String) value;
+	    }
+	}
+
+	return "";
     }
 
     /**
-     * Gets the parent element
-     * @return the parent element
-     */
-    public AttributeWrapper getParent()
-    {
-        return parent;
-    }    
+         * Gets the parent element
+         * 
+         * @return the parent element
+         */
+    public AttributeWrapper getParent() {
+	return parent;
+    }
 }