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

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


    }


    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


        // }
        // else {
        ISearchResult sr1 = ( ISearchResult ) o1;
        ISearchResult sr2 = ( ISearchResult ) o2;

        IEntry entry1 = sr1.getEntry();
        IEntry entry2 = sr2.getEntry();

        String attributeName;
        if ( showDn && this.sortBy == 0 )
        {
            attributeName = BrowserUIConstants.DN;
        }
        else if ( showDn && this.sortBy > 0 )
        {
            attributeName = this.search.getReturningAttributes()[this.sortBy - 1];
        }
        else
        {
            attributeName = this.search.getReturningAttributes()[this.sortBy];
        }

        if ( attributeName == BrowserUIConstants.DN )
        {
            return compare( entry1.getDn().toString(), entry2.getDn().toString() );
        }
        else
        {
            AttributeHierarchy ah1 = entry1.getAttributeWithSubtypes( attributeName );
            AttributeHierarchy ah2 = entry2.getAttributeWithSubtypes( attributeName );
            if ( ah1 == null && ah2 == null )
            {
                return this.equal();
            }
            else if ( ah1 == null && ah2 != null )
View Full Code Here

    {
        public Object[] getElements( Object inputElement )
        {
            if ( inputElement instanceof IEntry )
            {
                IEntry entry = ( IEntry ) inputElement;
                if ( !entry.isAttributesInitialized() && entry.isDirectoryEntry() )
                {
                    return new Object[]
                        {};
                }
                else
                {
                    IAttribute[] attributes = entry.getAttributes();
                    List valueList = new ArrayList();
                    for ( int i = 0; attributes != null && i < attributes.length; i++ )
                    {
                        IValue[] values = attributes[i].getValues();
                        for ( int j = 0; j < values.length; j++ )
View Full Code Here

                column.pack();
            }
        }
        else if ( getElement() instanceof IEntry )
        {
            IEntry entry = ( IEntry ) getElement();
            if ( entry != null )
            {
                Object[] atds = entry.getSubschema().getAllAttributeNames();
                viewer.setInput( atds );
                column.pack();
            }
        }
View Full Code Here

                column.pack();
            }
        }
        else if ( getElement() instanceof IEntry )
        {
            IEntry entry = ( IEntry ) getElement();
            if ( entry != null )
            {
                Object[] ocds = entry.getSubschema().getObjectClassNames();
                viewer.setInput( ocds );
                column.pack();
            }
        }
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

        viewer.setSorter( new InnerViewerSorter() );
        viewer.setContentProvider( new InnerContentProvider() );
        viewer.setLabelProvider( new InnerLabelProvider() );
        if ( connection != null )
        {
            IEntry entry = connection.getRootDSE();
            viewer.setInput( entry );
        }
        this.rawTab = new TabItem( this.tabFolder, SWT.NONE );
        this.rawTab.setText( "Raw" );
        this.rawTab.setControl( rawComposite );
View Full Code Here

     * {@inheritDoc}
     */
    public void run()
    {

        IEntry entry = null;
        if ( getInput() != null && getInput() instanceof IEntry )
        {
            entry = ( IEntry ) getInput();
        }
        else if ( getSelectedEntries().length > 0 )
        {
            entry = getSelectedEntries()[0];
        }
        else if ( getSelectedAttributes().length > 0 )
        {
            entry = getSelectedAttributes()[0].getEntry();
        }
        else if ( getSelectedValues().length > 0 )
        {
            entry = getSelectedValues()[0].getAttribute().getEntry();
        }

        if ( entry != null )
        {
            AttributeWizard wizard = new AttributeWizard( "New Attribute", true, true, null, entry );
            WizardDialog dialog = new WizardDialog( getShell(), wizard );
            dialog.setBlockOnOpen( true );
            dialog.create();
            if ( dialog.open() == WizardDialog.OK )
            {
                String newAttributeDescription = wizard.getAttributeDescription();
                if ( newAttributeDescription != null && !"".equals( newAttributeDescription ) )
                {
                    try
                    {
                        IAttribute att = entry.getAttribute( newAttributeDescription );
                        if ( att == null )
                        {
                            att = new Attribute( entry, newAttributeDescription );
                            entry.addAttribute( att ) ;
                        }

                        att.addEmptyValue();
                    }
                    catch ( ModelModificationException mme )
View Full Code Here

            if ( this.viewer.isCellEditorActive() )
                this.viewer.cancelEditing();

            // set new input because attributes are newly created after a
            // modification
            IEntry entry = attributeHierarchie.getEntry();
            String attributeDescription = attributeHierarchie.getAttributeDescription();
            attributeHierarchie = entry.getAttributeWithSubtypes( attributeDescription );
            if ( attributeHierarchie == null )
            {
                EventRegistry.suspendEventFireingInCurrentThread();
                try
                {
                    IAttribute attribute = new Attribute( entry, attributeDescription );
                    entry.addAttribute( attribute );
                    attribute.addEmptyValue();
                }
                catch ( ModelModificationException e )
                {
                }
                EventRegistry.resumeEventFireingInCurrentThread();
                attributeHierarchie = entry.getAttributeWithSubtypes( attributeDescription );
            }
            this.viewer.setInput( attributeHierarchie );
            this.viewer.refresh();

            // select added/modified value
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.