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

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


     */
    public String getText( Object obj )
    {
        if ( obj instanceof IEntry )
        {
            IEntry entry = ( IEntry ) obj;

            StringBuffer append = new StringBuffer();
            if ( entry instanceof IRootDSE )
            {
                append.append( "Root DSE" );
            }
            if ( entry.isChildrenInitialized() && entry.getChildrenCount() > 0 )
            {
                append.append( " (" ).append( entry.getChildrenCount() );
                if ( entry.hasMoreChildren() )
                {
                    append.append( "+" );
                }
                if ( entry.getChildrenFilter() != null )
                {
                    append.append( ", filtered" );
                }
                append.append( ")" );
            }

            if ( entry instanceof ReferralBaseEntry )
            {
                return entry.getUrl().toString() + " " + append.toString();
            }
            else if ( entry instanceof AliasBaseEntry )
            {
                return entry.getDn().toString() + " " + append.toString();
            }
            else if ( entry.hasParententry() )
            {

                String label = "";
                if ( preferences.getEntryLabel() == BrowserUIConstants.SHOW_DN )
                {
                    label = entry.getDn().toString();
                }
                else if ( preferences.getEntryLabel() == BrowserUIConstants.SHOW_RDN )
                {
                    label = entry.getRdn().toString();

                }
                else if ( preferences.getEntryLabel() == BrowserUIConstants.SHOW_RDN_VALUE )
                {
                    label = entry.getRdn().getValue();
                }

                label += append.toString();

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

                return label;
            }
            else
            {
                return entry.getDn() + append.toString();
            }
        }
        else if ( obj instanceof BrowserEntryPage )
        {
            BrowserEntryPage container = ( BrowserEntryPage ) obj;
View Full Code Here


     */
    public Image getImage( Object obj )
    {
        if ( obj instanceof IEntry )
        {
            IEntry entry = ( IEntry ) obj;
            return getImageByRdn( entry );
        }
        else if ( obj instanceof BrowserEntryPage )
        {
            return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJ_FOLDER );
        }
        else if ( obj instanceof BrowserSearchResultPage )
        {
            return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJ_FOLDER );
        }
        else if ( obj instanceof ISearch )
        {
            ISearch search = ( ISearch ) obj;
            if ( search.getConnection().isOpened() && search.getSearchResults() != null )
            {
                return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_SEARCH );
            }
            else
            {
                return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_SEARCH_UNPERFORMED );
            }
        }
        else if ( obj instanceof IBookmark )
        {
            return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_BOOKMARK );
        }
        else if ( obj instanceof ISearchResult )
        {
            ISearchResult sr = ( ISearchResult ) obj;
            IEntry entry = sr.getEntry();
            return getImageByRdn( entry );
        }
        else if ( obj instanceof BrowserCategory )
        {
            BrowserCategory category = ( BrowserCategory ) obj;
View Full Code Here

     * {@inheritDoc}
     */
    public Font getFont( Object element )
    {

        IEntry entry = null;
        if ( element instanceof IEntry )
        {
            entry = ( IEntry ) element;
        }
        else if ( element instanceof ISearchResult )
        {
            entry = ( ( ISearchResult ) element ).getEntry();
        }

        if ( entry != null )
        {
            if ( !entry.isConsistent() )
            {
                FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                    .getPreferenceStore(), BrowserUIConstants.PREFERENCE_ERROR_FONT );
                return BrowserUIPlugin.getDefault().getFont( fontData );
            }
View Full Code Here

     * {@inheritDoc}
     */
    public Color getForeground( Object element )
    {

        IEntry entry = null;
        if ( element instanceof IEntry )
        {
            entry = ( IEntry ) element;
        }
        else if ( element instanceof ISearchResult )
        {
            entry = ( ( ISearchResult ) element ).getEntry();
        }

        if ( entry != null )
        {
            if ( !entry.isConsistent() )
            {
                RGB rgb = PreferenceConverter.getColor( BrowserUIPlugin.getDefault().getPreferenceStore(),
                    BrowserUIConstants.PREFERENCE_ERROR_COLOR );
                return BrowserUIPlugin.getDefault().getColor( rgb );
            }
View Full Code Here

        if ( connectionAndDn != null )
        {
            IConnection connection = connectionAndDn.connection;
            DN dn = connectionAndDn.dn;

            IEntry entry = connection.getEntryFromCache( dn );
            if ( entry == null )
            {
                ReadEntryJob job = new ReadEntryJob( connection, dn );
                RunnableContextJobAdapter.execute( job );
                entry = job.getReadEntry();
View Full Code Here

     * @return
     *      the selected Entry
     */
    protected IEntry getEntry()
    {
        IEntry entry = null;
        if ( getSelectedEntries().length > 0 )
        {
            entry = getSelectedEntries()[0];
        }
        else if ( getSelectedSearchResults().length > 0 )
        {
            entry = getSelectedSearchResults()[0].getEntry();
        }
        else if ( getSelectedBookmarks().length > 0 )
        {
            entry = getSelectedBookmarks()[0].getEntry();
        }

        return entry != null && entry.getConnection().isOpened() ? entry : null;
    }
View Full Code Here

                    {

                        Object o = entryEditor.getMainWidget().getViewer().getInput();
                        if ( o != null && o instanceof IEntry )
                        {
                            IEntry entry = ( IEntry ) o;
                            IAttribute[] attributes = entry.getAttributes();

                            List selectionList = new ArrayList();

                            Iterator it = ( ( IStructuredSelection ) event.getSelection() ).iterator();
                            while ( it.hasNext() )
View Full Code Here

    }


    private void reloadOperationalAttributes()
    {
        IEntry entry = EntryPropertyPage.getEntry( getElement() );
        InitializeAttributesJob job = new InitializeAttributesJob( new IEntry[]
            { entry }, true );
        RunnableContextJobAdapter.execute( job );

        this.entryUpdated( entry );
View Full Code Here

    }


    private void reloadEntry()
    {
        IEntry entry = EntryPropertyPage.getEntry( getElement() );
        InitializeChildrenJob job1 = new InitializeChildrenJob( new IEntry[]
            { entry } );
        InitializeAttributesJob job2 = new InitializeAttributesJob( new IEntry[]
            { entry }, true );
        RunnableContextJobAdapter.execute( job1 );
View Full Code Here

    }


    static IEntry getEntry( Object element )
    {
        IEntry entry = null;
        if ( element instanceof IAdaptable )
        {
            entry = ( IEntry ) ( ( IAdaptable ) element ).getAdapter( IEntry.class );
        }
        return entry;
View Full Code Here

TOP

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

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.