directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r663288 - in /directory/studio/branches/apacheds-plugin-branch/apacheds: META-INF/ resources/icons/ src/main/java/org/apache/directory/studio/apacheds/ src/main/java/org/apache/directory/studio/apacheds/actions/ src/main/java/org/apache/dir...
Date Wed, 04 Jun 2008 16:12:56 GMT
Author: pamarcelot
Date: Wed Jun  4 09:12:56 2008
New Revision: 663288

URL: http://svn.apache.org/viewvc?rev=663288&view=rev
Log:
o Added an "optional" required bundled dependency to the Connection Core plugin.
o Added a new action that creates a connection in the LDAP perspective from the server configuration.

Added:
    directory/studio/branches/apacheds-plugin-branch/apacheds/resources/icons/connection_new.gif
  (with props)
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionAction.java
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionActionHelper.java
Modified:
    directory/studio/branches/apacheds-plugin-branch/apacheds/META-INF/MANIFEST.MF
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginConstants.java
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/views/ServersView.java

Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/META-INF/MANIFEST.MF?rev=663288&r1=663287&r2=663288&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/META-INF/MANIFEST.MF (original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/META-INF/MANIFEST.MF Wed Jun
 4 09:12:56 2008
@@ -14,7 +14,8 @@
  org.eclipse.debug.core,
  org.eclipse.debug.ui,
  org.apache.directory.studio.jars,
- org.apache.directory.studio.apacheds.configuration
+ org.apache.directory.studio.apacheds.configuration,
+ org.apache.directory.studio.connection.core;resolution:=optional
 Eclipse-LazyStart: true
 Eclipse-RegisterBuddy: org.apache.directory.studio.jars
 Bundle-ClassPath: .,

Added: directory/studio/branches/apacheds-plugin-branch/apacheds/resources/icons/connection_new.gif
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/resources/icons/connection_new.gif?rev=663288&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/branches/apacheds-plugin-branch/apacheds/resources/icons/connection_new.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginConstants.java?rev=663288&r1=663287&r2=663288&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginConstants.java
(original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginConstants.java
Wed Jun  4 09:12:56 2008
@@ -44,6 +44,7 @@
     public static final String IMG_SERVER_STOPPING3 = "resources/icons/server_stopping3.gif";
     public static final String IMG_RUN = "resources/icons/run.gif";
     public static final String IMG_STOP = "resources/icons/stop.gif";
+    public static final String IMG_CREATE_CONNECTION = "resources/icons/connection_new.gif";
 
     // --------
     // COMMANDS
@@ -55,6 +56,7 @@
     public static final String CMD_OPEN_CONFIGURATION = "org.apache.directory.studio.apacheds.commands.openConfiguration";
     public static final String CMD_DELETE = "org.apache.directory.studio.apacheds.commands.delete";
     public static final String CMD_RENAME = "org.apache.directory.studio.apacheds.commands.rename";
+    public static final String CMD_CREATE_CONNECTION = "org.apache.directory.studio.apacheds.commands.createConnection";
 
     // --------
     // CONTEXTS

Added: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionAction.java?rev=663288&view=auto
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionAction.java
(added)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionAction.java
Wed Jun  4 09:12:56 2008
@@ -0,0 +1,331 @@
+/*
+ *  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.apacheds.actions;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import org.apache.directory.studio.apacheds.ApacheDsPlugin;
+import org.apache.directory.studio.apacheds.ApacheDsPluginConstants;
+import org.apache.directory.studio.apacheds.ApacheDsPluginUtils;
+import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
+import org.apache.directory.studio.apacheds.configuration.model.v152.ServerConfigurationV152;
+import org.apache.directory.studio.apacheds.configuration.model.v152.ServerXmlIOV152;
+import org.apache.directory.studio.apacheds.model.Server;
+import org.apache.directory.studio.apacheds.views.ServersView;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * This class implements the create connection action for a server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CreateConnectionAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated view */
+    private ServersView view;
+
+
+    /**
+     * Creates a new instance of CreateConnectionAction.
+     */
+    public CreateConnectionAction( ServersView view )
+    {
+        super( "Create a Connection" );
+        setId( ApacheDsPluginConstants.CMD_CREATE_CONNECTION );
+        setActionDefinitionId( ApacheDsPluginConstants.CMD_CREATE_CONNECTION );
+        setToolTipText( "Stop" );
+        setImageDescriptor( ApacheDsPlugin.getDefault().getImageDescriptor(
+            ApacheDsPluginConstants.IMG_CREATE_CONNECTION ) );
+        this.view = view;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+        {
+            // Getting the server
+            Server server = ( Server ) selection.getFirstElement();
+
+            // Parsing the 'server.xml' file
+            ServerXmlIOV152 serverXmlIOV152 = new ServerXmlIOV152();
+            ServerConfigurationV152 serverConfiguration = null;
+            try
+            {
+                serverConfiguration = ( ServerConfigurationV152 ) serverXmlIOV152.parse(
new FileInputStream( new File(
+                    ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId()
).append( "conf" ).append(
+                        "server.xml" ).toOSString() ) ) );
+            }
+            catch ( FileNotFoundException e )
+            {
+                reportErrorReadingServerConfiguration( e.getMessage() );
+                return;
+            }
+            catch ( ServerXmlIOException e )
+            {
+                reportErrorReadingServerConfiguration( e.getMessage() );
+                return;
+            }
+
+            // Checking if we could read the 'server.xml' file
+            if ( serverConfiguration == null )
+            {
+                reportErrorReadingServerConfiguration( null );
+                return;
+            }
+
+            if ( ( serverConfiguration.isEnableLdap() ) || ( serverConfiguration.isEnableLdaps()
) )
+            {
+                // Creating the connection using the helper class
+                CreateConnectionActionHelper.createLdapBrowserConnection( server.getName(),
serverConfiguration );
+            }
+            else
+            {
+                // LDAP and LDAPS protocols are disabled, we report this error to the user
+                MessageDialog dialog = new MessageDialog( view.getSite().getShell(), "Unable
to create a connection",
+                    null, "LDAP and LDAPS protocols are disabled. A connection cannot be
created.",
+                    MessageDialog.ERROR, new String[]
+                        { IDialogConstants.OK_LABEL }, MessageDialog.OK );
+                dialog.open();
+            }
+        }
+    }
+
+
+    /**
+     * Reports to the user an error message indicating the server 
+     * configuration could not be read correctly.
+     *
+     * @param errorMessage
+     *      an error message which can be <code>null</code>
+     */
+    private void reportErrorReadingServerConfiguration( String errorMessage )
+    {
+        String message = null;
+
+        if ( errorMessage == null )
+        {
+            message = "Unable to read the server configuration.";
+        }
+        else
+        {
+            message = "Unable to read the server configuration." + ApacheDsPluginUtils.LINE_SEPARATOR
+                + ApacheDsPluginUtils.LINE_SEPARATOR + "The following error occurred: " +
errorMessage;
+        }
+
+        MessageDialog dialog = new MessageDialog( view.getSite().getShell(), "Unable to read
the server configuration",
+            null, message, MessageDialog.ERROR, new String[]
+                { IDialogConstants.OK_LABEL }, MessageDialog.OK );
+        dialog.open();
+    }
+
+
+    /**
+     * Sets the enabled state of this action.
+     * <p>
+     * When an action is in the enabled state, the control associated with 
+     * it is active; triggering it will end up inkoking this action's 
+     * <code>run</code> method.
+     * </p>
+     * <p>
+     * Fires a property change event for the <code>ENABLED</code> property
+     * if the enabled state actually changes as a consequence.
+     * </p>
+     * <p>
+     * In the particular case of this action, when the enabled value equals
+     * <code>true</code>, a check on the presence of the necessary LDAP
+     * Browser plugins is executed. The action is enabled only if all the 
+     * required plugins are available.
+     * </p>
+     *
+     * @param enabled <code>true</code> to enable, and
+     *   <code>false</code> to disable
+     * @see #ENABLED
+     */
+    public void setEnabled( boolean enabled )
+    {
+        if ( enabled )
+        {
+            super.setEnabled( isLdapBrowserPluginsAvailable() );
+        }
+        else
+        {
+            super.setEnabled( enabled );
+        }
+    }
+
+
+    /**
+     * Indicates if the LDAP Browser plugins are available or not.
+     *
+     * @return
+     *  <code>true</code> if the LDAP Browser plugins are available, 
+     *  <code>false</code> if not.
+     */
+    private boolean isLdapBrowserPluginsAvailable()
+    {
+        // Connection Core Plugin
+        Bundle connectionCoreBundle = Platform.getBundle( "org.apache.directory.studio.connection.core"
);
+        if ( connectionCoreBundle != null )
+        {
+            // Checking the state of the plugin
+            if ( connectionCoreBundle.getState() == Bundle.UNINSTALLED )
+            {
+                return false;
+            }
+
+            // Connection UI Plugin
+            Bundle connectionUiBundle = Platform.getBundle( "org.apache.directory.studio.connection.ui"
);
+            if ( connectionUiBundle != null )
+            {
+                // Checking the state of the plugin
+                if ( connectionUiBundle.getState() == Bundle.UNINSTALLED )
+                {
+                    return false;
+                }
+
+                // LDAP Browser Common Plugin
+                Bundle ldapBrowserCommonBundle = Platform.getBundle( "org.apache.directory.studio.ldapbrowser.common"
);
+                if ( ldapBrowserCommonBundle != null )
+                {
+                    // Checking the state of the plugin
+                    if ( ldapBrowserCommonBundle.getState() == Bundle.UNINSTALLED )
+                    {
+                        return false;
+                    }
+
+                    // LDAP Browser Core Plugin
+                    Bundle ldapBrowserCoreBundle = Platform.getBundle( "org.apache.directory.studio.ldapbrowser.core"
);
+                    if ( ldapBrowserCoreBundle != null )
+                    {
+                        // Checking the state of the plugin
+                        if ( ldapBrowserCoreBundle.getState() == Bundle.UNINSTALLED )
+                        {
+                            return false;
+                        }
+
+                        // LDAP Browser UI Plugin
+                        Bundle ldapBrowserUiBundle = Platform.getBundle( "org.apache.directory.studio.ldapbrowser.ui"
);
+                        if ( ldapBrowserUiBundle != null )
+                        {
+                            // Checking the state of the plugin
+                            if ( ldapBrowserUiBundle.getState() == Bundle.UNINSTALLED )
+                            {
+                                return false;
+                            }
+
+                            // LDIF Editor Plugin
+                            Bundle ldifEditorBundle = Platform.getBundle( "org.apache.directory.studio.ldifeditor"
);
+                            if ( ldifEditorBundle != null )
+                            {
+                                // Checking the state of the plugin
+                                if ( ldifEditorBundle.getState() == Bundle.UNINSTALLED )
+                                {
+                                    return false;
+                                }
+
+                                // LDIF Parser Plugin
+                                Bundle ldifParserBundle = Platform.getBundle( "org.apache.directory.studio.ldifparser"
);
+                                if ( ldifParserBundle != null )
+                                {
+                                    // Checking the state of the plugin
+                                    if ( ldifParserBundle.getState() == Bundle.UNINSTALLED
)
+                                    {
+                                        return false;
+                                    }
+
+                                    // Jars Plugin
+                                    Bundle jarsBundle = Platform.getBundle( "org.apache.directory.studio.jars"
);
+                                    if ( jarsBundle != null )
+                                    {
+                                        // Checking the state of the plugin
+                                        if ( jarsBundle.getState() == Bundle.UNINSTALLED
)
+                                        {
+                                            return false;
+                                        }
+
+                                        return true;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Added: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionActionHelper.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionActionHelper.java?rev=663288&view=auto
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionActionHelper.java
(added)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/CreateConnectionActionHelper.java
Wed Jun  4 09:12:56 2008
@@ -0,0 +1,152 @@
+/*
+ *  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.apacheds.actions;
+
+
+import org.apache.directory.studio.apacheds.configuration.model.v152.ServerConfigurationV152;
+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.AuthenticationMethod;
+import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements a helper class of the create connection action for a server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CreateConnectionActionHelper
+{
+    /**
+     * Creates a connection in the LDAP Browser plugin.
+     *
+     * @param serverName
+     *      the name of the server
+     * @param serverConfiguration
+     *      the server configuration
+     */
+    public static void createLdapBrowserConnection( String serverName, ServerConfigurationV152
serverConfiguration )
+    {
+        if ( ( serverConfiguration.isEnableLdap() ) || ( serverConfiguration.isEnableLdaps()
) )
+        {
+            //Creating the connection parameter object
+            ConnectionParameter connectionParameter = new ConnectionParameter();
+
+            // Auth method
+            connectionParameter.setAuthMethod( AuthenticationMethod.SIMPLE );
+
+            // Encryption method and port
+            if ( serverConfiguration.isEnableLdap() )
+            {
+                connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
+                connectionParameter.setPort( serverConfiguration.getLdapPort() );
+            }
+            else if ( serverConfiguration.isEnableLdaps() )
+            {
+                connectionParameter.setEncryptionMethod( EncryptionMethod.LDAPS );
+                connectionParameter.setPort( serverConfiguration.getLdapsPort() );
+            }
+
+            // Bind password
+            connectionParameter.setBindPassword( "secret" );
+
+            // Bind principal
+            connectionParameter.setBindPrincipal( "uid=admin,ou=system" );
+
+            // Host
+            connectionParameter.setHost( "localhot" );
+
+            // Name
+            connectionParameter.setName( serverName );
+
+            // Creating the connection
+            Connection connection = new Connection( connectionParameter );
+
+            // Adding the connection to the connection manager
+            ConnectionCorePlugin.getDefault().getConnectionManager().addConnection( connection
);
+
+            // Adding the connection to the root connection folder
+            ConnectionCorePlugin.getDefault().getConnectionFolderManager().getRootConnectionFolder().addConnectionId(
+                connection.getId() );
+
+            // Getting the window, LDAP perspective and current perspective
+            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+            IPerspectiveDescriptor ldapPerspective = getLdapPerspective();
+            IPerspectiveDescriptor currentPerspective = window.getActivePage().getPerspective();
+
+            // Checking if we are already in the LDAP perspective
+            if ( ( ldapPerspective != null ) && ( ldapPerspective.equals( currentPerspective
) ) )
+            {
+                // As we're already in the LDAP perspective, we only indicate to the user

+                // the name of the connection that has been created
+                MessageDialog dialog = new MessageDialog( window.getShell(), "Connection
created", null,
+                    "A connection called '" + connection.getName() + "' has been created.",
MessageDialog.INFORMATION,
+                    new String[]
+                        { IDialogConstants.OK_LABEL }, MessageDialog.OK );
+                dialog.open();
+            }
+            else
+            {
+                // We're not already in the LDAP perspective, we indicate to the user
+                // the name of the connection that has been created and we ask him
+                // if we wants to switch to the LDAP perspective
+                MessageDialog dialog = new MessageDialog( window.getShell(), "Connection
created", null,
+                    "A connection called '" + connection.getName()
+                        + "' has been created.\n\nDo you want to switch to the LDAP perspective
?",
+                    MessageDialog.INFORMATION, new String[]
+                        { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, MessageDialog.OK
);
+                if ( dialog.open() == MessageDialog.OK )
+                {
+                    // Switching to the LDAP perspective
+                    window.getActivePage().setPerspective( ldapPerspective );
+                }
+            }
+        }
+
+    }
+
+
+    /**
+     * Get the LDAP perspective.
+     *
+     * @return
+     *      the LDAP perspective
+     */
+    private static IPerspectiveDescriptor getLdapPerspective()
+    {
+        for ( IPerspectiveDescriptor perspective : PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives()
)
+        {
+            if ( "org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective"
+                .equalsIgnoreCase( perspective.getId() ) )
+            {
+                return perspective;
+            }
+        }
+
+        return null;
+    }
+}

Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/views/ServersView.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/views/ServersView.java?rev=663288&r1=663287&r2=663288&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/views/ServersView.java
(original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/views/ServersView.java
Wed Jun  4 09:12:56 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.studio.apacheds.ApacheDsPluginConstants;
+import org.apache.directory.studio.apacheds.actions.CreateConnectionAction;
 import org.apache.directory.studio.apacheds.actions.DeleteAction;
 import org.apache.directory.studio.apacheds.actions.NewServerAction;
 import org.apache.directory.studio.apacheds.actions.OpenConfigurationAction;
@@ -98,6 +99,7 @@
     private RenameAction rename;
     private RunAction run;
     private StopAction stop;
+    private CreateConnectionAction createConnection;
     private PropertiesAction properties;
 
     // Listeners
@@ -266,6 +268,9 @@
         stop = new StopAction( this );
         stop.setEnabled( false );
 
+        createConnection = new CreateConnectionAction( this );
+        createConnection.setEnabled( false );
+
         properties = new PropertiesAction( this );
         properties.setEnabled( false );
     }
@@ -306,6 +311,10 @@
                 manager.add( run );
                 manager.add( stop );
                 manager.add( new Separator() );
+                MenuManager ldapBrowserManager = new MenuManager( "LDAP Browser" );
+                ldapBrowserManager.add( createConnection );
+                manager.add( ldapBrowserManager );
+                manager.add( new Separator() );
                 manager.add( properties );
             }
         } );
@@ -479,6 +488,7 @@
             openConfiguration.setEnabled( true );
             delete.setEnabled( true );
             rename.setEnabled( true );
+            createConnection.setEnabled( true );
             properties.setEnabled( true );
         }
         else
@@ -488,6 +498,7 @@
             rename.setEnabled( false );
             run.setEnabled( false );
             stop.setEnabled( false );
+            createConnection.setEnabled( false );
             properties.setEnabled( false );
         }
     }



Mime
View raw message