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

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


    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


    public String getText()
    {
        IEntry[] entries = getEntries();
        ISearch[] searches = getSearches();
        IEntry entryInput = getEntryInput();
        ISearch searchInput = getSearchInput();

        if ( entries.length > 0 && searches.length == 0 && entryInput == null && searchInput == null )
        {
            return "Reload Attributes and Children";
        }
        else if ( searches.length > 0 && entries.length == 0 && entryInput == null && searchInput == null )
        {
            boolean searchAgain = true;
            for ( int i = 0; i < searches.length; i++ )
            {
                if ( searches[i].getSearchResults() == null )
                {
                    searchAgain = false;
                    break;
                }
            }
            if ( searchAgain )
            {
                return "Search Again";
            }
            else
            {
                return searches.length == 1 ? "Perform Search" : "Perform Searches";
            }
        }
        else if ( entryInput != null && searches.length == 0 && entries.length == 0 && searchInput == null )
        {
            return "Reload Attributes";
        }
        else if ( searchInput != null && searches.length == 0 && entryInput == null )
        {
            return searchInput.getSearchResults() == null ? "Perform Search" : "Search Again";
        }
        else
        {
            return "Refresh";
        }
View Full Code Here

    public void run()
    {
        IEntry[] entries = getEntries();
        ISearch[] searches = getSearches();
        IEntry entryInput = getEntryInput();
        ISearch searchInput = getSearchInput();
        boolean soa = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
            BrowserUIConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES );

        if ( entries.length > 0 )
        {
View Full Code Here

    public boolean isEnabled()
    {
        IEntry[] entries = getEntries();
        ISearch[] searches = getSearches();
        IEntry entryInput = getEntryInput();
        ISearch searchInput = getSearchInput();

        return entries.length > 0 || searches.length > 0 || entryInput != null || searchInput != null;
    }
View Full Code Here

            && connections[0].isOpened()
            || searches.length + entries.length + searchResults.length + bookmarks.length + attributes.length
                + values.length > 0 )
        {

            ISearch search = SelectionUtils.getExampleSearch( selection );
            search.setName( null );
            this.connection = search.getConnection();

            applyOnPage = new BatchOperationApplyOnWizardPage( BatchOperationApplyOnWizardPage.class.getName(), this );
            addPage( applyOnPage );

            typePage = new BatchOperationTypeWizardPage( BatchOperationTypeWizardPage.class.getName(), this );
View Full Code Here

            DN[] dns = applyOnPage.getApplyOnDns();
            if ( dns == null )
            {
                if ( applyOnPage.getApplyOnSearch() != null )
                {
                    ISearch search = applyOnPage.getApplyOnSearch();
                    if ( search.getConnection() != null )
                    {
                        SearchJob job = new SearchJob( new ISearch[]
                            { search } );
                        RunnableContextJobAdapter.execute( job, getContainer() );
                        if ( job.getExternalResult().isOK() )
                        {
                            ISearchResult[] srs = search.getSearchResults();
                            dns = new DN[srs.length];
                            for ( int i = 0; i < srs.length; i++ )
                            {
                                dns[i] = srs[i].getDn();
                            }
View Full Code Here

     * @return a prototype search
     */
    public static ISearch getExampleSearch( ISelection selection )
    {

        ISearch exampleSearch = new Search();
        String oldName = exampleSearch.getSearchParameter().getName();
        exampleSearch.getSearchParameter().setName( null );
        exampleSearch.setScope( ISearch.SCOPE_SUBTREE );

        if ( selection != null && !selection.isEmpty() && selection instanceof StructuredSelection )
        {

            Object[] objects = ( ( IStructuredSelection ) selection ).toArray();
            Comparator<Object> comparator = new Comparator<Object>()
            {
                public int compare( Object o1, Object o2 )
                {
                    if ( ( o1 instanceof IValue ) && !( o2 instanceof IValue ) )
                    {
                        return -1;
                    }
                    else if ( !( o1 instanceof IValue ) && ( o2 instanceof IValue ) )
                    {
                        return 1;
                    }
                    else if ( ( o1 instanceof IAttribute ) && !( o2 instanceof IAttribute ) )
                    {
                        return -1;
                    }
                    else if ( !( o1 instanceof IAttribute ) && ( o2 instanceof IAttribute ) )
                    {
                        return 1;
                    }
                    else if ( ( o1 instanceof AttributeHierarchy ) && !( o2 instanceof AttributeHierarchy ) )
                    {
                        return -1;
                    }
                    else if ( !( o1 instanceof AttributeHierarchy ) && ( o2 instanceof AttributeHierarchy ) )
                    {
                        return 1;
                    }
                    return 0;
                }
            };
            Arrays.sort( objects, comparator );
            Object obj = objects[0];

            if ( obj instanceof ISearch )
            {
                ISearch search = ( ISearch ) obj;
                exampleSearch = ( ISearch ) search.clone();
                exampleSearch.setName( null );
            }
            else if ( obj instanceof IEntry )
            {
                IEntry entry = ( IEntry ) obj;
View Full Code Here

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

     */
    protected void deleteSearches( ISearch[] searches )
    {
        for ( int i = 0; i < searches.length; i++ )
        {
            ISearch search = searches[i];
            search.getConnection().getSearchManager().removeSearch( search );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.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.