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

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


    public Object[] getElements( Object inputElement )
    {

        if ( inputElement != null && inputElement instanceof IEntry )
        {
            IEntry entry = ( IEntry ) inputElement;

            if ( !entry.isAttributesInitialized() && entry.isDirectoryEntry() )
            {
                boolean soa = BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
                    BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES );
                InitializeAttributesJob job = new InitializeAttributesJob( new IEntry[]
                    { entry }, soa );
                job.execute();
                return new Object[0];
            }
            else
            {
                IAttribute[] attributes = entry.getAttributes();
                Object[] values = getValues( attributes );
                return values;
            }
        }
        else if ( inputElement != null && inputElement instanceof AttributeHierarchy )
View Full Code Here


     */
    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 ) || entry.getChildrenFilter() != null )
            {
                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 instanceof BaseDNEntry )
            {
                return entry.getDn().toString() + " " + append.toString();
            }
            else if ( entry.hasParententry() )
            {

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

                }
                else if ( preferences.getEntryLabel() == BrowserCommonConstants.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 BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_SEARCH );
            }
            else
            {
                return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_SEARCH_UNPERFORMED );
            }
        }
        else if ( obj instanceof IBookmark )
        {
            return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.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( BrowserCommonActivator.getDefault()
                    .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_ERROR_FONT );
                return BrowserCommonActivator.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( BrowserCommonActivator.getDefault().getPreferenceStore(),
                    BrowserCommonConstants.PREFERENCE_ERROR_COLOR );
                return BrowserCommonActivator.getDefault().getColor( rgb );
            }
View Full Code Here

        {
            return ( ( BrowserEntryPage ) child ).getParent();
        }
        else if ( child instanceof IEntry )
        {
            IEntry parentEntry = ( ( IEntry ) child ).getParententry();
            if ( parentEntry == null )
            {
                if ( connectionToCategoriesMap.get( ( ( IEntry ) child ).getConnection() ) != null )
                {
                    return connectionToCategoriesMap.get( ( ( IEntry ) child ).getConnection() )[0];
View Full Code Here

            return entryList.toArray();
        }
        else if ( parent instanceof IEntry )
            {
                final IEntry parentEntry = ( IEntry ) parent;

            if ( !parentEntry.isChildrenInitialized() && parentEntry.isDirectoryEntry() )
            {
                new InitializeChildrenJob( new IEntry[]
                    { parentEntry } ).execute();
                return new String[]
                    { "Fetching Entries..." };
            }

            int childrenCount = parentEntry.getChildrenCount();
            if ( childrenCount <= preferences.getFoldingSize() || !preferences.isUseFolding() )
            {
                if ( entryToEntryPagesMap.containsKey( parentEntry ) )
                {
                    entryToEntryPagesMap.remove( parentEntry );
                }

                IEntry[] entries = parentEntry.getChildren();
                if ( entries == null )
                {
                    return new String[]
                        { "Fetching Entries..." };
                }
View Full Code Here

     */
    public boolean hasChildren( Object parent )
    {
        if ( parent instanceof IEntry )
        {
            IEntry parentEntry = ( IEntry ) parent;
            return parentEntry.hasChildren()
                || ( BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean(
                    BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS ) && ( parentEntry.isAlias() || parentEntry
                    .isReferral() ) );
        }
        else if ( parent instanceof BrowserEntryPage )
        {
            return true;
View Full Code Here

    protected void runNotification()
    {
        for ( int pi = 0; pi < entries.length; pi++ )
        {
            IEntry parent = entries[pi];
            if ( parent.getConnection() != null && entries[pi].getConnection().isOpened() && parent.isDirectoryEntry() )
            {
                EventRegistry.fireEntryUpdated( new AttributesInitializedEvent( parent ), this );
            }
        }
    }
View Full Code Here

            for ( int v = 0; v < values.length; v++ )
            {
                attributeDescriptions[v] = attributeDescription;
                rawValues[v] = values[v].getRawValue();
            }
            IEntry entry = getSelectedAttributeHierarchies()[0].getAttribute().getEntry();

            new CreateValuesJob( entry, attributeDescriptions, rawValues ).execute();
        }
    }
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.