Package org.apache.directory.studio.ldapbrowser.core.model

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


        // update state
        String url = ""; //$NON-NLS-1$
        boolean enabled = true;
        if ( input != null && input instanceof ISearch )
        {
            ISearch search = ( ISearch ) input;

            if ( filteredAndSortedElements.length < elements.length )
            {
                url += filteredAndSortedElements.length + Messages.getString( "SearchResultEditorContentProvider.Of" ); //$NON-NLS-1$
            }

            if ( search.getSearchResults() == null )
            {
                url += Messages.getString( "SearchResultEditorContentProvider.SearchNotPerformed" ); //$NON-NLS-1$
                enabled = false;
            }
            else if ( search.getSearchResults().length == 1 )
            {
                url += search.getSearchResults().length
                    + Messages.getString( "SearchResultEditorContentProvider.Result" ); //$NON-NLS-1$
            }
            else
            {
                url += search.getSearchResults().length
                    + Messages.getString( "SearchResultEditorContentProvider.Results" ); //$NON-NLS-1$
            }

            // url += search.getURL();
            url += Messages.getString( "SearchResultEditorContentProvider.SearchBase" ) + search.getSearchBase().getUpName() + "  -  "; //$NON-NLS-1$ //$NON-NLS-2$
            url += Messages.getString( "SearchResultEditorContentProvider.Filter" ) + search.getFilter(); //$NON-NLS-1$

            boolean showDn = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
                BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN )
                || search.getReturningAttributes().length == 0;
            configuration.getFilter().inputChanged( search, showDn );
            configuration.getSorter().inputChanged( search, showDn );
        }
        else
        {
View Full Code Here


     */
    public Object[] getElements( Object inputElement )
    {
        if ( inputElement != null && inputElement instanceof ISearch )
        {
            ISearch search = ( ISearch ) inputElement;
            return search.getSearchResults() != null ? search.getSearchResults() : new Object[0];
        }
        else
        {
            return new Object[]
                {};
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public String getText()
    {
        ISearch search = getSearch();
        if ( search != null )
        {
            String connectionName = search.getBrowserConnection().getConnection() != null ? " - " //$NON-NLS-1$
                + search.getBrowserConnection().getConnection().getName() : ""; //$NON-NLS-1$
            return NLS.bind(
                Messages.getString( "SearchResultEditorNavigationLocation.Search" ), new String[] { search.getName() } ) //$NON-NLS-1$
                + connectionName;
        }
        else
        {
            return super.getText();
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void saveState( IMemento memento )
    {
        ISearch search = getSearch();
        memento.putString( "SEARCH", search.getName() ); //$NON-NLS-1$
        memento.putString( "CONNECTION", search.getBrowserConnection().getConnection().getId() ); //$NON-NLS-1$
    }
View Full Code Here

     */
    public void restoreState( IMemento memento )
    {
        IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById(
            memento.getString( "CONNECTION" ) ); //$NON-NLS-1$
        ISearch search = connection.getSearchManager().getSearch( memento.getString( "SEARCH" ) ); //$NON-NLS-1$
        super.setInput( new SearchResultEditorInput( search ) );
    }
View Full Code Here

        {
            return false;
        }

        SearchResultEditorNavigationLocation location = ( SearchResultEditorNavigationLocation ) currentLocation;
        ISearch other = location.getSearch();
        ISearch search = getSearch();

        if ( other == null && search == null )
        {
            return true;
        }
        else if ( other == null || search == null )
        {
            return false;
        }
        else
        {
            return search.equals( other );
        }
    }
View Full Code Here

    {
        Object editorInput = getInput();
        if ( editorInput != null && editorInput instanceof SearchResultEditorInput )
        {
            SearchResultEditorInput searchResultEditorInput = ( SearchResultEditorInput ) editorInput;
            ISearch search = searchResultEditorInput.getSearch();
            if ( search != null )
            {
                return search;
            }
        }
View Full Code Here

        super.setInput( input );

        if ( input instanceof SearchResultEditorInput && universalListener != null )
        {
            SearchResultEditorInput srei = ( SearchResultEditorInput ) input;
            ISearch search = srei.getSearch();

            setSearchResultEditorWidgetInput( srei );

            if ( search != null )
            {
View Full Code Here


    private void setSearchResultEditorWidgetInput( SearchResultEditorInput srei )
    {
        // clone search, search results, entries
        ISearch search = srei.getSearch();
        workingCopy = search != null ? ( ISearch ) search.clone() : search;
        if ( search != null && search.getSearchResults() != null )
        {
            ISearchResult[] searchResults = search.getSearchResults();
            ISearchResult[] clonedSearchResults = new ISearchResult[searchResults.length];
            for ( int i = 0; i < searchResults.length; i++ )
            {
                IEntry entry = searchResults[i].getEntry();
                IEntry clonedEntry = new CompoundModification().cloneEntry( entry );
View Full Code Here

            BrowserSearchResultPage container = ( BrowserSearchResultPage ) obj;
            return "[" + ( container.getFirst() + 1 ) + "..." + ( container.getLast() + 1 ) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        else if ( obj instanceof ISearch )
        {
            ISearch search = ( ISearch ) obj;
            ISearchResult[] results = search.getSearchResults();
            SearchContinuation[] scs = search.getSearchContinuations();
            StringBuffer append = new StringBuffer( search.getName() );
            if ( results != null && scs != null )
            {
                append.append( " (" ).append( results.length + scs.length ); //$NON-NLS-1$
                if ( search.isCountLimitExceeded() )
                {
                    append.append( "+" ); //$NON-NLS-1$
                }
                append.append( ")" ); //$NON-NLS-1$
            }
            return append.toString();
        }
        else if ( obj instanceof IBookmark )
        {
            IBookmark bookmark = ( IBookmark ) obj;
            return bookmark.getName();
        }
        else if ( obj instanceof ISearchResult )
        {
            ISearchResult sr = ( ISearchResult ) obj;

            if ( sr.getEntry() instanceof IContinuation )
            {
                return sr.getEntry().getUrl().toString();
            }
            else if ( sr.getEntry().hasParententry() || sr.getEntry() instanceof IRootDSE )
            {
                String label = ""; //$NON-NLS-1$
                if ( sr.getEntry() instanceof IRootDSE )
                {
                    label = "Root DSE"; //$NON-NLS-1$
                }
                else if ( preferences.getSearchResultLabel() == BrowserCommonConstants.SHOW_DN )
                {
                    label = sr.getEntry().getDn().getUpName();
                }
                else if ( preferences.getSearchResultLabel() == BrowserCommonConstants.SHOW_RDN )
                {
                    label = sr.getEntry().getRdn().getUpName();
                }
                else if ( preferences.getSearchResultLabel() == BrowserCommonConstants.SHOW_RDN_VALUE )
                {
                    label = ( String ) sr.getEntry().getRdn().getUpValue();
                }

                if ( preferences.isSearchResultAbbreviate()
                    && label.length() > preferences.getSearchResultAbbreviateMaxLength() )
                {
                    label = Utils.shorten( label, preferences.getSearchResultAbbreviateMaxLength() );
                }

                return label;
            }
            else
            {
                return sr.getEntry().getDn().getUpName();
            }

        }
        else if ( obj instanceof StudioRunnableWithProgress )
        {
            StudioRunnableWithProgress runnable = ( StudioRunnableWithProgress ) obj;
            for ( Object lockedObject : runnable.getLockedObjects() )
            {
                if ( lockedObject instanceof ISearch )
                {
                    ISearch search = ( ISearch ) lockedObject;
                    if ( obj == search.getTopSearchRunnable() )
                    {
                        return Messages.getString( "BrowserLabelProvider.TopPage" ); //$NON-NLS-1$
                    }
                    else if ( obj == search.getNextSearchRunnable() )
                    {
                        return Messages.getString( "BrowserLabelProvider.NextPage" ); //$NON-NLS-1$
                    }
                }
                else if ( lockedObject instanceof IEntry )
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.ISearch

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.