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

Examples of org.apache.directory.ldapstudio.browser.core.model.IConnection


        if ( !event.getSelection().isEmpty() )
        {
            Object o = ( ( IStructuredSelection ) event.getSelection() ).getFirstElement();
            if ( o instanceof IConnection )
            {
                IConnection connection = ( IConnection ) o;
                if ( connection.isOpened() )
                {
                    if ( connection.canClose() )
                    {
                        connection.close();
                    }
                }
                else
                {
                    OpenConnectionsJob ocj = new OpenConnectionsJob( connection );
View Full Code Here


        IConnection[] connections = getConnectionsToPaste();
        if ( connections != null )
        {
            for ( int i = 0; i < connections.length; i++ )
            {
                IConnection newConnection = ( IConnection ) connections[i].clone();
                BrowserCorePlugin.getDefault().getConnectionManager().addConnection( newConnection );
            }
            return;
        }
View Full Code Here

        // only if another connection is selected
        if ( connection != this.viewer.getInput() )
        {

            IConnection currentConnection = this.viewer.getInput() instanceof IConnection ? ( IConnection ) this.viewer
                .getInput() : null;

            // save expanded elements and selection
            if ( currentConnection != null )
            {
View Full Code Here

        {
            if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
            {
                if ( event.item != null && event.item.getData() instanceof IConnection )
                {
                    IConnection overConn = ( IConnection ) event.item.getData();
                    if ( event.widget instanceof DropTarget )
                    {
                        DropTarget dropTarget = ( DropTarget ) event.widget;
                        if ( dropTarget.getControl() instanceof Table )
                        {
View Full Code Here

        {
            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 );
                    }
                }
            }
View Full Code Here

     */
    public IConnection getConnection( String name )
    {
        for ( Iterator it = this.connectionList.iterator(); it.hasNext(); )
        {
            IConnection conn = ( IConnection ) it.next();
            if ( conn.getName().equals( name ) )
            {
                return conn;
            }
        }
        return null;
View Full Code Here

    }


    public boolean performFinish()
    {
        final IConnection conn = cpw.getTestConnection();
        conn.setName( cpw.getName() );
        if ( conn != null )
        {
            BrowserCorePlugin.getDefault().getConnectionManager().addConnection( conn );
            if ( cpw.isOpenConnectionOnFinish() )
            {
View Full Code Here

        Object[][] object = new Object[connectionList.size()][3];

        Iterator connectionIterator = connectionList.iterator();
        for ( int i = 0; connectionIterator.hasNext(); i++ )
        {
            IConnection conn = ( IConnection ) connectionIterator.next();
            ConnectionParameter connectionParameters = conn.getConnectionParameter();
            ISearch[] searches = conn.getSearchManager().getSearches();
            SearchParameter[] searchParameters = new SearchParameter[searches.length];
            for ( int k = 0; k < searches.length; k++ )
            {
                searchParameters[k] = searches[k].getSearchParameter();
            }
            IBookmark[] bookmarks = conn.getBookmarkManager().getBookmarks();
            BookmarkParameter[] bookmarkParameters = new BookmarkParameter[bookmarks.length];
            for ( int k = 0; k < bookmarks.length; k++ )
            {
                bookmarkParameters[k] = bookmarks[k].getBookmarkParameter();
            }
View Full Code Here

            {
                try
                {
                    for ( int i = 0; i < object.length; i++ )
                    {
                        IConnection conn = new Connection();

                        ConnectionParameter connectionParameters = ( ConnectionParameter ) object[i][0];
                        conn.setConnectionParameter( connectionParameters );

                        if ( object[i].length > 1 )
                        {
                            SearchParameter[] searchParameters = ( SearchParameter[] ) object[i][1];
                            for ( int k = 0; k < searchParameters.length; k++ )
                            {
                                ISearch search = new Search( conn, searchParameters[k] );
                                conn.getSearchManager().addSearch( search );
                            }
                        }

                        if ( object[i].length > 2 )
                        {
                            BookmarkParameter[] bookmarkParameters = ( BookmarkParameter[] ) object[i][2];
                            for ( int k = 0; k < bookmarkParameters.length; k++ )
                            {
                                IBookmark bookmark = new Bookmark( conn, bookmarkParameters[k] );
                                conn.getBookmarkManager().addBookmark( bookmark );
                            }
                        }

                        try
                        {
                            String schemaFilename = getSchemaCacheFileName( conn.getName() );
                            FileReader reader = new FileReader( schemaFilename );
                            Schema schema = new Schema();
                            schema.loadFromLdif( reader );
                            conn.setSchema( schema );
                        }
                        catch ( Exception e )
                        {
                        }
View Full Code Here

                    return null;

                List searchList = new ArrayList();
                try
                {
                    IConnection connection = null;
                    ByteArrayInputStream in = new ByteArrayInputStream( buffer );
                    DataInputStream readIn = new DataInputStream( in );

                    do
                    {
                        if ( readIn.available() > 1 )
                        {
                            int size = readIn.readInt();
                            byte[] connectionName = new byte[size];
                            readIn.read( connectionName );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
                                new String( connectionName ) );
                        }

                        ISearch search = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            byte[] searchName = new byte[size];
                            readIn.read( searchName );
                            search = connection.getSearchManager().getSearch( new String( searchName ) );
                        }
                        else
                        {
                            return null;
                        }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.model.IConnection

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.