Package org.apache.directory.ldapstudio.browser.core

Examples of org.apache.directory.ldapstudio.browser.core.ConnectionManager


     * This implementation drops the dragged connection to
     * the selected position.
     */
    public void drop( DropTargetEvent event )
    {
        ConnectionManager connectionManager = BrowserCorePlugin.getDefault().getConnectionManager();

        try
        {
            if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
            {
                // get connection to handle
                IConnection[] connections = ( IConnection[] ) event.data;
                IConnection targetConnection = ( IConnection ) event.item.getData();

                if ( event.detail == DND.DROP_MOVE )
                {
                    boolean fromTop = connectionManager.indexOf( connections[0] ) < connectionManager
                        .indexOf( targetConnection );
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        connectionManager.removeConnection( connections[i] );
                    }
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        int index = connectionManager.indexOf( targetConnection );
                        if ( fromTop )
                        {
                            index++;
                            connectionManager.addConnection( index + i, connections[i] );
                        }
                        else
                        {
                            connectionManager.addConnection( index, connections[i] );
                        }
                    }
                }
                else if ( event.detail == DND.DROP_COPY )
                {
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        IConnection newConnection = ( IConnection ) connections[i].clone();
                        int index = connectionManager.indexOf( targetConnection );
                        connectionManager.addConnection( index + i + 1, newConnection );
                    }
                }
            }
            else
            {
View Full Code Here


        }

        // init available attribute types
        this.attributeTypes2AtdMap = new TreeMap();
        this.attributeOid2AtdMap = new TreeMap();
        ConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
        IConnection[] connections = cm.getConnections();
        for ( int i = 0; i < connections.length; i++ )
        {
            Schema schema = connections[i].getSchema();
            if ( schema != null )
            {
View Full Code Here

        composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );

        // init available attribute types
        this.attributeNames2AtdMap = new TreeMap();
        this.attributeOid2AtdMap = new TreeMap();
        ConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
        IConnection[] connections = cm.getConnections();
        for ( int i = 0; i < connections.length; i++ )
        {
            Schema schema = connections[i].getSchema();
            if ( schema != null )
            {
View Full Code Here

     */
    public Object[] getElements( Object inputElement )
    {
        if ( inputElement != null && inputElement instanceof ConnectionManager )
        {
            ConnectionManager cm = ( ConnectionManager ) inputElement;
            return cm.getConnections();
        }
        else
        {
            return new Object[]
                {};
View Full Code Here

     * This implementation drops the dragged connection to
     * the selected position.
     */
    public void drop( DropTargetEvent event )
    {
        ConnectionManager connectionManager = BrowserCorePlugin.getDefault().getConnectionManager();

        try
        {
            if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
            {
                // get connection to handle
                IConnection[] connections = ( IConnection[] ) event.data;
                IConnection targetConnection = ( IConnection ) event.item.getData();

                if ( event.detail == DND.DROP_MOVE )
                {
                    boolean fromTop = connectionManager.indexOf( connections[0] ) < connectionManager
                        .indexOf( targetConnection );
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        connectionManager.removeConnection( connections[i] );
                    }
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        int index = connectionManager.indexOf( targetConnection );
                        if ( fromTop )
                        {
                            index++;
                            connectionManager.addConnection( index + i, connections[i] );
                        }
                        else
                        {
                            connectionManager.addConnection( index, connections[i] );
                        }
                    }
                }
                else if ( event.detail == DND.DROP_COPY )
                {
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        IConnection newConnection = ( IConnection ) connections[i].clone();
                        int index = connectionManager.indexOf( targetConnection );
                        connectionManager.addConnection( index + i + 1, newConnection );
                    }
                }
            }
            else
            {
View Full Code Here

    }


    public void drop( DropTargetEvent event )
    {
        ConnectionManager connectionManager = BrowserCorePlugin.getDefault().getConnectionManager();

        try
        {
            if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
            {
                // get connection to handle
                IConnection[] connections = ( IConnection[] ) event.data;
                IConnection targetConnection = ( IConnection ) event.item.getData();

                if ( event.detail == DND.DROP_MOVE )
                {
                    boolean fromTop = connectionManager.indexOf( connections[0] ) < connectionManager
                        .indexOf( targetConnection );
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        connectionManager.removeConnection( connections[i] );
                    }
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        int index = connectionManager.indexOf( targetConnection );
                        if ( fromTop )
                        {
                            index++;
                            connectionManager.addConnection( index + i, connections[i] );
                        }
                        else
                        {
                            connectionManager.addConnection( index, connections[i] );
                        }

                    }
                }
                else if ( event.detail == DND.DROP_COPY )
                {
                    for ( int i = 0; i < connections.length; i++ )
                    {
                        IConnection newConnection = ( IConnection ) connections[i].clone();
                        int index = connectionManager.indexOf( targetConnection );
                        connectionManager.addConnection( index + i + 1, newConnection );
                    }
                }
            }
            else
            {
View Full Code Here

    public Object[] getElements( Object inputElement )
    {
        if ( inputElement != null && inputElement instanceof ConnectionManager )
        {
            ConnectionManager cm = ( ConnectionManager ) inputElement;
            return cm.getConnections();
        }
        else
        {
            return new Object[]
                {};
View Full Code Here

     */
    public Object[] getElements( Object inputElement )
    {
        if ( inputElement != null && inputElement instanceof ConnectionManager )
        {
            ConnectionManager cm = ( ConnectionManager ) inputElement;
            return cm.getConnections();
        }
        else
        {
            return new Object[]
                {};
View Full Code Here

        composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );

        // init available attribute types
        this.attributeNames2AtdMap = new TreeMap();
        this.attributeOid2AtdMap = new TreeMap();
        ConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
        IConnection[] connections = cm.getConnections();
        for ( int i = 0; i < connections.length; i++ )
        {
            Schema schema = connections[i].getSchema();
            if ( schema != null )
            {
View Full Code Here

        }

        // init available attribute types
        this.attributeTypes2AtdMap = new TreeMap();
        this.attributeOid2AtdMap = new TreeMap();
        ConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
        IConnection[] connections = cm.getConnections();
        for ( int i = 0; i < connections.length; i++ )
        {
            Schema schema = connections[i].getSchema();
            if ( schema != null )
            {
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.ConnectionManager

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.