You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/08/23 15:47:13 UTC

svn commit: r568990 [3/3] - in /directory/studio/trunk/studio-connection-ui: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/main...

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,97 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * The ConnectionLabelProvider represents the label provider for
+ * the connection widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionLabelProvider extends LabelProvider
+{
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation returns the connection name and appends information
+     * about the used encryption method.
+     */
+    public String getText( Object obj )
+    {
+        if ( obj instanceof Connection )
+        {
+            Connection conn = ( Connection ) obj;
+            if ( conn.getEncryptionMethod() == EncryptionMethod.LDAPS )
+            {
+                return conn.getName() + " (LDAPS)";
+            }
+            else if ( conn.getEncryptionMethod() == EncryptionMethod.START_TLS )
+            {
+                return conn.getName() + " (StartTLS)";
+            }
+            else
+            {
+                return conn.getName();
+            }
+        }
+        else if ( obj != null )
+        {
+            return obj.toString();
+        }
+        else
+        {
+            return "";
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation returns a icon for connected or disconnected state.
+     */
+    public Image getImage( Object obj )
+    {
+        if ( obj instanceof Connection )
+        {
+            Connection conn = ( Connection ) obj;
+            return conn.getJNDIConnectionWrapper().isConnected() ? ConnectionUIPlugin.getDefault().getImage(
+                ConnectionUIConstants.IMG_CONNECTION_CONNECTED ) : ConnectionUIPlugin.getDefault().getImage(
+                ConnectionUIConstants.IMG_CONNECTION_DISCONNECTED );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+}
\ No newline at end of file

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,131 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+
+
+/**
+ * The ConnectionUniversalListener manages all events for the connection widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionUniversalListener implements ConnectionUpdateListener
+{
+
+    /** The table viewer */
+    protected TableViewer viewer;
+
+
+    /**
+     * Creates a new instance of ConnectionUniversalListener.
+     *
+     * @param viewer the table viewer
+     */
+    public ConnectionUniversalListener( TableViewer viewer )
+    {
+        this.viewer = viewer;
+
+        ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionUIPlugin.getDefault().getEventRunner() );
+    }
+
+
+    /**
+     * Disposes this universal listener.
+     */
+    public void dispose()
+    {
+        if ( viewer != null )
+        {
+            ConnectionEventRegistry.removeConnectionUpdateListener( this );
+            viewer = null;
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionUpdated(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionUpdated( Connection connection )
+    {
+        if ( viewer != null )
+        {
+            viewer.refresh();
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionRenamed(org.apache.directory.studio.connection.core.Connection, java.lang.String)
+     */
+    public void connectionRenamed( Connection connection, String oldName )
+    {
+        connectionUpdated( connection );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionAdded(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionAdded( Connection connection )
+    {
+        connectionUpdated( connection );
+        if ( viewer != null )
+        {
+            viewer.setSelection( new StructuredSelection( connection ) );
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionRemoved(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionRemoved( Connection connection )
+    {
+        connectionUpdated( connection );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionOpened(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionOpened( Connection connection )
+    {
+        connectionUpdated( connection );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionClosed(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionClosed( Connection connection )
+    {
+        connectionUpdated( connection );
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,212 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.IActionBars;
+
+
+/**
+ * The ConnectionWidget is a reusable widget that displays all connections
+ * in a table viewer. It is used by 
+ * org.apache.directory.studio.ldapbrowser.ui.views.connection.ConnectionView, 
+ * org.apache.directory.studio.ldapbrowser.common.dialogs.SelectConnectionDialog and 
+ * org.apache.directory.studio.ldapbrowser.common.dialogs.SelectReferralConnectionDialog. 
+ * 
+ * It includes a content and label provider to display connections with a nice icon.
+ * 
+ * Further is provides a context menu and a local toolbar with actions to
+ * add, modify, delete, open and close connections.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionWidget extends ViewFormWidget
+{
+
+    /** The widget's configuration with the content provider, label provider and menu manager */
+    private ConnectionConfiguration configuration;
+
+    /** The action bars */
+    private IActionBars actionBars;
+
+    /** The table widget used by the table viewer */
+    private Table table;
+
+    /** The table viewer */
+    private TableViewer viewer;
+
+
+    /**
+     * Creates a new instance of ConnectionWidget.
+     *
+     * @param configuration the configuration
+     * @param actionBars the action bars
+     */
+    public ConnectionWidget( ConnectionConfiguration configuration, IActionBars actionBars )
+    {
+        this.configuration = configuration;
+        this.actionBars = actionBars;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createWidget( Composite parent )
+    {
+        if ( actionBars == null )
+        {
+            super.createWidget( parent );
+        }
+        else
+        {
+            createContent( parent );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IToolBarManager getToolBarManager()
+    {
+        if ( actionBars == null )
+        {
+            return super.getToolBarManager();
+        }
+        else
+        {
+            return actionBars.getToolBarManager();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IMenuManager getMenuManager()
+    {
+        if ( actionBars == null )
+        {
+            return super.getMenuManager();
+
+        }
+        else
+        {
+            return actionBars.getMenuManager();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IMenuManager getContextMenuManager()
+    {
+        if ( actionBars == null )
+        {
+            return super.getContextMenuManager();
+        }
+        else
+        {
+            return configuration.getContextMenuManager( viewer );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Control createContent( Composite parent )
+    {
+
+        table = new Table( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        GridData data = new GridData( GridData.FILL_BOTH );
+        data.widthHint = 450;
+        data.heightHint = 250;
+        table.setLayoutData( data );
+        viewer = new TableViewer( table );
+
+        // setup providers
+        viewer.setContentProvider( configuration.getContentProvider( viewer ) );
+        viewer.setLabelProvider( configuration.getLabelProvider( viewer ) );
+
+        return table;
+    }
+
+
+    /**
+     * Sets the input to the table viewer.
+     *
+     * @param input the input
+     */
+    public void setInput( Object input )
+    {
+        viewer.setInput( input );
+    }
+
+
+    /**
+     * Sets focus to the table viewer.
+     */
+    public void setFocus()
+    {
+        viewer.getTable().setFocus();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        if ( viewer != null )
+        {
+            configuration.dispose();
+            configuration = null;
+
+            table.dispose();
+            table = null;
+            viewer = null;
+        }
+    }
+
+
+    /**
+     * Gets the table viewer.
+     * 
+     * @return the table viewer
+     */
+    public TableViewer getViewer()
+    {
+        return viewer;
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/HistoryUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/HistoryUtils.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/HistoryUtils.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/HistoryUtils.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,88 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+
+
+/**
+ * The HistoryUtils are used to save and load the history of input fields.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HistoryUtils
+{
+
+    /**
+     * Saves the the given value under the given key in the dialog settings.
+     *
+     * @param key the key
+     * @param value the value
+     */
+    public static void save( String key, String value )
+    {
+        // get current history
+        String[] history = load( key );
+        List<String> list = new ArrayList<String>( Arrays.asList( history ) );
+
+        // add new value or move to first position
+        if ( list.contains( value ) )
+        {
+            list.remove( value );
+        }
+        list.add( 0, value );
+
+        // check history size
+        while ( list.size() > 20 )
+        {
+            list.remove( list.size() - 1 );
+        }
+
+        // save
+        history = list.toArray( new String[list.size()] );
+        ConnectionUIPlugin.getDefault().getDialogSettings().put( key, history );
+
+    }
+
+
+    /**
+     * Loads the value of the given key from the dialog settings
+     *
+     * @param key the key
+     * @return the value
+     */
+    public static String[] load( String key )
+    {
+        String[] history = ConnectionUIPlugin.getDefault().getDialogSettings().getArray( key );
+        if ( history == null )
+        {
+            history = new String[0];
+        }
+        return history;
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,347 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.apache.directory.studio.connection.core.jobs.CheckNetworkParameterJob;
+import org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage;
+import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * The NetworkParameterPage is used the edit the network parameters of a
+ * connection.
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NetworkParameterPage extends AbstractConnectionParameterPage
+{
+
+    /** The connection name text widget */
+    private Text nameText;
+
+    /** The host name combo with the history of recently used host names */
+    private Combo hostCombo;
+
+    /** The host combo with the history of recently used ports */
+    private Combo portCombo;
+
+    /** The combo to select the encryption method */
+    private Combo encryptionMethodCombo;
+
+    /** The button to check the connection parameters */
+    private Button checkConnectionButton;
+
+
+    /**
+     * Creates a new instance of NetworkParameterPage.
+     */
+    public NetworkParameterPage()
+    {
+    }
+
+
+    /**
+     * Gets the connection name.
+     * 
+     * @return the connectio name
+     */
+    private String getName()
+    {
+        return nameText.getText();
+    }
+
+
+    /**
+     * Gets the host name.
+     * 
+     * @return the host name
+     */
+    private String getHostName()
+    {
+        return hostCombo.getText();
+    }
+
+
+    /**
+     * Gets the port.
+     * 
+     * @return the port
+     */
+    private int getPort()
+    {
+        return Integer.parseInt( portCombo.getText() );
+    }
+
+
+    /**
+     * Gets the encyrption method.
+     * 
+     * @return the encyrption method
+     */
+    private ConnectionParameter.EncryptionMethod getEncyrptionMethod()
+    {
+        switch ( encryptionMethodCombo.getSelectionIndex() )
+        {
+            case 1:
+                return ConnectionParameter.EncryptionMethod.LDAPS;
+            case 2:
+                return ConnectionParameter.EncryptionMethod.START_TLS;
+            default:
+                return ConnectionParameter.EncryptionMethod.NONE;
+        }
+    }
+
+
+    /**
+     * Gets a temporary connection with all conection parameter 
+     * entered in this page. 
+     *
+     * @return a test connection
+     */
+    private Connection getTestConnection()
+    {
+        ConnectionParameter cp = new ConnectionParameter( null, getHostName(), getPort(), getEncyrptionMethod(),
+            ConnectionParameter.AuthenticationMethod.NONE, null, null );
+        Connection conn = new Connection( cp );
+        return conn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
+     */
+    public void createComposite( Composite parent )
+    {
+
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+        Composite nameComposite = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
+        BaseWidgetUtils.createLabel( nameComposite, "Connection name:", 1 );
+        nameText = BaseWidgetUtils.createText( nameComposite, "", 1 );
+        nameText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent event )
+            {
+                connectionPageModified();
+            }
+        } );
+
+        BaseWidgetUtils.createSpacer( composite, 1 );
+
+        Group group = BaseWidgetUtils.createGroup( composite, "Network Parameter", 1 );
+
+        Composite groupComposite = BaseWidgetUtils.createColumnContainer( group, 3, 1 );
+        BaseWidgetUtils.createLabel( groupComposite, "Hostname:", 1 );
+        String[] hostHistory = HistoryUtils.load( ConnectionUIConstants.DIALOGSETTING_KEY_HOST_HISTORY );
+        hostCombo = BaseWidgetUtils.createCombo( groupComposite, hostHistory, -1, 2 );
+        hostCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent event )
+            {
+                connectionPageModified();
+            }
+        } );
+
+        BaseWidgetUtils.createLabel( groupComposite, "Port:", 1 );
+        String[] portHistory = HistoryUtils.load( ConnectionUIConstants.DIALOGSETTING_KEY_PORT_HISTORY );
+        portCombo = BaseWidgetUtils.createCombo( groupComposite, portHistory, -1, 2 );
+        portCombo.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent event )
+            {
+                if ( !event.text.matches( "[0-9]*" ) )
+                {
+                    event.doit = false;
+                }
+                if ( portCombo.getText().length() > 4 && event.text.length() > 0 )
+                {
+                    event.doit = false;
+                }
+            }
+        } );
+        portCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent event )
+            {
+                connectionPageModified();
+            }
+        } );
+
+        String[] encMethods = new String[]
+            { "No encryption", "Use SSL encryption (ldaps://)", "Use StartTLS extension" };
+        int index = 0;
+        BaseWidgetUtils.createLabel( groupComposite, "Encryption method:", 1 );
+        encryptionMethodCombo = BaseWidgetUtils.createReadonlyCombo( groupComposite, encMethods, index, 2 );
+        encryptionMethodCombo.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                connectionPageModified();
+            }
+        } );
+        BaseWidgetUtils.createSpacer( groupComposite, 1 );
+        BaseWidgetUtils
+            .createLabel(
+                groupComposite,
+                "Warning: The current version doesn't support certificate validation, \nbe aware of invalid certificates or man-in-the-middle attacks!",
+                2 );
+
+        BaseWidgetUtils.createSpacer( groupComposite, 2 );
+        checkConnectionButton = new Button( groupComposite, SWT.PUSH );
+        GridData gd = new GridData();
+        gd.horizontalAlignment = SWT.RIGHT;
+        gd.verticalAlignment = SWT.BOTTOM;
+        checkConnectionButton.setLayoutData( gd );
+        checkConnectionButton.setText( "Check Network Parameter" );
+        checkConnectionButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                Connection connection = getTestConnection();
+                CheckNetworkParameterJob job = new CheckNetworkParameterJob( connection );
+                RunnableContextJobAdapter.execute( job, runnableContext );
+                if ( job.getExternalResult().isOK() )
+                {
+                    MessageDialog.openInformation( Display.getDefault().getActiveShell(), "Check Network Parameter",
+                        "The connection was established successfully." );
+                }
+            }
+        } );
+
+        validate();
+        nameText.setFocus();
+    }
+
+
+    /**
+     * Called when an input field was modified.
+     */
+    private void connectionPageModified()
+    {
+        // validate()
+        validate();
+
+        // fire
+        fireConnectionPageModified();
+    }
+
+
+    /**
+     * Validates the input fields after each modification.
+     */
+    private void validate()
+    {
+        // set enabled/disabled state of check connection button
+        checkConnectionButton.setEnabled( !hostCombo.getText().equals( "" ) && !portCombo.getText().equals( "" ) );
+
+        // validate input fields
+        message = null;
+        errorMessage = null;
+        if ( "".equals( portCombo.getText() ) )
+        {
+            message = "Please enter a port. The default LDAP port is 389.";
+        }
+        if ( "".equals( hostCombo.getText() ) )
+        {
+            message = "Please enter a hostname.";
+        }
+        if ( "".equals( nameText.getText() ) )
+        {
+            message = "Please enter a connection name.";
+        }
+        if ( ConnectionCorePlugin.getDefault().getConnectionManager().getConnection( nameText.getText() ) != null
+            && ( connectionParameter == null || !nameText.getText().equals( connectionParameter.getName() ) ) )
+        {
+            errorMessage = "A connection named '" + nameText.getText() + "' already exists.";
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     */
+    public void loadParameters( ConnectionParameter parameter )
+    {
+        connectionParameter = parameter;
+
+        nameText.setText( parameter.getName() );
+        hostCombo.setText( parameter.getHost() );
+        portCombo.setText( Integer.toString( parameter.getPort() ) );
+        int index = parameter.getEncryptionMethod() == EncryptionMethod.LDAPS ? 1
+            : parameter.getEncryptionMethod() == EncryptionMethod.START_TLS ? 2 : 0;
+        encryptionMethodCombo.select( index );
+
+        connectionPageModified();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#saveParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     */
+    public void saveParameters( ConnectionParameter parameter )
+    {
+        parameter.setName( getName() );
+        parameter.setHost( getHostName() );
+        parameter.setPort( getPort() );
+        parameter.setEncryptionMethod( getEncyrptionMethod() );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#saveDialogSettings()
+     */
+    public void saveDialogSettings()
+    {
+        HistoryUtils.save( ConnectionUIConstants.DIALOGSETTING_KEY_HOST_HISTORY, hostCombo.getText() );
+        HistoryUtils.save( ConnectionUIConstants.DIALOGSETTING_KEY_PORT_HISTORY, portCombo.getText() );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setFocus()
+     */
+    public void setFocus()
+    {
+        nameText.setFocus();
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/RunnableContextJobAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/RunnableContextJobAdapter.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/RunnableContextJobAdapter.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/RunnableContextJobAdapter.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,111 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import org.apache.directory.studio.connection.core.jobs.AbstractConnectionJob;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * This class provides some convinience methods to execute a job within
+ * an {@link IRunnableContext}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RunnableContextJobAdapter
+{
+
+    /**
+     * Executes the given job within a new {@link ProgressMonitorDialog}.
+     *
+     * @param job the job to execute
+     */
+    public static void execute( final AbstractConnectionJob job )
+    {
+        execute( job, null );
+    }
+
+
+    /**
+     * Executes the given job within the given runnable context and enabled error handling
+     * 
+     * @param runnableContext the runnable context
+     * @param job the job to execute
+     */
+    public static void execute( final AbstractConnectionJob job, IRunnableContext runnableContext )
+    {
+        execute( job, runnableContext, true );
+    }
+
+
+    /**
+     * Executes the given job within the given runnable context.
+     * 
+     * @param runnableContext the runnable context
+     * @param job the job to execute
+     * @param handleError true to handle errors
+     */
+    public static void execute( final AbstractConnectionJob job, IRunnableContext runnableContext, boolean handleError )
+    {
+
+        if ( runnableContext == null )
+        {
+            runnableContext = new ProgressMonitorDialog( Display.getDefault().getActiveShell() );
+        }
+
+        IRunnableWithProgress runnable = new IRunnableWithProgress()
+        {
+            public void run( IProgressMonitor ipm ) throws InterruptedException
+            {
+                job.setExternalProgressMonitor( ipm );
+                job.execute();
+                job.join();
+            }
+        };
+
+        try
+        {
+            runnableContext.run( true, true, runnable );
+        }
+        catch ( Exception ex )
+        {
+            ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+                new Status( IStatus.ERROR, ConnectionUIPlugin.PLUGIN_ID, IStatus.ERROR, ex.getMessage(), ex ) );
+        }
+
+        if ( handleError && !job.getExternalResult().isOK() )
+        {
+            IStatus status = job.getExternalResult();
+            ConnectionUIPlugin.getDefault().getExceptionHandler().handleException( status );
+        }
+
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ViewFormWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ViewFormWidget.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ViewFormWidget.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ViewFormWidget.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,256 @@
+/*
+ *  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.studio.connection.ui.widgets;
+
+
+import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ViewForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+
+/**
+ * The ViewFormWidget is a widget that provides an info text,
+ * a tool bar, a menu and a main content composite including
+ * a context menu. 
+ * It looks like this:
+ * <pre>
+ * -----------------------------------
+ * | info text     | tool bar | menu |
+ * -----------------------------------
+ * |                                 |
+ * |          main content           |
+ * |                                 |
+ * -----------------------------------
+ * </pre>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class ViewFormWidget
+{
+
+    /** The view form control */
+    protected ViewForm control;
+
+    /** The info text, positioned at the top left */
+    protected Text infoText;
+
+    /** The action tool bar */
+    protected ToolBar actionToolBar;
+
+    /** The action tool bar manager */
+    protected IToolBarManager actionToolBarManager;
+
+    /** The menu tool bar. */
+    protected ToolBar menuToolBar;
+
+    /** The menu manager. */
+    protected MenuManager menuManager;
+
+    /** The context menu manager. */
+    protected MenuManager contextMenuManager;
+
+
+    /**
+     * Creates the widget.
+     *
+     * @param parent the parent composite
+     */
+    public void createWidget( Composite parent )
+    {
+
+        control = new ViewForm( parent, SWT.NONE );
+        // control.marginWidth = 0;
+        // control.marginHeight = 0;
+        // control.horizontalSpacing = 0;
+        // control.verticalSpacing = 0;
+        control.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+
+        // infoText = BaseWidgetUtils.createLabeledText(control, "", 1);
+        Composite infoTextControl = BaseWidgetUtils.createColumnContainer( control, 1, 1 );
+        infoTextControl.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+        infoText = BaseWidgetUtils.createLabeledText( infoTextControl, "", 1 );
+        infoText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, true ) );
+        control.setTopLeft( infoTextControl );
+
+        // tool bar
+        actionToolBar = new ToolBar( control, SWT.FLAT | SWT.RIGHT );
+        actionToolBar.setLayoutData( new GridData( SWT.END, SWT.NONE, true, false ) );
+        actionToolBarManager = new ToolBarManager( actionToolBar );
+        control.setTopCenter( actionToolBar );
+
+        // local menu
+        this.menuManager = new MenuManager();
+        menuToolBar = new ToolBar( control, SWT.FLAT | SWT.RIGHT );
+        ToolItem ti = new ToolItem( menuToolBar, SWT.PUSH, 0 );
+        ti.setImage( ConnectionUIPlugin.getDefault().getImage( ConnectionUIConstants.IMG_PULLDOWN ) );
+        ti.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                showViewMenu();
+            }
+        } );
+        control.setTopRight( menuToolBar );
+
+        // content
+        Composite composite = BaseWidgetUtils.createColumnContainer( control, 1, 1 );
+        GridLayout gl = new GridLayout();
+        gl.horizontalSpacing = 0;
+        gl.verticalSpacing = 0;
+        gl.marginHeight = 0;
+        gl.marginWidth = 0;
+        composite.setLayout( gl );
+        Control childControl = this.createContent( composite );
+        control.setContent( composite );
+
+        // context menu
+        this.contextMenuManager = new MenuManager();
+        Menu menu = this.contextMenuManager.createContextMenu( childControl );
+        childControl.setMenu( menu );
+    }
+
+
+    /**
+     * Creates the content.
+     * 
+     * @param control the control
+     * 
+     * @return the control
+     */
+    protected abstract Control createContent( Composite control );
+
+
+    /**
+     * Shows the local view menu.
+     */
+    private void showViewMenu()
+    {
+        Menu aMenu = menuManager.createContextMenu( control );
+        Point topLeft = new Point( 0, 0 );
+        topLeft.y += menuToolBar.getBounds().height;
+        topLeft = menuToolBar.toDisplay( topLeft );
+        aMenu.setLocation( topLeft.x, topLeft.y );
+        aMenu.setVisible( true );
+    }
+
+
+    /**
+     * Disposes this widget.
+     */
+    public void dispose()
+    {
+        if ( control != null )
+        {
+
+            if ( contextMenuManager != null )
+            {
+                contextMenuManager.removeAll();
+                contextMenuManager.dispose();
+                contextMenuManager = null;
+            }
+            if ( menuToolBar != null )
+            {
+                menuToolBar.dispose();
+                menuToolBar = null;
+                menuManager.dispose();
+                menuManager = null;
+            }
+            if ( actionToolBar != null )
+            {
+                actionToolBar.dispose();
+                actionToolBar = null;
+                actionToolBarManager.removeAll();
+                actionToolBarManager = null;
+            }
+
+            if ( infoText != null )
+            {
+                infoText.dispose();
+                infoText = null;
+            }
+
+            control.dispose();
+            control = null;
+        }
+    }
+
+
+    /**
+     * Gets the info text.
+     * 
+     * @return the info text
+     */
+    public Text getInfoText()
+    {
+        return infoText;
+    }
+
+
+    /**
+     * Gets the tool bar manager.
+     * 
+     * @return the tool bar manager
+     */
+    public IToolBarManager getToolBarManager()
+    {
+        return this.actionToolBarManager;
+    }
+
+
+    /**
+     * Gets the menu manager.
+     * 
+     * @return the menu manager
+     */
+    public IMenuManager getMenuManager()
+    {
+        return menuManager;
+    }
+
+
+    /**
+     * Gets the context menu manager.
+     * 
+     * @return the context menu manager
+     */
+    public IMenuManager getContextMenuManager()
+    {
+        return this.contextMenuManager;
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,169 @@
+/*
+ *  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.studio.connection.ui.wizards;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.apache.directory.studio.connection.core.jobs.OpenConnectionsJob;
+import org.apache.directory.studio.connection.ui.ConnectionParameterPage;
+import org.apache.directory.studio.connection.ui.ConnectionParameterPageManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * The NewConnectionWizard is used to create a new connection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewConnectionWizard extends Wizard implements INewWizard
+{
+
+    /** The wizard pages. */
+    private NewConnectionWizardPage[] wizardPages;
+
+    /** The connection parameter pages. */
+    private ConnectionParameterPage[] pages;
+
+
+    /**
+     * Creates a new instance of NewConnectionWizard.
+     */
+    public NewConnectionWizard()
+    {
+        setWindowTitle( "New LDAP Connection" );
+        setNeedsProgressMonitor( true );
+    }
+
+
+    /**
+     * Gets the id.
+     * 
+     * @return the id
+     */
+    public static String getId()
+    {
+        return NewConnectionWizard.class.getName();
+    }
+
+
+    /**
+     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+     */
+    public void init( IWorkbench workbench, IStructuredSelection selection )
+    {
+    }
+
+
+    /**
+     * @see org.eclipse.jface.wizard.Wizard#addPages()
+     */
+    public void addPages()
+    {
+        pages = ConnectionParameterPageManager.getConnectionParameterPages();
+
+        wizardPages = new NewConnectionWizardPage[pages.length];
+        for ( int i = 0; i < pages.length; i++ )
+        {
+            wizardPages[i] = new NewConnectionWizardPage( this, pages[i] );
+            addPage( wizardPages[i] );
+        }
+    }
+
+
+    /**
+     * @see org.eclipse.jface.wizard.Wizard#createPageControls(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPageControls( Composite pageContainer )
+    {
+        super.createPageControls( pageContainer );
+
+        // TODO: set help context ID, move help from browser-help plugin to connections-help plugin 
+        //        for ( NewConnectionWizardPage wizardPage : wizardPages )
+        //        {
+        //            PlatformUI.getWorkbench().getHelpSystem().setHelp( wizardPage.getControl(),
+        //                ConnectionUIPlugin.PLUGIN_ID + "." + "tools_newconnection_wizard" );
+        //        }
+    }
+
+
+    /**
+     * @see org.eclipse.jface.wizard.Wizard#canFinish()
+     */
+    public boolean canFinish()
+    {
+        for ( int i = 0; i < pages.length; i++ )
+        {
+            if ( !pages[i].isValid() )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * @see org.eclipse.jface.wizard.Wizard#performFinish()
+     */
+    public boolean performFinish()
+    {
+        // get connection paramters from pages and save dialog settings 
+        ConnectionParameter connectionParameter = new ConnectionParameter();
+        for ( int i = 0; i < pages.length; i++ )
+        {
+            pages[i].saveParameters( connectionParameter );
+            pages[i].saveDialogSettings();
+        }
+
+        // create persistent connection
+        final Connection conn = new Connection( connectionParameter );
+        ConnectionCorePlugin.getDefault().getConnectionManager().addConnection( conn );
+
+        // open connection
+        new OpenConnectionsJob( conn ).execute();
+
+        return true;
+    }
+
+
+    /**
+     * Gets the test connection parameters.
+     * 
+     * @return the test connection parameters
+     */
+    public ConnectionParameter getTestConnectionParameters()
+    {
+        ConnectionParameter connectionParameter = new ConnectionParameter();
+        for ( int i = 0; i < pages.length; i++ )
+        {
+            pages[i].saveParameters( connectionParameter );
+        }
+        return connectionParameter;
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,121 @@
+/*
+ *  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.studio.connection.ui.wizards;
+
+
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.apache.directory.studio.connection.ui.ConnectionParameterPage;
+import org.apache.directory.studio.connection.ui.ConnectionParameterPageModifyListener;
+import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * NewConnectionWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewConnectionWizardPage extends WizardPage implements ConnectionParameterPageModifyListener
+{
+
+    /** The wizard. */
+    private NewConnectionWizard wizard;
+
+    /** The page. */
+    private ConnectionParameterPage page;
+
+
+    /**
+     * Creates a new instance of NewConnectionWizard.
+     * 
+     * @param page the page
+     * @param wizard the wizard
+     */
+    public NewConnectionWizardPage( NewConnectionWizard wizard, ConnectionParameterPage page )
+    {
+        super( page.getPageName() );
+        setTitle( page.getPageName() );
+        setDescription( page.getPageDescription() );
+        setImageDescriptor( ConnectionUIPlugin.getDefault().getImageDescriptor(
+            ConnectionUIConstants.IMG_CONNECTION_WIZARD ) );
+        setPageComplete( false );
+
+        page.setConnectionParameterPageModifyListener( this );
+        page.setRunnableContext( getContainer() );
+
+        this.wizard = wizard;
+        this.page = page;
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+     */
+    public void setVisible( boolean visible )
+    {
+        super.setVisible( visible );
+
+        if ( visible )
+        {
+            page.setFocus();
+        }
+    }
+
+
+    /**
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout gl = new GridLayout( 1, false );
+        composite.setLayout( gl );
+        page.createComposite( composite );
+        setControl( composite );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPageModifyListener#connectionParameterPageModified()
+     */
+    public void connectionParameterPageModified()
+    {
+        setMessage( page.getMessage() );
+        setErrorMessage( page.getErrorMessage() );
+        setPageComplete( page.isValid() );
+        getContainer().updateButtons();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPageModifyListener#getTestConnectionParameters()
+     */
+    public ConnectionParameter getTestConnectionParameters()
+    {
+        return wizard.getTestConnectionParameters();
+    }
+
+}
\ No newline at end of file

Added: directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd Thu Aug 23 06:47:09 2007
@@ -0,0 +1,153 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.directory.studio.connection.ui">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.apache.directory.studio.connection.ui" id="connectionParameterPage" name="Connection Parameter Page"/>
+      </appInfo>
+      <documentation>
+         A ConnectionParameterPage is used to specify additional parameters to a connection.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <complexType>
+         <sequence>
+            <element ref="connectionParameterPage"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The extension-point of this extension.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  Extension identifier.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  Name of this extension.
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="connectionParameterPage">
+      <annotation>
+         <appInfo>
+            <meta.element labelAttribute="name" icon="icon"/>
+         </appInfo>
+      </annotation>
+      <complexType>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The name of the function.
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="description" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The specific class implementing the function.
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn="org.apache.directory.studio.connection.ui.IConnectionParameterPage"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         1.0.0
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         &lt;p&gt;
+&lt;pre&gt;
+   &lt;extension
+       point=&quot;org.apache.directory.studio.connectionparameterpages&quot;&gt;
+
+    &lt;valueEditor
+          name=&quot;Browser Options&quot;
+          class=&quot;org.apache.directory.studio.ldapbrowser.common.wizard.connection.ConnectionParameterPage&quot;
+          /&gt;
+   &lt;/extension&gt;         
+&lt;/pre&gt;
+&lt;p&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiInfo"/>
+      </appInfo>
+      <documentation>
+         
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="implementation"/>
+      </appInfo>
+      <documentation>
+         
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         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
+  &quot;License&quot;); 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
+  &quot;AS IS&quot; 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.
+      </documentation>
+   </annotation>
+
+</schema>