Package org.apache.directory.studio.schemaeditor.model.schemachecker

Examples of org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker


     * @param project
     *      the project
     */
    private void addSchemaCheckerListener( Project project )
    {
        SchemaChecker schemaChecker = project.getSchemaChecker();
        if ( schemaChecker != null )
        {
            schemaChecker.addListener( schemaCheckerListener );
            schemaChecker.enableModificationsListening();
        }
    }
View Full Code Here


     * @param project
     *      the project
     */
    private void removeSchemaCheckerListener( Project project )
    {
        SchemaChecker schemaChecker = project.getSchemaChecker();
        if ( schemaChecker != null )
        {
            schemaChecker.removeListener( schemaCheckerListener );
            schemaChecker.disableModificationsListening();
        }
    }
View Full Code Here

    /**
     * Initializes the SchemaCheckerListener.
     */
    private void initSchemaCheckerListener()
    {
        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();

        if ( schemaChecker != null )
        {
            schemaChecker.addListener( new SchemaCheckerListener()
            {
                /* (non-Javadoc)
                 * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaCheckerListener#schemaCheckerUpdated()
                 */
                public void schemaCheckerUpdated()
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void decorate( Object element, IDecoration decoration )
    {
        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
        ElementState state = ElementState.NONE;

        if ( element instanceof AttributeTypeWrapper )
        {
            AttributeType at = ( ( AttributeTypeWrapper ) element ).getAttributeType();

            if ( schemaChecker.hasErrors( at ) )
            {
                decorateState( ElementState.ERROR, decoration );
                return;
            }

            if ( schemaChecker.hasWarnings( at ) )
            {
                state = ElementState.WARNING;
            }
        }
        else if ( element instanceof ObjectClassWrapper )
        {
            ObjectClass oc = ( ( ObjectClassWrapper ) element ).getObjectClass();

            if ( schemaChecker.hasErrors( oc ) )
            {
                decorateState( ElementState.ERROR, decoration );
                return;
            }

            if ( schemaChecker.hasWarnings( oc ) )
            {
                state = ElementState.WARNING;
            }
        }
        else if ( element instanceof SchemaWrapper )
        {
            Schema schema = ( ( SchemaWrapper ) element ).getSchema();

            for ( AttributeType at : schema.getAttributeTypes() )
            {
                if ( schemaChecker.hasErrors( at ) )
                {
                    decorateState( ElementState.ERROR, decoration );
                    return;
                }

                if ( schemaChecker.hasWarnings( at ) )
                {
                    state = ElementState.WARNING;
                }
            }

            for ( ObjectClass oc : schema.getObjectClasses() )
            {
                if ( schemaChecker.hasErrors( oc ) )
                {
                    decorateState( ElementState.ERROR, decoration );
                    return;
                }

                if ( schemaChecker.hasWarnings( oc ) )
                {
                    state = ElementState.WARNING;
                }
            }
        }
View Full Code Here

        {
            ProblemsViewRoot root = ( ProblemsViewRoot ) parentElement;

            if ( root.getChildren().isEmpty() )
            {
                SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();

                if ( schemaChecker != null )
                {
                    List<Throwable> errors = schemaChecker.getErrors();
                    if ( !( errors.size() == 0 ) )
                    {
                        Folder errorsFolder = new Folder( FolderType.ERROR, root );
                        root.addChild( errorsFolder );
                        for ( Throwable error : errors )
                        {
                            if ( error instanceof LdapSchemaException )
                            {
                                errorsFolder.addChild( new SchemaErrorWrapper( ( LdapSchemaException ) error,
                                    errorsFolder ) );
                            }
                        }
                    }

                    SchemaWarning[] warnings = schemaChecker.getWarnings().toArray( new SchemaWarning[0] );
                    if ( !( warnings.length == 0 ) )
                    {
                        Folder warningsFolder = new Folder( FolderType.WARNING, root );
                        root.addChild( warningsFolder );
                        for ( SchemaWarning warning : warnings )
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void decorate( Object element, IDecoration decoration )
    {
        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
        ElementState state = ElementState.NONE;

        if ( element instanceof AttributeTypeWrapper )
        {
            AttributeType at = ( ( AttributeTypeWrapper ) element ).getAttributeType();

            if ( schemaChecker.hasErrors( at ) )
            {
                decorateState( ElementState.ERROR, decoration );
                return;
            }

            if ( schemaChecker.hasWarnings( at ) )
            {
                state = ElementState.WARNING;
            }
        }
        else if ( element instanceof ObjectClassWrapper )
        {
            ObjectClass oc = ( ( ObjectClassWrapper ) element ).getObjectClass();

            if ( schemaChecker.hasErrors( oc ) )
            {
                decorateState( ElementState.ERROR, decoration );
                return;
            }

            if ( schemaChecker.hasWarnings( oc ) )
            {
                state = ElementState.WARNING;
            }
        }
        else if ( element instanceof SchemaWrapper )
        {
            Schema schema = ( ( SchemaWrapper ) element ).getSchema();

            for ( AttributeType at : schema.getAttributeTypes() )
            {
                if ( schemaChecker.hasErrors( at ) )
                {
                    decorateState( ElementState.ERROR, decoration );
                    return;
                }

                if ( schemaChecker.hasWarnings( at ) )
                {
                    state = ElementState.WARNING;
                }
            }

            for ( ObjectClass oc : schema.getObjectClasses() )
            {
                if ( schemaChecker.hasErrors( oc ) )
                {
                    decorateState( ElementState.ERROR, decoration );
                    return;
                }

                if ( schemaChecker.hasWarnings( oc ) )
                {
                    state = ElementState.WARNING;
                }
            }
        }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
     */
    public void decorate( Object element, IDecoration decoration )
    {
        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();

        if ( element instanceof AttributeTypeWrapper )
        {
            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) element ).getAttributeType();

            if ( schemaChecker.hasErrors( at ) )
            {
                decoration.addOverlay( Activator.getDefault().getImageDescriptor( PluginConstants.IMG_OVERLAY_ERROR ),
                    IDecoration.BOTTOM_LEFT );
                return;
            }

            if ( schemaChecker.hasWarnings( at ) )
            {
                decoration.addOverlay(
                    Activator.getDefault().getImageDescriptor( PluginConstants.IMG_OVERLAY_WARNING ),
                    IDecoration.BOTTOM_LEFT );
            }
        }
        else if ( element instanceof ObjectClassWrapper )
        {
            ObjectClassImpl oc = ( ( ObjectClassWrapper ) element ).getObjectClass();

            if ( schemaChecker.hasErrors( oc ) )
            {
                decoration.addOverlay( Activator.getDefault().getImageDescriptor( PluginConstants.IMG_OVERLAY_ERROR ),
                    IDecoration.BOTTOM_LEFT );
                return;
            }

            if ( schemaChecker.hasWarnings( oc ) )
            {
                decoration.addOverlay(
                    Activator.getDefault().getImageDescriptor( PluginConstants.IMG_OVERLAY_WARNING ),
                    IDecoration.BOTTOM_LEFT );
            }
        }
        else if ( element instanceof SchemaWrapper )
        {
            Schema schema = ( ( SchemaWrapper ) element ).getSchema();

            for ( AttributeTypeImpl at : schema.getAttributeTypes() )
            {
                if ( schemaChecker.hasErrors( at ) )
                {
                    decoration.addOverlay( Activator.getDefault()
                        .getImageDescriptor( PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
                    return;
                }

                if ( schemaChecker.hasWarnings( at ) )
                {
                    decoration.addOverlay( Activator.getDefault().getImageDescriptor(
                        PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
                }
            }

            for ( ObjectClassImpl oc : schema.getObjectClasses() )
            {
                if ( schemaChecker.hasErrors( oc ) )
                {
                    decoration.addOverlay( Activator.getDefault()
                        .getImageDescriptor( PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
                    return;
                }

                if ( schemaChecker.hasWarnings( oc ) )
                {
                    decoration.addOverlay( Activator.getDefault().getImageDescriptor(
                        PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
                }
            }
View Full Code Here

        {
            ProblemsViewRoot root = ( ProblemsViewRoot ) parentElement;

            if ( root.getChildren().isEmpty() )
            {
                SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();

                if ( schemaChecker != null )
                {
                    SchemaError[] errors = schemaChecker.getErrors().toArray( new SchemaError[0] );
                    if ( !( errors.length == 0 ) )
                    {
                        Folder errorsFolder = new Folder( FolderType.ERROR, root );
                        root.addChild( errorsFolder );
                        for ( SchemaError error : errors )
                        {
                            errorsFolder.addChild( new SchemaErrorWrapper( error, errorsFolder ) );
                        }
                    }

                    SchemaWarning[] warnings = schemaChecker.getWarnings().toArray( new SchemaWarning[0] );
                    if ( !( warnings.length == 0 ) )
                    {
                        Folder warningsFolder = new Folder( FolderType.WARNING, root );
                        root.addChild( warningsFolder );
                        for ( SchemaWarning warning : warnings )
View Full Code Here

    {
        this.type = type;
        this.name = name;
        this.state = ProjectState.CLOSED;
        schemaHandler = new SchemaHandler();
        schemaChecker = new SchemaChecker();
    }
View Full Code Here

    public Project()
    {
        type = ProjectType.OFFLINE;
        this.state = ProjectState.CLOSED;
        schemaHandler = new SchemaHandler();
        schemaChecker = new SchemaChecker();
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker

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.