directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r574008 - /directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/
Date Sun, 09 Sep 2007 12:34:18 GMT
Author: seelmann
Date: Sun Sep  9 05:34:17 2007
New Revision: 574008

URL: http://svn.apache.org/viewvc?rev=574008&view=rev
Log:
Code cleaning and Javadoc.

Modified:
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java Sun Sep  9 05:34:17 2007
@@ -41,58 +41,93 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * Dialog to edit a filter in a text source viewer with syntax highlighting
+ * and content assistent. It also provides a button to format the filter.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class FilterDialog extends Dialog
 {
 
-    public static final String DIALOG_TITLE = "Filter Editor";
+    /** The default dialog title. */
+    private static final String DIALOG_TITLE = "Filter Editor";
 
+    /** The button ID for the format button. */
+    private static final int FORMAT_BUTTON_ID = 987654321;
+
+    /** The dialog title. */
     private String title;
 
-    private IBrowserConnection connection;
+    /** The browser connection. */
+    private IBrowserConnection browserConnection;
 
+    /** The source viewer. */
     private SourceViewer sourceViewer;
 
+    /** The filter source viewer configuration. */
     private FilterSourceViewerConfiguration configuration;
 
+    /** The filter parser. */
     private LdapFilterParser parser;
 
+    /** The filter. */
     private String filter;
 
 
-    public FilterDialog( Shell parentShell, String title, String filter, IBrowserConnection connection )
+    /**
+     * Creates a new instance of FilterDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param title the title
+     * @param filter the initial filter
+     * @param brwoserConnection the browser connection
+     */
+    public FilterDialog( Shell parentShell, String title, String filter, IBrowserConnection brwoserConnection )
     {
         super( parentShell );
         this.title = title;
         this.filter = filter;
-        this.connection = connection;
+        this.browserConnection = brwoserConnection;
         this.parser = new LdapFilterParser();
         setShellStyle( SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE );
     }
 
 
+    /**
+     * Gets the filter.
+     * 
+     * @return the filter
+     */
     public String getFilter()
     {
-        return this.filter;
+        return filter;
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
-        newShell.setText( this.title != null ? this.title : DIALOG_TITLE );
+        newShell.setText( title != null ? title : DIALOG_TITLE );
         newShell.setImage( BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_FILTER_EDITOR ) );
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
     protected void buttonPressed( int buttonId )
     {
         if ( buttonId == IDialogConstants.OK_ID )
         {
-            // this.filter = sourceViewer.getDocument().get();
-            this.parser.parse( sourceViewer.getDocument().get() );
-            this.filter = this.parser.getModel().toString();
+            parser.parse( sourceViewer.getDocument().get() );
+            filter = parser.getModel().toString();
         }
-        else if ( buttonId == 987654321 )
+        else if ( buttonId == FORMAT_BUTTON_ID )
         {
             IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
             configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
@@ -103,14 +138,20 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createButtonBar( Composite parent )
     {
         Composite composite = ( Composite ) super.createButtonBar( parent );
-        super.createButton( composite, 987654321, "Format", false );
+        super.createButton( composite, FORMAT_BUTTON_ID, "Format", false );
         return composite;
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
         // Composite composite = parent;
@@ -123,27 +164,21 @@
         // create and configure source viewer
         sourceViewer = new SourceViewer( composite, new VerticalRuler( 0 ), SWT.H_SCROLL | SWT.V_SCROLL );
         sourceViewer.getControl().setLayoutData( new GridData( GridData.FILL_BOTH ) );
-        configuration = new FilterSourceViewerConfiguration( this.parser, this.connection );
+        configuration = new FilterSourceViewerConfiguration( parser, browserConnection );
         sourceViewer.configure( configuration );
 
         // set document
-        IDocument document = new Document( this.filter );
+        IDocument document = new Document( filter );
         sourceViewer.setDocument( document );
 
         // preformat
         IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
         configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
 
+        // set focus to the source viewer
         sourceViewer.getTextWidget().setFocus();
 
         return composite;
-    }
-
-
-    protected boolean canHandleShellCloseEvent()
-    {
-        // proposal popup is opened, don't close dialog!
-        return super.canHandleShellCloseEvent();
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java Sun Sep  9 05:34:17 2007
@@ -44,26 +44,41 @@
 import org.eclipse.swt.widgets.Text;
 
 
+/**
+ * Dialog to display binary data in hex format. It could be 
+ * used to load and save binary data from and to disk.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class HexDialog extends Dialog
 {
 
-    public static final String DIALOG_TITLE = "Hex Editor";
+    /** The default title. */
+    private static final String DIALOG_TITLE = "Hex Editor";
 
-    public static final double MAX_WIDTH = 550.0;
+    /** The button ID for the load button. */
+    private static final int LOAD_BUTTON_ID = 9998;
 
-    public static final double MAX_HEIGHT = 550.0;
-
-    public static final int LOAD_BUTTON_ID = 9998;
-
-    public static final int SAVE_BUTTON_ID = 9999;
+    /** The button ID for the save button. */
+    private static final int SAVE_BUTTON_ID = 9999;
 
+    /** The current data. */
     private byte[] currentData;
 
+    /** The return data. */
     private byte[] returnData;
 
+    /** The text field with the binary data. */
     private Text hexText;
 
 
+    /**
+     * Creates a new instance of HexDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param initialData the initial data
+     */
     public HexDialog( Shell parentShell, byte[] initialData )
     {
         super( parentShell );
@@ -72,17 +87,14 @@
     }
 
 
-    public boolean close()
-    {
-        return super.close();
-    }
-
-
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
     protected void buttonPressed( int buttonId )
     {
         if ( buttonId == IDialogConstants.OK_ID )
         {
-            this.returnData = this.currentData;
+            returnData = currentData;
         }
         else if ( buttonId == SAVE_BUTTON_ID )
         {
@@ -103,12 +115,14 @@
                 catch ( FileNotFoundException e )
                 {
                     BrowserCommonActivator.getDefault().getExceptionHandler().handleException(
-                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't write to file", e ) );
+                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR,
+                            "Can't write to file", e ) );
                 }
                 catch ( IOException e )
                 {
                     BrowserCommonActivator.getDefault().getExceptionHandler().handleException(
-                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't write to file", e ) );
+                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR,
+                            "Can't write to file", e ) );
                 }
             }
         }
@@ -130,32 +144,37 @@
                     {
                         out.write( buf, 0, len );
                     }
-                    this.currentData = out.toByteArray();
-                    hexText.setText( toFormattedHex( this.currentData ) );
+                    currentData = out.toByteArray();
+                    hexText.setText( toFormattedHex( currentData ) );
                     out.close();
                     in.close();
                 }
                 catch ( FileNotFoundException e )
                 {
                     BrowserCommonActivator.getDefault().getExceptionHandler().handleException(
-                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't read file", e ) );
+                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't read file",
+                            e ) );
                 }
                 catch ( IOException e )
                 {
                     BrowserCommonActivator.getDefault().getExceptionHandler().handleException(
-                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't read file", e ) );
+                        new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't read file",
+                            e ) );
                 }
             }
         }
         else
         {
-            this.returnData = null;
+            returnData = null;
         }
 
         super.buttonPressed( buttonId );
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -164,6 +183,9 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, LOAD_BUTTON_ID, "Load Data...", false );
@@ -173,6 +195,9 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
         // create composite
@@ -181,7 +206,7 @@
         hexText = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY );
         hexText.setFont( JFaceResources.getFont( JFaceResources.TEXT_FONT ) );
 
-        hexText.setText( toFormattedHex( this.currentData ) );
+        hexText.setText( toFormattedHex( currentData ) );
         // GridData gd = new GridData(GridData.GRAB_HORIZONTAL |
         // GridData.HORIZONTAL_ALIGN_FILL);
         GridData gd = new GridData( GridData.FILL_BOTH );
@@ -194,47 +219,86 @@
     }
 
 
+    /**
+     * Formats the binary data in two colums. One containing the hex
+     * presentation and one containting the ASCII presentation of each byte.
+     * 
+     * 91 a1 08 23 42 b1 c1 15  52 d1 f0 24 33 62 72 82     ...#B... R..$3br.
+     * 09 0a 16 17 18 19 1a 25  26 27 28 29 2a 34 35 36     .......% &'()*456 
+     * 
+     * @param data the data
+     * 
+     * @return the formatted string
+     */
     private String toFormattedHex( byte[] data )
     {
         StringBuffer sb = new StringBuffer();
         for ( int i = 0; i < data.length; i++ )
         {
+            // get byte
             int b = ( int ) data[i];
             if ( b < 0 )
+            {
                 b = 256 + b;
+            }
+
+            // format to hex, optionally prepend a 0
             String s = Integer.toHexString( b );
             if ( s.length() == 1 )
+            {
                 s = "0" + s;
+            }
+
+            // space between hex numbers
             sb.append( s ).append( " " );
+
+            // extra space after 8 hex numbers
             if ( ( i + 1 ) % 8 == 0 )
+            {
                 sb.append( " " );
+            }
 
+            // if end of data is reached then fill with spaces
             if ( i == data.length - 1 )
             {
                 while ( ( i + 1 ) % 16 != 0 )
                 {
                     sb.append( "   " );
                     if ( ( i + 1 ) % 8 == 0 )
+                    {
                         sb.append( " " );
+                    }
                     i++;
                 }
                 sb.append( " " );
             }
 
+            // print ASCII characters after 16 hex numbers 
             if ( ( i + 1 ) % 16 == 0 )
             {
                 sb.append( "   " );
                 for ( int x = i - 16 + 1; x <= i && x < data.length; x++ )
                 {
+                    // print ASCII charachter if printable
+                    // otherwise print a dot
                     if ( data[x] > 32 && data[x] < 127 )
+                    {
                         sb.append( ( char ) data[x] );
+                    }
                     else
+                    {
                         sb.append( '.' );
+                    }
+
+                    // space after 8 characters 
                     if ( ( x + 1 ) % 8 == 0 )
+                    {
                         sb.append( " " );
+                    }
                 }
             }
 
+            // start new line after 16 hex numbers
             if ( ( i + 1 ) % 16 == 0 )
             {
                 sb.append( "\r\n" );
@@ -244,8 +308,14 @@
     }
 
 
+    /**
+     * Gets the data.
+     * 
+     * @return the data
+     */
     public byte[] getData()
     {
-        return this.returnData;
+        return returnData;
     }
+
 }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java Sun Sep  9 05:34:17 2007
@@ -27,7 +27,6 @@
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
 import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.SWT;
@@ -38,24 +37,43 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * Dialog to select and enter the new parent of some entries. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class MoveEntriesDialog extends Dialog implements WidgetModifyListener
 {
 
-    public static final String DIALOG_TITLE = "Move Entries";
+    /** The dialog title. */
+    private static final String DIALOG_TITLE = "Move Entries";
 
+    /** The entries to move. */
     private IEntry[] entries;
 
+    /** The dn builder widget. */
     private DnBuilderWidget dnBuilderWidget;
 
+    /** The simulate move button. */
     private Button simulateMoveButton;
 
+    /** The ok button. */
     private Button okButton;
 
+    /** The parent DN. */
     private DN parentDn;
 
+    /** The simulate move flag. */
     private boolean simulateMove;
 
 
+    /**
+     * Creates a new instance of MoveEntriesDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param entries the entries
+     */
     public MoveEntriesDialog( Shell parentShell, IEntry[] entries )
     {
         super( parentShell );
@@ -65,6 +83,9 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -72,25 +93,34 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#close()
+     */
     public boolean close()
     {
-        this.dnBuilderWidget.removeWidgetModifyListener( this );
-        this.dnBuilderWidget.dispose();
+        dnBuilderWidget.removeWidgetModifyListener( this );
+        dnBuilderWidget.dispose();
         return super.close();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
     protected void okPressed()
     {
-        this.parentDn = this.dnBuilderWidget.getParentDn();
-        this.simulateMove = this.simulateMoveButton.getSelection();
+        parentDn = dnBuilderWidget.getParentDn();
+        simulateMove = simulateMoveButton.getSelection();
 
-        this.dnBuilderWidget.saveDialogSettings();
+        dnBuilderWidget.saveDialogSettings();
 
         super.okPressed();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
@@ -98,9 +128,11 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
         GridData gd = new GridData( GridData.FILL_BOTH );
         gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 3 / 2;
@@ -109,37 +141,49 @@
         BaseWidgetUtils.createLabel( composite,
             "Please enter/select the parent DN where the selected entries should be moved to.", 1 );
 
-        this.dnBuilderWidget = new DnBuilderWidget( false, true );
-        this.dnBuilderWidget.addWidgetModifyListener( this );
-        this.dnBuilderWidget.createContents( composite );
-        this.dnBuilderWidget.setInput( this.entries[0].getBrowserConnection(), null, null, this.entries[0].getDn()
-            .getParentDn() );
+        dnBuilderWidget = new DnBuilderWidget( false, true );
+        dnBuilderWidget.addWidgetModifyListener( this );
+        dnBuilderWidget.createContents( composite );
+        dnBuilderWidget.setInput( entries[0].getBrowserConnection(), null, null, entries[0].getDn().getParentDn() );
 
-        this.simulateMoveButton = BaseWidgetUtils.createCheckbox( composite,
+        simulateMoveButton = BaseWidgetUtils.createCheckbox( composite,
             "Simulate subtree moving by searching/adding/deleting recursively", 1 );
-        this.simulateMoveButton.setSelection( false );
-        this.simulateMoveButton.setEnabled( false );
+        simulateMoveButton.setSelection( false );
+        simulateMoveButton.setEnabled( false );
 
         applyDialogFont( composite );
         return composite;
     }
 
 
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener#widgetModified(org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent)
+     */
     public void widgetModified( WidgetModifyEvent event )
     {
-        if ( this.okButton != null )
+        if ( okButton != null )
         {
-            this.okButton.setEnabled( this.dnBuilderWidget.getParentDn() != null );
+            okButton.setEnabled( dnBuilderWidget.getParentDn() != null );
         }
     }
 
 
+    /**
+     * Gets the parent dn.
+     * 
+     * @return the parent dn
+     */
     public DN getParentDn()
     {
-        return this.parentDn;
+        return parentDn;
     }
 
 
+    /**
+     * Gets the simulate move flag.
+     * 
+     * @return the simulate move flag
+     */
     public boolean isSimulateMove()
     {
         return simulateMove;

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java Sun Sep  9 05:34:17 2007
@@ -57,29 +57,43 @@
 import org.eclipse.ui.contexts.IContextService;
 
 
+/**
+ * Dialog to view and edit multi-valued attributes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class MultivaluedDialog extends Dialog
 {
 
-    public static final String DIALOG_TITLE = "Multivalued Editor";
-
-    public static final int MAX_WIDTH = 450;
-
-    public static final int MAX_HEIGHT = 250;
+    /** The dialog title. */
+    private static final String DIALOG_TITLE = "Multivalued Editor";
 
+    /** The attribute hierarchie to edit. */
     private AttributeHierarchy attributeHierarchie;
 
+    /** The entry editor widget configuration. */
     private EntryEditorWidgetConfiguration configuration;
 
+    /** The entry edtior widget action group. */
     private EntryEditorWidgetActionGroup actionGroup;
 
+    /** The entry editor widget. */
     private EntryEditorWidget mainWidget;
 
+    /** The universal listener. */
     private MultiValuedEntryEditorUniversalListener universalListener;
 
     /** Token used to activate and deactivate shortcuts in the editor */
     private IContextActivation contextActivation;
 
 
+    /**
+     * Creates a new instance of MultivaluedDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param attributeHierarchie the attribute hierarchie
+     */
     public MultivaluedDialog( Shell parentShell, AttributeHierarchy attributeHierarchie )
     {
         super( parentShell );
@@ -88,6 +102,9 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -96,15 +113,20 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false );
-
         getShell().update();
         getShell().layout( true, true );
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
     protected void buttonPressed( int buttonId )
     {
         if ( IDialogConstants.CLOSE_ID == buttonId )
@@ -118,38 +140,80 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#open()
+     */
     public int open()
     {
-        this.dialogOpened();
+        if ( attributeHierarchie.getAttribute().getValueSize() == 0 )
+        {
+            attributeHierarchie.getAttribute().addEmptyValue();
+        }
+
         return super.open();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#close()
+     */
     public boolean close()
     {
         boolean returnValue = super.close();
         if ( returnValue )
         {
-            this.dispose();
-            this.dialogClosed();
+            dispose();
+
+            // cleanup attribute hierarchy after editing
+            for ( Iterator it = attributeHierarchie.iterator(); it.hasNext(); )
+            {
+                IAttribute attribute = ( IAttribute ) it.next();
+                if ( attribute != null )
+                {
+                    // remove empty values
+                    IValue[] values = attribute.getValues();
+                    for ( int i = 0; i < values.length; i++ )
+                    {
+                        if ( values[i].isEmpty() )
+                        {
+                            attribute.deleteEmptyValue();
+                        }
+                    }
+
+                    // deltet attribute from entry if all values were deleted
+                    if ( attribute.getValueSize() == 0 )
+                    {
+                        try
+                        {
+                            attribute.getEntry().deleteAttribute( attribute );
+                        }
+                        catch ( ModelModificationException e )
+                        {
+                        }
+                    }
+                }
+            }
         }
         return returnValue;
     }
 
 
+    /**
+     * Disposes all widgets.
+     */
     public void dispose()
     {
-        if ( this.configuration != null )
+        if ( configuration != null )
         {
-            this.universalListener.dispose();
-            this.universalListener = null;
-            this.mainWidget.dispose();
-            this.mainWidget = null;
-            this.actionGroup.deactivateGlobalActionHandlers();
-            this.actionGroup.dispose();
-            this.actionGroup = null;
-            this.configuration.dispose();
-            this.configuration = null;
+            universalListener.dispose();
+            universalListener = null;
+            mainWidget.dispose();
+            mainWidget = null;
+            actionGroup.deactivateGlobalActionHandlers();
+            actionGroup.dispose();
+            actionGroup = null;
+            configuration.dispose();
+            configuration = null;
 
             if ( contextActivation != null )
             {
@@ -162,33 +226,35 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
 
         // create configuration
-        this.configuration = new EntryEditorWidgetConfiguration();
+        configuration = new EntryEditorWidgetConfiguration();
 
         // create main widget
-        this.mainWidget = new EntryEditorWidget( this.configuration );
-        this.mainWidget.createWidget( composite );
-        this.mainWidget.getViewer().setInput( attributeHierarchie );
-        this.mainWidget.getViewer().getTree().setFocus();
+        mainWidget = new EntryEditorWidget( configuration );
+        mainWidget.createWidget( composite );
+        mainWidget.getViewer().setInput( attributeHierarchie );
+        mainWidget.getViewer().getTree().setFocus();
 
         // create actions
-        this.actionGroup = new EntryEditorWidgetActionGroup( this.mainWidget, this.configuration );
-        this.actionGroup.fillToolBar( this.mainWidget.getToolBarManager() );
-        this.actionGroup.fillMenu( this.mainWidget.getMenuManager() );
-        this.actionGroup.fillContextMenu( this.mainWidget.getContextMenuManager() );
+        actionGroup = new EntryEditorWidgetActionGroup( mainWidget, configuration );
+        actionGroup.fillToolBar( mainWidget.getToolBarManager() );
+        actionGroup.fillMenu( mainWidget.getMenuManager() );
+        actionGroup.fillContextMenu( mainWidget.getContextMenuManager() );
         IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
             IContextService.class );
         contextActivation = contextService.activateContext( BrowserCommonConstants.CONTEXT_DIALOGS );
-        actionGroup.activateGlobalActionHandlers();        
+        actionGroup.activateGlobalActionHandlers();
 
         // create the listener
-        this.universalListener = new MultiValuedEntryEditorUniversalListener( this.mainWidget.getViewer(),
-            this.actionGroup.getOpenDefaultEditorAction() );
+        universalListener = new MultiValuedEntryEditorUniversalListener( mainWidget.getViewer(), actionGroup
+            .getOpenDefaultEditorAction() );
 
         // start edit mode if an empty value exists
         for ( Iterator it = attributeHierarchie.iterator(); it.hasNext(); )
@@ -200,10 +266,10 @@
                 IValue value = values[i];
                 if ( value.isEmpty() )
                 {
-                    this.mainWidget.getViewer().setSelection( new StructuredSelection( value ), true );
-                    if ( this.actionGroup.getOpenDefaultEditorAction().isEnabled() )
+                    mainWidget.getViewer().setSelection( new StructuredSelection( value ), true );
+                    if ( actionGroup.getOpenDefaultEditorAction().isEnabled() )
                     {
-                        this.actionGroup.getOpenDefaultEditorAction().run();
+                        actionGroup.getOpenDefaultEditorAction().run();
                         break;
                     }
                 }
@@ -214,71 +280,38 @@
         return composite;
     }
 
-
-    private void dialogOpened()
-    {
-        if ( this.attributeHierarchie.getAttribute().getValueSize() == 0 )
-        {
-            this.attributeHierarchie.getAttribute().addEmptyValue();
-        }
-    }
-
-
-    private void dialogClosed()
-    {
-
-        for ( Iterator it = attributeHierarchie.iterator(); it.hasNext(); )
-        {
-            IAttribute attribute = ( IAttribute ) it.next();
-            if ( attribute != null )
-            {
-
-                // remove empty values
-                IValue[] values = attribute.getValues();
-                for ( int i = 0; i < values.length; i++ )
-                {
-                    if ( values[i].isEmpty() )
-                    {
-                        attribute.deleteEmptyValue();
-                    }
-                }
-
-                // are all values deleted?
-                if ( attribute.getValueSize() == 0 )
-                {
-                    try
-                    {
-                        attribute.getEntry().deleteAttribute( attribute );
-                    }
-                    catch ( ModelModificationException e )
-                    {
-                    }
-                    // new DeleteAttributeValueCommand(attribute).execute();
-                }
-            }
-        }
-
-    }
-
+    /**
+     * A special listener for the {@link MultivaluedDialog}.
+     */
     class MultiValuedEntryEditorUniversalListener extends EntryEditorWidgetUniversalListener
     {
 
+        /**
+         * Creates a new instance of MultiValuedEntryEditorUniversalListener.
+         * 
+         * @param startEditAction the start edit action
+         * @param treeViewer the tree viewer
+         */
         public MultiValuedEntryEditorUniversalListener( TreeViewer treeViewer, OpenDefaultEditorAction startEditAction )
         {
             super( treeViewer, startEditAction );
         }
 
 
+        /**
+         * @see org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetUniversalListener#entryUpdated(org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent)
+         */
         public void entryUpdated( EntryModificationEvent event )
         {
-
-            if ( this.viewer == null || this.viewer.getTree() == null || this.viewer.getTree().isDisposed() )
+            if ( viewer == null || viewer.getTree() == null || viewer.getTree().isDisposed() )
             {
                 return;
             }
 
-            if ( this.viewer.isCellEditorActive() )
-                this.viewer.cancelEditing();
+            if ( viewer.isCellEditorActive() )
+            {
+                viewer.cancelEditing();
+            }
 
             // set new input because attributes are newly created after a
             // modification
@@ -300,28 +333,28 @@
                 EventRegistry.resumeEventFireingInCurrentThread();
                 attributeHierarchie = entry.getAttributeWithSubtypes( attributeDescription );
             }
-            this.viewer.setInput( attributeHierarchie );
-            this.viewer.refresh();
+            viewer.setInput( attributeHierarchie );
+            viewer.refresh();
 
             // select added/modified value
             if ( event instanceof ValueAddedEvent )
             {
                 ValueAddedEvent vaEvent = ( ValueAddedEvent ) event;
-                this.viewer.setSelection( new StructuredSelection( vaEvent.getAddedValue() ), true );
-                this.viewer.refresh();
+                viewer.setSelection( new StructuredSelection( vaEvent.getAddedValue() ), true );
+                viewer.refresh();
             }
             else if ( event instanceof ValueModifiedEvent )
             {
                 ValueModifiedEvent vmEvent = ( ValueModifiedEvent ) event;
-                this.viewer.setSelection( new StructuredSelection( vmEvent.getNewValue() ), true );
+                viewer.setSelection( new StructuredSelection( vmEvent.getNewValue() ), true );
             }
             else if ( event instanceof ValueDeletedEvent )
             {
                 ValueDeletedEvent vdEvent = ( ValueDeletedEvent ) event;
                 if ( vdEvent.getDeletedValue().getAttribute().getValueSize() > 0 )
                 {
-                    this.viewer.setSelection( new StructuredSelection( vdEvent.getDeletedValue().getAttribute()
-                        .getValues()[0] ), true );
+                    viewer.setSelection( new StructuredSelection(
+                        vdEvent.getDeletedValue().getAttribute().getValues()[0] ), true );
                 }
             }
             else if ( event instanceof EmptyValueAddedEvent )
@@ -341,7 +374,6 @@
             }
             else if ( event instanceof AttributeDeletedEvent )
             {
-
             }
         }
     }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java Sun Sep  9 05:34:17 2007
@@ -38,30 +38,52 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * A dialog to enter the new RDN of an entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class RenameEntryDialog extends Dialog implements WidgetModifyListener
 {
 
-    public static final String DELETE_OLD_RDN_DIALOGSETTING_KEY = RenameEntryDialog.class.getName() + ".deleteOldRdn";
+    /** The "Delete old RDN" dialog setting . */
+    private static final String DELETE_OLD_RDN_DIALOGSETTING_KEY = RenameEntryDialog.class.getName() + ".deleteOldRdn";
 
-    public static final String DIALOG_TITLE = "Rename Entry";
+    /** The dialog title. */
+    private static final String DIALOG_TITLE = "Rename Entry";
 
+    /** The entry to rename. */
     private IEntry entry;
 
+    /** The dn builder widget. */
     private DnBuilderWidget dnBuilderWidget;
 
+    /** The delete old rdn button. */
     private Button deleteOldRdnButton;
 
+    /** The simulate rename button. */
     private Button simulateRenameButton;
 
+    /** The ok button. */
     private Button okButton;
 
+    /** The new rdn. */
     private RDN rdn;
 
+    /** The delete old rdn flag. */
     private boolean deleteOldRdn;
 
+    /** The simulate rename flag. */
     private boolean simulateRename;
 
 
+    /**
+     * Creates a new instance of RenameEntryDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param entry the entry
+     */
     public RenameEntryDialog( Shell parentShell, IEntry entry )
     {
         super( parentShell );
@@ -70,11 +92,17 @@
         this.rdn = null;
 
         if ( BrowserCommonActivator.getDefault().getDialogSettings().get( DELETE_OLD_RDN_DIALOGSETTING_KEY ) == null )
+        {
             BrowserCommonActivator.getDefault().getDialogSettings().put( DELETE_OLD_RDN_DIALOGSETTING_KEY, true );
-        this.deleteOldRdn = BrowserCommonActivator.getDefault().getDialogSettings().getBoolean( DELETE_OLD_RDN_DIALOGSETTING_KEY );
+        }
+        this.deleteOldRdn = BrowserCommonActivator.getDefault().getDialogSettings().getBoolean(
+            DELETE_OLD_RDN_DIALOGSETTING_KEY );
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -82,27 +110,36 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#close()
+     */
     public boolean close()
     {
-        this.dnBuilderWidget.removeWidgetModifyListener( this );
-        this.dnBuilderWidget.dispose();
+        dnBuilderWidget.removeWidgetModifyListener( this );
+        dnBuilderWidget.dispose();
         return super.close();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
     protected void okPressed()
     {
-        this.rdn = this.dnBuilderWidget.getRdn();
-        this.deleteOldRdn = this.deleteOldRdnButton.getSelection();
-        this.simulateRename = this.simulateRenameButton.getSelection();
+        rdn = dnBuilderWidget.getRdn();
+        deleteOldRdn = deleteOldRdnButton.getSelection();
+        simulateRename = simulateRenameButton.getSelection();
 
-        BrowserCommonActivator.getDefault().getDialogSettings().put( DELETE_OLD_RDN_DIALOGSETTING_KEY, this.deleteOldRdn );
-        this.dnBuilderWidget.saveDialogSettings();
+        BrowserCommonActivator.getDefault().getDialogSettings().put( DELETE_OLD_RDN_DIALOGSETTING_KEY, deleteOldRdn );
+        dnBuilderWidget.saveDialogSettings();
 
         super.okPressed();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
@@ -110,9 +147,11 @@
     }
 
 
+    /**     
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
         GridData gd = new GridData( GridData.FILL_BOTH );
         gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 3 / 2;
@@ -120,46 +159,64 @@
 
         BaseWidgetUtils.createLabel( composite, "Please enter the new RDN of the selected entry.", 1 );
 
-        this.dnBuilderWidget = new DnBuilderWidget( true, false );
-        this.dnBuilderWidget.addWidgetModifyListener( this );
-        this.dnBuilderWidget.createContents( composite );
-        this.dnBuilderWidget.setInput( this.entry.getBrowserConnection(), this.entry.getSubschema().getAllAttributeNames(),
-            this.entry.getRdn(), null );
+        dnBuilderWidget = new DnBuilderWidget( true, false );
+        dnBuilderWidget.addWidgetModifyListener( this );
+        dnBuilderWidget.createContents( composite );
+        dnBuilderWidget.setInput( entry.getBrowserConnection(), entry.getSubschema().getAllAttributeNames(), entry
+            .getRdn(), null );
 
-        this.deleteOldRdnButton = BaseWidgetUtils.createCheckbox( composite, "Delete old RDN", 1 );
-        this.deleteOldRdnButton.setSelection( this.deleteOldRdn );
+        deleteOldRdnButton = BaseWidgetUtils.createCheckbox( composite, "Delete old RDN", 1 );
+        deleteOldRdnButton.setSelection( deleteOldRdn );
 
-        this.simulateRenameButton = BaseWidgetUtils.createCheckbox( composite,
+        simulateRenameButton = BaseWidgetUtils.createCheckbox( composite,
             "Simulate subtree renaming by searching/adding/deleting recursively", 1 );
-        this.simulateRenameButton.setSelection( false );
-        this.simulateRenameButton.setEnabled( false );
+        simulateRenameButton.setSelection( false );
+        simulateRenameButton.setEnabled( false );
 
         applyDialogFont( composite );
         return composite;
     }
 
 
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener#widgetModified(org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent)
+     */
     public void widgetModified( WidgetModifyEvent event )
     {
-        if ( this.okButton != null )
+        if ( okButton != null )
         {
-            this.okButton.setEnabled( this.dnBuilderWidget.getRdn() != null );
+            okButton.setEnabled( dnBuilderWidget.getRdn() != null );
         }
     }
 
 
+    /**
+     * Gets the rdn.
+     * 
+     * @return the rdn
+     */
     public RDN getRdn()
     {
-        return this.rdn;
+        return rdn;
     }
 
 
+    /**
+     * Checks if the old RDN should be deleted.
+     * 
+     * @return true if the old RDN should be deleted.
+     */
     public boolean isDeleteOldRdn()
     {
-        return this.deleteOldRdn;
+        return deleteOldRdn;
     }
 
 
+    /**
+     * Checks if the renaming should be simulated by searching/adding/deleting.
+     * 
+     * @return true, if renaming shoudl be simulated
+     */
     public boolean isSimulateRename()
     {
         return simulateRename;

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java Sun Sep  9 05:34:17 2007
@@ -23,7 +23,6 @@
 
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.SWT;
@@ -35,31 +34,53 @@
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * A dialog to select the scope of a copy operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class ScopeDialog extends Dialog
 {
 
+    /** The dialog title. */
     private String dialogTitle;
 
-    private boolean multi;
+    /** The multiple entries selected flag. */
+    private boolean multipleEntriesSelected;
 
+    /** The scope. */
     private int scope = -1;
 
+    /** The object scope button. */
     private Button objectScopeButton;
 
+    /** The onelevel scope button. */
     private Button onelevelScopeButton;
 
+    /** The subtree scope button. */
     private Button subtreeScopeButton;
 
 
-    public ScopeDialog( Shell parentShell, String dialogTitle, boolean multi )
+    /**
+     * Creates a new instance of ScopeDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param dialogTitle the dialog title
+     * @param multipleEntriesSelected the multiple entries selected
+     */
+    public ScopeDialog( Shell parentShell, String dialogTitle, boolean multipleEntriesSelected )
     {
         super( parentShell );
         super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
         this.dialogTitle = dialogTitle;
-        this.multi = multi;
+        this.multipleEntriesSelected = multipleEntriesSelected;
     }
 
 
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -67,20 +88,20 @@
     }
 
 
-    public boolean close()
-    {
-        return super.close();
-    }
-
-
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
     protected void okPressed()
     {
-        this.scope = this.objectScopeButton.getSelection() ? ISearch.SCOPE_OBJECT : this.onelevelScopeButton
-            .getSelection() ? ISearch.SCOPE_ONELEVEL : ISearch.SCOPE_SUBTREE;
+        scope = objectScopeButton.getSelection() ? ISearch.SCOPE_OBJECT
+            : onelevelScopeButton.getSelection() ? ISearch.SCOPE_ONELEVEL : ISearch.SCOPE_SUBTREE;
         super.okPressed();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
@@ -88,33 +109,41 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
         GridData gd = new GridData( GridData.FILL_BOTH );
         composite.setLayoutData( gd );
 
         Group group = BaseWidgetUtils.createGroup( composite, "Please select the copy depth", 1 );
-        this.objectScopeButton = new Button( group, SWT.RADIO );
-        this.objectScopeButton.setSelection( true );
-        this.objectScopeButton.setText( this.multi ? "&Object (Only the copied entries)"
+        objectScopeButton = new Button( group, SWT.RADIO );
+        objectScopeButton.setSelection( true );
+        objectScopeButton.setText( multipleEntriesSelected ? "&Object (Only the copied entries)"
             : "&Object (Only the copied entry)" );
-        this.onelevelScopeButton = new Button( group, SWT.RADIO );
-        this.onelevelScopeButton.setText( this.multi ? "O&ne Level (The copied entries and their direct children)"
-            : "O&ne Level (The copied entry and its direct children)" );
-        this.subtreeScopeButton = new Button( group, SWT.RADIO );
-        this.subtreeScopeButton.setText( this.multi ? "&Subtree (The whole subtrees)" : "&Subtree (The whole subtree)" );
+        onelevelScopeButton = new Button( group, SWT.RADIO );
+        onelevelScopeButton
+            .setText( multipleEntriesSelected ? "O&ne Level (The copied entries and their direct children)"
+                : "O&ne Level (The copied entry and its direct children)" );
+        subtreeScopeButton = new Button( group, SWT.RADIO );
+        subtreeScopeButton.setText( multipleEntriesSelected ? "&Subtree (The whole subtrees)"
+            : "&Subtree (The whole subtree)" );
 
         applyDialogFont( composite );
         return composite;
-
     }
 
 
+    /**
+     * Gets the scope.
+     * 
+     * @return the scope
+     */
     public int getScope()
     {
-        return this.scope;
+        return scope;
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java Sun Sep  9 05:34:17 2007
@@ -25,9 +25,7 @@
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserConfiguration;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserUniversalListener;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserWidget;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -35,35 +33,54 @@
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 
 
+/**
+ * Dialog to select an entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class SelectEntryDialog extends Dialog
 {
 
+    /** The dialog title. */
     private String title;
 
-    private Image image;
-
+    /** The root entry. */
     private IEntry rootEntry;
 
+    /** The initial entry. */
     private IEntry initialEntry;
 
+    /** The selected entry. */
     private IEntry selectedEntry;
 
-    private BrowserConfiguration configuration;
-
-    private BrowserUniversalListener universalListener;
+    /** The browser configuration. */
+    private BrowserConfiguration browserConfiguration;
 
-    private BrowserActionGroup actionGroup;
-
-    private BrowserWidget mainWidget;
+    /** The browser universal listener. */
+    private BrowserUniversalListener browserUniversalListener;
 
+    /** The browser action group. */
+    private BrowserActionGroup browserActionGroup;
 
+    /** The browser widget. */
+    private BrowserWidget browserWidget;
+
+
+    /**
+     * Creates a new instance of SelectEntryDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param title the title
+     * @param rootEntry the root entry
+     * @param initialEntry the initial entry
+     */
     public SelectEntryDialog( Shell parentShell, String title, IEntry rootEntry, IEntry initialEntry )
     {
         super( parentShell );
@@ -75,53 +92,60 @@
     }
 
 
-    public SelectEntryDialog( Shell parentShell, String title, Image image, IEntry rootEntry, IEntry initialEntry )
-    {
-        this( parentShell, title, rootEntry, initialEntry );
-        this.image = image;
-    }
-
-
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
         shell.setText( title );
-        shell.setImage( image );
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#close()
+     */
     public boolean close()
     {
-        if ( this.mainWidget != null )
+        if ( browserWidget != null )
         {
-            this.configuration.dispose();
-            this.configuration = null;
-            this.actionGroup.deactivateGlobalActionHandlers();
-            this.actionGroup.dispose();
-            this.actionGroup = null;
-            this.universalListener.dispose();
-            this.universalListener = null;
-            this.mainWidget.dispose();
-            this.mainWidget = null;
+            browserConfiguration.dispose();
+            browserConfiguration = null;
+            browserActionGroup.deactivateGlobalActionHandlers();
+            browserActionGroup.dispose();
+            browserActionGroup = null;
+            browserUniversalListener.dispose();
+            browserUniversalListener = null;
+            browserWidget.dispose();
+            browserWidget = null;
         }
         return super.close();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
     protected void okPressed()
     {
-        this.selectedEntry = initialEntry;
+        selectedEntry = initialEntry;
         super.okPressed();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+     */
     protected void cancelPressed()
     {
-        this.selectedEntry = null;
+        selectedEntry = null;
         super.cancelPressed();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
@@ -129,9 +153,11 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
         GridData gd = new GridData( GridData.FILL_BOTH );
         gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
@@ -139,25 +165,25 @@
         composite.setLayoutData( gd );
 
         // create configuration
-        this.configuration = new BrowserConfiguration();
+        browserConfiguration = new BrowserConfiguration();
 
         // create main widget
-        this.mainWidget = new BrowserWidget( this.configuration, null );
-        this.mainWidget.createWidget( composite );
-        this.mainWidget.setInput( new IEntry[]
+        browserWidget = new BrowserWidget( browserConfiguration, null );
+        browserWidget.createWidget( composite );
+        browserWidget.setInput( new IEntry[]
             { rootEntry } );
 
         // create actions and context menu (and register global actions)
-        this.actionGroup = new BrowserActionGroup( this.mainWidget, this.configuration );
-        this.actionGroup.fillToolBar( this.mainWidget.getToolBarManager() );
-        this.actionGroup.fillMenu( this.mainWidget.getMenuManager() );
-        this.actionGroup.fillContextMenu( this.mainWidget.getContextMenuManager() );
-        this.actionGroup.activateGlobalActionHandlers();
+        browserActionGroup = new BrowserActionGroup( browserWidget, browserConfiguration );
+        browserActionGroup.fillToolBar( browserWidget.getToolBarManager() );
+        browserActionGroup.fillMenu( browserWidget.getMenuManager() );
+        browserActionGroup.fillContextMenu( browserWidget.getContextMenuManager() );
+        browserActionGroup.activateGlobalActionHandlers();
 
         // create the listener
-        this.universalListener = new BrowserUniversalListener( this.mainWidget.getViewer() );
+        browserUniversalListener = new BrowserUniversalListener( browserWidget.getViewer() );
 
-        this.mainWidget.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
+        browserWidget.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
         {
             public void selectionChanged( SelectionChangedEvent event )
             {
@@ -172,28 +198,32 @@
             }
         } );
 
-        this.mainWidget.getViewer().expandToLevel( 2 );
-        if ( this.initialEntry != null )
+        browserWidget.getViewer().expandToLevel( 2 );
+        if ( initialEntry != null )
         {
             IEntry entry = this.initialEntry;
-            this.mainWidget.getViewer().reveal( entry );
-            this.mainWidget.getViewer().refresh( entry, true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
+            browserWidget.getViewer().reveal( entry );
+            browserWidget.getViewer().refresh( entry, true );
+            browserWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
+            browserWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
         }
 
         applyDialogFont( composite );
 
-        this.mainWidget.setFocus();
+        browserWidget.setFocus();
 
         return composite;
-
     }
 
 
+    /**
+     * Gets the selected entry.
+     * 
+     * @return the selected entry
+     */
     public IEntry getSelectedEntry()
     {
-        return this.selectedEntry;
+        return selectedEntry;
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java?rev=574008&r1=574007&r2=574008&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java Sun Sep  9 05:34:17 2007
@@ -33,22 +33,34 @@
 import org.eclipse.swt.widgets.Text;
 
 
+/**
+ * Dialog with an text area.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class TextDialog extends Dialog
 {
 
-    public static final String DIALOG_TITLE = "Text Editor";
-
-    public static final double MAX_WIDTH = 250.0;
-
-    public static final double MAX_HEIGHT = 250.0;
+    /** The dialog title. */
+    private static final String DIALOG_TITLE = "Text Editor";
 
+    /** The initial value. */
     private String initialValue;
 
+    /** The return value. */
     private String returnValue;
 
+    /** The text area. */
     private Text text;
 
 
+    /**
+     * Creates a new instance of TextDialog.
+     * 
+     * @param parentShell the parent shell
+     * @param initialValue the initial value
+     */
     public TextDialog( Shell parentShell, String initialValue )
     {
         super( parentShell );
@@ -58,12 +70,9 @@
     }
 
 
-    public boolean close()
-    {
-        return super.close();
-    }
-
-
+    /**
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
     protected void configureShell( Shell shell )
     {
         super.configureShell( shell );
@@ -72,6 +81,9 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
@@ -79,13 +91,19 @@
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
     protected void okPressed()
     {
-        this.returnValue = this.text.getText();
+        returnValue = text.getText();
         super.okPressed();
     }
 
 
+    /**
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
     protected Control createDialogArea( Composite parent )
     {
         // create composite
@@ -108,8 +126,14 @@
     }
 
 
+    /**
+     * Gets the text.
+     * 
+     * @return the text
+     */
     public String getText()
     {
-        return this.returnValue;
+        return returnValue;
     }
+
 }



Mime
View raw message