Examples of IBrowserConnection


Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

        // update shared working copy
        try
        {
            LdifContentRecord modifiedRecord = ( LdifContentRecord ) records[0];
            IBrowserConnection browserConnection = input.getSharedWorkingCopy( editor ).getBrowserConnection();
            DummyEntry modifiedEntry = ModelConverter.ldifContentRecordToEntry( modifiedRecord, browserConnection );
            ( ( DummyEntry ) input.getSharedWorkingCopy( editor ) ).setDn( modifiedEntry.getDn() );
            new CompoundModification().replaceAttributes( modifiedEntry, input.getSharedWorkingCopy( editor ), this );
        }
        catch ( InvalidNameException e )
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

        String[] values = HistoryUtils.load( VALUE_HISTORY_DIALOGSETTING_KEY );
        quickSearchValueCombo.setItems( values );
        quickSearchValueCombo.select( 0 );
        quickSearchValuePP.setProposals( Arrays.asList( values ) );

        IBrowserConnection conn = entry.getBrowserConnection();

        QuickSearch quickSearch = new QuickSearch( entry );
        quickSearch.setName( "Quick Search" );
        quickSearch.setBrowserConnection( conn );
        quickSearch.setSearchBase( entry.getDn() );
        quickSearch.setReturningAttributes( ISearch.NO_ATTRIBUTES );
        quickSearch.setAliasesDereferencingMethod( conn.getAliasesDereferencingMethod() );
        quickSearch.setReferralsHandlingMethod( conn.getReferralsHandlingMethod() );
        quickSearch.setCountLimit( conn.getCountLimit() );
        quickSearch.setTimeLimit( conn.getTimeLimit() );
        quickSearch.setScope( quickSearchScopeButton.getSelection() ? SearchScope.SUBTREE : SearchScope.ONELEVEL );

        StringBuffer filter = new StringBuffer();
        filter.append( "(" );
        if ( "!=".equals( quickSearchOperatorCombo.getText() ) )
        {
            filter.append( "!(" );
        }
        filter.append( quickSearchAttributeCombo.getText() );
        filter.append( "!=".equals( quickSearchOperatorCombo.getText() ) ? "=" : quickSearchOperatorCombo.getText() );

        // only escape '\', '(', ')', and '\u0000'
        // don't escape '*' to allow substring search
        String value = quickSearchValueCombo.getText();
        value = value.replaceAll( "\\\\", "\\\\5c" );
        value = value.replaceAll( "\u0000", "\\\\00" );
        value = value.replaceAll( "\\(", "\\\\28" );
        value = value.replaceAll( "\\)", "\\\\29" );
        filter.append( value );
        if ( "!=".equals( quickSearchOperatorCombo.getText() ) )
        {
            filter.append( ")" );
        }
        filter.append( ")" );
        quickSearch.setFilter( filter.toString() );

        // set new quick search
        conn.getSearchManager().setQuickSearch( quickSearch );

        // execute quick search
        new StudioBrowserJob( new SearchRunnable( new ISearch[]
            { quickSearch } ) ).execute();
    }
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

     */
    @Test
    public void testCopyPasteSearchBetweenConnections() throws Exception
    {
        BrowserConnectionManager browserConnectionManager = BrowserCorePlugin.getDefault().getConnectionManager();
        IBrowserConnection browserConnection1 = browserConnectionManager.getBrowserConnectionByName( "SearchTest1" );
        IBrowserConnection browserConnection2 = browserConnectionManager.getBrowserConnectionByName( "SearchTest2" );
        assertEquals( 0, browserConnection1.getSearchManager().getSearches().size() );
        assertEquals( 0, browserConnection2.getSearchManager().getSearches().size() );

        SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot );
        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );

        // create a search for in connection 1
        connectionsTree.select( "SearchTest1" );
        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system" );
        ContextMenuHelper.clickContextMenu( browserTree, "New", "New Search..." );
        bot.shell( "Search" );
        //SWTBotAssert.assertEnabled( bot.textWithLabel( "Connection:" ) );
        //SWTBotAssert.assertText( "SearchTest1", bot.textWithLabel( "Connection:" ) );
        bot.textWithLabel( "Search Name:" ).setText( "Search all persons" );
        bot.comboBoxWithLabel( "Filter:" ).setText( "(objectClass=person)" );
        //bot.radioWithLabelInGroup( "Subtree", "Scope" ).click();
        bot.button( "Search" ).click();
        SWTBotUtils.selectEntry( bot, browserTree, false, "Searches", "Search all persons" );

        // assert browser connection in searches
        assertEquals( 1, browserConnection1.getSearchManager().getSearches().size() );
        assertEquals( browserConnection1, browserConnection1.getSearchManager().getSearches().get( 0 )
            .getBrowserConnection() );
        assertEquals( 0, browserConnection2.getSearchManager().getSearches().size() );

        // copy/paste the created search from connection 1 to connection 2
        ContextMenuHelper.clickContextMenu( browserTree, "Copy Search" );
        connectionsTree.select( "SearchTest2" );
        SWTBotUtils.selectEntry( bot, browserTree, false, "Searches" );
        ContextMenuHelper.clickContextMenu( browserTree, "Paste Search" );
        bot.shell( "Properties for Search all persons" );
        //SWTBotAssert.assertNotEnabled( bot.textWithLabel( "Connection:" ) );
        //SWTBotAssert.assertText( "SearchTest2", bot.textWithLabel( "Connection:" ) );
        bot.button( "Cancel" ).click();

        // assert browser connection in searches
        assertEquals( 1, browserConnection1.getSearchManager().getSearches().size() );
        assertEquals( browserConnection1, browserConnection1.getSearchManager().getSearches().get( 0 )
            .getBrowserConnection() );
        assertEquals( 1, browserConnection2.getSearchManager().getSearches().size() );
        assertEquals( browserConnection2, browserConnection2.getSearchManager().getSearches().get( 0 )
            .getBrowserConnection() );
    }
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

            for ( IEditorReference ref : activePage.getEditorReferences() )
            {
                IEntryEditor editor = getEntryEditor( ref );
                if ( editor != null && editor.getEntryEditorInput().getResolvedEntry() != null )
                {
                    IBrowserConnection bc = editor.getEntryEditorInput().getResolvedEntry().getBrowserConnection();
                    if ( connection.equals( bc.getConnection() ) )
                    {
                        editorReferences.add( ref );
                    }
                }
            }
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

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

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

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

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

    /**
     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionOpened(org.apache.directory.studio.connection.core.Connection)
     */
    public void connectionOpened( Connection connection )
    {
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );

        // expand viewer
        viewer.refresh( browserConnection );
        viewer.expandToLevel( 2 );

        // expand root DSE to show base entries
        IRootDSE rootDSE = browserConnection.getRootDSE();
        viewer.expandToLevel( rootDSE, 1 );

        // expand base entries, if requested
        if ( view.getConfiguration().getPreferences().isExpandBaseEntries() )
        {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

    /**
     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionClosed(org.apache.directory.studio.connection.core.Connection)
     */
    public void connectionClosed( Connection connection )
    {
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );

        viewer.collapseAll();
        connectionToExpandedElementsMap.remove( browserConnection );
        connectionToSelectedElementMap.remove( browserConnection );
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

     */
    @Test
    public void testBookmark() throws Exception
    {
        // create a bookmark
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );
        browserConnection.getBookmarkManager().addBookmark(
            new Bookmark( browserConnection, new LdapDN( "uid=user.1,ou=users,ou=system" ), "Existing Bookmark" ) );

        // select the bookmark
        browserViewBot.selectEntry( "Bookmarks", "Existing Bookmark" );

View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

    public IEntry cloneEntry( IEntry entry )
    {
        try
        {
            EventRegistry.suspendEventFiringInCurrentThread();
            IBrowserConnection browserConnection = entry.getBrowserConnection();
            LdifContentRecord record = ModelConverter.entryToLdifContentRecord( entry );
            IEntry clonedEntry = ModelConverter.ldifContentRecordToEntry( record, browserConnection );
            return clonedEntry;
        }
        catch ( InvalidNameException e )
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

                        {
                            LdapDN dn = JNDIUtils.getDn( sr );
                            IEntry entry = null;

                            Connection resultConnection = sr.getConnection();
                            IBrowserConnection resultBrowserConnection = BrowserCorePlugin.getDefault()
                                .getConnectionManager().getBrowserConnection( resultConnection );
                            if ( resultBrowserConnection == null )
                            {
                                resultBrowserConnection = browserConnection;
                            }

                            // get entry from cache or create it
                            entry = resultBrowserConnection.getEntryFromCache( dn );
                            if ( entry == null )
                            {
                                entry = createAndCacheEntry( resultBrowserConnection, dn, monitor );
                            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.