Package org.apache.directory.studio.connection.core

Examples of org.apache.directory.studio.connection.core.Connection


     */
    public void select( Object obj )
    {
        if ( obj instanceof Connection )
        {
            Connection connection = ( Connection ) obj;

            mainWidget.getViewer().reveal( connection );
            mainWidget.getViewer().refresh( connection, true );
            mainWidget.getViewer().setSelection( new StructuredSelection( connection ), true );
        }
View Full Code Here


    public void resolve()
    {
        // get referral connection, exit if canceled
        List<LdapURL> urls = new ArrayList<LdapURL>();
        urls.add( url );
        Connection referralConnection = ConnectionCorePlugin.getDefault().getReferralHandler().getReferralConnection(
            urls );
        if ( referralConnection == null )
        {
            state = State.CANCELED;
            entryDoesNotExist = true;
        }
        else
        {
            state = State.RESOLVED;
            super.connectionId = referralConnection.getId();

            InitializeAttributesRunnable iar = new InitializeAttributesRunnable( this );
            new StudioBrowserJob( iar ).execute();
        }
    }
View Full Code Here

     * @return a test connection
     */
    private Connection getTestConnection()
    {
        ConnectionParameter cp = connectionParameterPageModifyListener.getTestConnectionParameters();
        Connection conn = new Connection( cp );
        return conn;
    }
View Full Code Here

        fetchBaseDnsButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                Connection connection = getTestConnection();
                IBrowserConnection browserConnection = new BrowserConnection( connection );

                FetchBaseDNsRunnable runnable = new FetchBaseDNsRunnable( browserConnection );
                IStatus status = RunnableContextRunner.execute( runnable, runnableContext, true );
                if ( status.isOK() )
View Full Code Here

    private void bindCurrentPassword()
    {
        if ( !"".equals( testPasswordText.getText() ) && entry != null //$NON-NLS-1$
            && entry.getBrowserConnection().getConnection() != null )
        {
            Connection connection = ( Connection ) entry.getBrowserConnection().getConnection().clone();
            connection.getConnectionParameter().setName( null );
            connection.getConnectionParameter().setBindPrincipal( entry.getDn().getUpName() );
            connection.getConnectionParameter().setBindPassword( testPasswordText.getText() );
            connection.getConnectionParameter().setAuthMethod( AuthenticationMethod.SIMPLE );

            CheckBindRunnable runnable = new CheckBindRunnable( connection );
            IStatus status = RunnableContextRunner.execute( runnable, null, true );
            if ( status.isOK() )
            {
View Full Code Here

            return connection;
        }
        else if ( getSelectedConnections().length == 1 )
        {
            Connection connection = getSelectedConnections()[0];
            IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
                .getBrowserConnection( connection );
            return browserConnection;
        }
        else if ( getSelectedEntries().length == 1 )
View Full Code Here

    }


    static Connection getConnection( Object element )
    {
        Connection connection = null;
        if ( element instanceof IAdaptable )
        {
            connection = ( Connection ) ( ( IAdaptable ) element ).getAdapter( Connection.class );
        }
        return connection;
View Full Code Here

        {
            return ConnectionUIPlugin.getDefault().getImage( ConnectionUIConstants.IMG_CONNECTION_FOLDER );
        }
        else if ( obj instanceof Connection )
        {
            Connection conn = ( Connection ) obj;
            if ( ( conn.getEncryptionMethod() == EncryptionMethod.LDAPS )
                || ( conn.getEncryptionMethod() == EncryptionMethod.START_TLS ) )
            {
                return conn.getJNDIConnectionWrapper().isConnected() ? ConnectionUIPlugin.getDefault().getImage(
                    ConnectionUIConstants.IMG_CONNECTION_SSL_CONNECTED ) : ConnectionUIPlugin.getDefault().getImage(
                    ConnectionUIConstants.IMG_CONNECTION_SSL_DISCONNECTED );
            }
            else
            {
                return conn.getJNDIConnectionWrapper().isConnected() ? ConnectionUIPlugin.getDefault().getImage(
                    ConnectionUIConstants.IMG_CONNECTION_CONNECTED ) : ConnectionUIPlugin.getDefault().getImage(
                    ConnectionUIConstants.IMG_CONNECTION_DISCONNECTED );
            }
        }
        else
View Full Code Here

    protected Control createContents( Composite parent )
    {
        PlatformUI.getWorkbench().getHelpSystem().setHelp( parent,
            ConnectionUIConstants.PLUGIN_ID + "." + "tools_connection_properties" ); //$NON-NLS-1$ //$NON-NLS-2$

        Connection connection = getConnection( getElement() );
        if ( connection != null )
        {
            super
                .setMessage( Messages.getString( "ConnectionPropertyPage.Connection" ) + Utils.shorten( connection.getName(), 30 ) ); //$NON-NLS-1$

            pages = ConnectionParameterPageManager.getConnectionParameterPages();

            tabFolder = new TabFolder( parent, SWT.TOP );

            tabs = new TabItem[pages.length];
            for ( int i = 0; i < pages.length; i++ )
            {
                Composite composite = new Composite( tabFolder, SWT.NONE );
                GridLayout gl = new GridLayout( 1, false );
                composite.setLayout( gl );

                pages[i].init( composite, this, connection.getConnectionParameter() );

                tabs[i] = new TabItem( tabFolder, SWT.NONE );
                tabs[i].setText( pages[i].getPageName() );
                tabs[i].setControl( composite );
            }
View Full Code Here

     * @see org.eclipse.jface.preference.PreferencePage#performOk()
     */
    public boolean performOk()
    {
        // get current connection parameters
        Connection connection = ( Connection ) getConnection( getElement() );

        // save modified parameters
        boolean parametersModified = false;
        boolean reconnectionRequired = false;
        ConnectionParameter connectionParameter = new ConnectionParameter();
        connectionParameter.setId( connection.getConnectionParameter().getId() );
        for ( int i = 0; i < pages.length; i++ )
        {
            pages[i].saveParameters( connectionParameter );
            pages[i].saveDialogSettings();
            parametersModified |= pages[i].areParametersModifed();
            reconnectionRequired |= pages[i].isReconnectionRequired();
        }

        if ( parametersModified )
        {
            // update connection parameters
            connection.setConnectionParameter( connectionParameter );

            if ( reconnectionRequired )
            {
                // close connection
                new StudioConnectionJob( new CloseConnectionsRunnable( connection ) ).execute();
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.connection.core.Connection

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.