Package org.apache.directory.studio.ldapservers.model

Examples of org.apache.directory.studio.ldapservers.model.LdapServer


        if ( view != null )
        {
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( !selection.isEmpty() )
            {
                LdapServer server = ( LdapServer ) selection.getFirstElement();
                PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn( view.getViewSite().getShell(),
                    server, LdapServersPluginConstants.PROP_SERVER_PROPERTY_PAGE, null, null );
                dialog.getShell().setText( NLS.bind( Messages.getString( "PropertiesAction.PropertiesFor" ), //$NON-NLS-1$
                    shorten( server.getName(), 30 ) ) );
                dialog.open();
            }
        }
    }
View Full Code Here


        // Getting the selection
        StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();

        if ( !selection.isEmpty() )
        {
            LdapServer server = ( LdapServer ) selection.getFirstElement();

            switch ( server.getStatus() )
            {
                case STARTED:
                    start.setEnabled( false );
                    stop.setEnabled( true );
                    break;
                case STARTING:
                    start.setEnabled( false );
                    stop.setEnabled( false );
                    break;
                case STOPPED:
                    start.setEnabled( true );
                    stop.setEnabled( false );
                    break;
                case STOPPING:
                    start.setEnabled( false );
                    stop.setEnabled( false );
                    break;
                case UNKNOWN:
                    start.setEnabled( false );
                    stop.setEnabled( false );
                    break;
            }

            openConfiguration.setEnabled( server.getLdapServerAdapterExtension().isOpenConfigurationActionEnabled() );
            delete.setEnabled( true );
            rename.setEnabled( true );
            properties.setEnabled( true );
        }
        else
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                // Creating and scheduling the job to stop the server
                StudioLdapServerJob job = new StudioLdapServerJob( new StopLdapServerRunnable( server ) );
                job.schedule();
            }
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                LdapServerAdapterExtension ldapServerAdapterExtension = server.getLdapServerAdapterExtension();
                if ( ( ldapServerAdapterExtension != null ) && ( ldapServerAdapterExtension.getInstance() != null ) )
                {
                    LdapServerAdapter ldapServerAdapter = ldapServerAdapterExtension.getInstance();

                    try
                    {

                        // Getting the ports already in use
                        String[] portsAlreadyInUse = ldapServerAdapter.checkPortsBeforeServerStart( server );
                        if ( ( portsAlreadyInUse == null ) || ( portsAlreadyInUse.length > 0 ) )
                        {
                            String title = null;
                            String message = null;

                            if ( portsAlreadyInUse.length == 1 )
                            {
                                title = Messages.getString( "StartAction.PortInUse" ); //$NON-NLS-1$
                                message = NLS
                                    .bind(
                                        Messages.getString( "StartAction.PortOfProtocolInUse" ), new String[] { portsAlreadyInUse[0] } ); //$NON-NLS-1$
                            }
                            else
                            {
                                title = Messages.getString( "StartAction.PortsInUse" ); //$NON-NLS-1$
                                message = Messages.getString( "StartAction.PortsOfProtocolsInUse" ); //$NON-NLS-1$
                                for ( String portAlreadyInUse : portsAlreadyInUse )
                                {
                                    message += "\n    - " + portAlreadyInUse; //$NON-NLS-1$
                                }
                            }

                            message += "\n\n" + Messages.getString( "StartAction.Continue" ); //$NON-NLS-1$ //$NON-NLS-2$

                            MessageDialog dialog = new MessageDialog( view.getSite().getShell(), title, null, message,
                                MessageDialog.WARNING, new String[]
                                    { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, MessageDialog.OK );
                            if ( dialog.open() == MessageDialog.CANCEL )
                            {
                                return;
                            }
                        }

                        // Creating and scheduling the job to start the server
                        StudioLdapServerJob job = new StudioLdapServerJob( new StartLdapServerRunnable( server ) );
                        job.schedule();
                    }
                    catch ( Exception e )
                    {
                        // Showing an error in case no LDAP Server Adapter can be found
                        MessageDialog
                            .openError( view.getSite().getShell(),
                                Messages.getString( "StartAction.ErrorStartingServer" ), //$NON-NLS-1$
                                NLS.bind(
                                    Messages.getString( "StartAction.ServerCanNotBeStarted" ) + "\n" + Messages.getString( "StartAction.Cause" ), server.getName(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                    e.getMessage() ) );
                    }
                }
                else
                {
                    // Showing an error in case no LDAP Server Adapter can be found
                    MessageDialog.openError( view.getSite().getShell(),
                        Messages.getString( "StartAction.NoLdapServerAdapter" ), //$NON-NLS-1$
                        NLS.bind( Messages.getString( "StartAction.ServerCanNotBeStarted" ) + "\n" //$NON-NLS-1$ //$NON-NLS-2$
                            + Messages.getString( "StartAction.NoLdapServerAdapterCouldBeFound" ), server.getName() ) ); //$NON-NLS-1$
                }
            }
        }
    }
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                // Checking that the server is really an ApacheDS 1.5.5 server
                if ( !EXTENSION_ID.equalsIgnoreCase( server.getLdapServerAdapterExtension().getId() ) )
                {
                    String message = Messages.getString( "CreateConnectionAction.UnableReadServerConfiguration" ) //$NON-NLS-1$
                        + "\n\n" //$NON-NLS-1$
                        + Messages.getString( "CreateConnectionAction.NotA155Server" ); //$NON-NLS-1$
View Full Code Here

        // Getting the configuration page (in any
        NewServerWizardConfigurationPage configurationPage = getConfigurationPage();

        // Creating the new server
        final LdapServer server = new LdapServer();
        server.setName( serverName );
        server.setLdapServerAdapterExtension( adapterExtension );

        // Saving the configuration page (is any)
        if ( configurationPage != null )
        {
            configurationPage.saveConfiguration( server );
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                // Checking that the server is really an ApacheDS 1.5.3 server
                if ( !EXTENSION_ID.equalsIgnoreCase( server.getLdapServerAdapterExtension().getId() ) )
                {
                    String message = Messages.getString( "CreateConnectionAction.UnableReadServerConfiguration" ) //$NON-NLS-1$
                        + "\n\n" //$NON-NLS-1$
                        + Messages.getString( "CreateConnectionAction.NotA153Server" ); //$NON-NLS-1$
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                // Checking that the server is really an ApacheDS 2.0.0 server
                if ( !EXTENSION_ID.equalsIgnoreCase( server.getLdapServerAdapterExtension().getId() ) )
                {
                    String message = Messages.getString( "CreateConnectionAction.UnableReadServerConfiguration" ) //$NON-NLS-1$
                        + "\n\n" //$NON-NLS-1$
                        + Messages.getString( "CreateConnectionAction.NotA200Server" ); //$NON-NLS-1$
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                // Checking that the server is really an ApacheDS 2.0.0 server
                if ( !EXTENSION_ID.equalsIgnoreCase( server.getLdapServerAdapterExtension().getId() ) )
                {
                    String message = Messages.getString( "CreateConnectionAction.UnableReadServerConfiguration" ) //$NON-NLS-1$
                        + "\n\n" //$NON-NLS-1$
                        + Messages.getString( "CreateConnectionAction.NotA200Server" ); //$NON-NLS-1$
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                LdapServer server = ( LdapServer ) selection.getFirstElement();

                // Checking that the server is really an ApacheDS 1.5.6 server
                if ( !EXTENSION_ID.equalsIgnoreCase( server.getLdapServerAdapterExtension().getId() ) )
                {
                    String message = Messages.getString( "CreateConnectionAction.UnableReadServerConfiguration" ) //$NON-NLS-1$
                        + "\n\n" //$NON-NLS-1$
                        + Messages.getString( "CreateConnectionAction.NotA156Server" ); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapservers.model.LdapServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.