Package org.apache.directory.ldapstudio.schemas.model

Examples of org.apache.directory.ldapstudio.schemas.model.SchemaPool


    /* (non-Javadoc)
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        SchemaPool pool = SchemaPool.getInstance();
        pool.addNewSchema( this.page.getNameField() );
        return true;
    }
View Full Code Here


     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        // Getting the SchemaPool
        SchemaPool pool = SchemaPool.getInstance();

        // Getting the right schema
        Schema schema = pool.getSchema( schemaName );

        // Creating the new attribute type and adding it to the schema
        AttributeTypeLiteral attributeTypeLiteral = new AttributeTypeLiteral( this.page.getOidField() );
        attributeTypeLiteral.setNames( new String[]
            { this.page.getNameField() } );
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.jface.action.Action#run()
     */
    public void run()
    {
        SchemaPool schemaPool = SchemaPool.getInstance();
        try
        {
            schemaPool.saveAll();
        }
        catch ( Exception e )
        {
            ErrorDialog
                .openError(
View Full Code Here

        }

        if ( schemaName != null )
        {
            // Getting the SchemaPool
            SchemaPool pool = SchemaPool.getInstance();
            // Getting the right schema
            Schema schema = pool.getSchema( schemaName );

            if ( schema.type == Schema.SchemaType.coreSchema )
            {
                MessageBox messageBox = new MessageBox(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
                messageBox
                    .setMessage( Messages.getString( "RemoveSchemaAction.The_schema" ) + schemaName + Messages.getString( "RemoveSchemaAction.Is_a_core_schema_It_cant_be_removed_from_the_pool" ) ); //$NON-NLS-1$ //$NON-NLS-2$
                messageBox.open();
                return;
            }
            if ( schema.hasBeenModified() || schema.hasPendingModification() )
            {
                MessageBox messageBox = new MessageBox(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.CANCEL
                        | SWT.ICON_QUESTION );
                messageBox.setMessage( Messages
                    .getString( "RemoveSchemaAction.This_schema_has_been_modified_or_has_pending_modifications" ) ); //$NON-NLS-1$
                if ( messageBox.open() == SWT.OK )
                {
                    pool.removeSchema( schema );
                }
            }
            else
            {
                pool.removeSchema( schema );
            }
        }
    }
View Full Code Here

     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        // Getting the SchemaPool
        SchemaPool pool = SchemaPool.getInstance();

        // Getting the right schema
        Schema schema = pool.getSchema( schemaName );

        // Creating the new object class and adding it to the schema
        ObjectClassLiteral objectClassLiteral = new ObjectClassLiteral( this.page.getOidField() );
        objectClassLiteral.setNames( new String[]
            { this.page.getNameField() } );
View Full Code Here

    {
        if ( inputElement instanceof AttributeType )
        {
            List<ObjectClass> results = new ArrayList<ObjectClass>();
            AttributeType inputAT = ( AttributeType ) inputElement;
            SchemaPool schemaPool = SchemaPool.getInstance();

            List<String> names = new ArrayList<String>();
            for ( String name : inputAT.getNames() )
            {
                names.add( name.toLowerCase() );
            }

            List<ObjectClass> objectClasses = schemaPool.getObjectClasses();
            for ( ObjectClass oc : objectClasses )
            {
                String[] musts = oc.getMust();
                for ( String must : musts )
                {
View Full Code Here

             */
            public void drop( DropTargetEvent event )
            {
                if ( fileTransfer.isSupportedType( event.currentDataType ) )
                {
                    SchemaPool pool = SchemaPool.getInstance();
                    String[] files = ( String[] ) event.data;
                    for ( String file : files )
                    {
                        try
                        {
                            pool.addSchema( Schema.localPathToURL( file ) );
                        }
                        catch ( SchemaCreationException e )
                        {
                            logger.debug( "error when initializing new schema after drag&drop: " + file ); //$NON-NLS-1$
                        }
View Full Code Here

        fd.setFilterExtensions( filterExt );
        String selected = fd.open();
        // selected == null if 'cancel' has been pushed
        if ( selected != null )
        {
            SchemaPool pool = SchemaPool.getInstance();
            try
            {
                pool.addSchema( Schema.localPathToURL( selected ) );
            }
            catch ( Exception e )
            {
                logger.debug( "Error when opening a schema file" ); //$NON-NLS-1$
            }
View Full Code Here

    {
        if ( inputElement instanceof AttributeType )
        {
            List<ObjectClass> results = new ArrayList<ObjectClass>();
            AttributeType inputAT = ( AttributeType ) inputElement;
            SchemaPool schemaPool = SchemaPool.getInstance();

            List<String> names = new ArrayList<String>();
            for ( String name : inputAT.getNames() )
            {
                names.add( name.toLowerCase() );
            }

            List<ObjectClass> objectClasses = schemaPool.getObjectClasses();
            for ( ObjectClass oc : objectClasses )
            {
                String[] mays = oc.getMay();
                for ( String may : mays )
                {
View Full Code Here

     *      schema depends on
     */
    private String[] getSchemaDependencies( Schema schema )
    {
        Set<String> schemaNames = new HashSet<String>();
        SchemaPool schemaPool = SchemaPool.getInstance();

        // Looping on Attribute Types
        for ( AttributeType at : schema.getAttributeTypesAsArray() )
        {
            // Superior
            String supName = at.getSuperior();
            if ( supName != null )
            {
                AttributeType sup = schemaPool.getAttributeType( supName );
                if ( sup != null )
                {
                    if ( !schema.equals( sup.getOriginatingSchema() ) )
                    {
                        schemaNames.add( sup.getOriginatingSchema().getName() );
                    }
                }
            }
        }

        // Looping on Object Classes
        for ( ObjectClass oc : schema.getObjectClassesAsArray() )
        {
            // Superiors
            for ( String supName : oc.getSuperiors() )
            {
                ObjectClass sup = schemaPool.getObjectClass( supName );
                if ( sup != null )
                {
                    if ( !schema.equals( sup.getOriginatingSchema() ) )
                    {
                        schemaNames.add( sup.getOriginatingSchema().getName() );
                    }
                }
            }

            // Mays
            for ( String mayName : oc.getMay() )
            {
                AttributeType may = schemaPool.getAttributeType( mayName );
                if ( may != null )
                {
                    if ( !schema.equals( may.getOriginatingSchema() ) )
                    {
                        schemaNames.add( may.getOriginatingSchema().getName() );
                    }
                }
            }

            // Musts
            for ( String mustName : oc.getMust() )
            {
                AttributeType must = schemaPool.getAttributeType( mustName );
                if ( must != null )
                {
                    if ( !schema.equals( must.getOriginatingSchema() ) )
                    {
                        schemaNames.add( must.getOriginatingSchema().getName() );
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.schemas.model.SchemaPool

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.