You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 18:15:02 UTC

svn commit: r592094 [19/35] - in /directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/m...

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,310 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the Hierarchy View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyViewLabelProvider extends LabelProvider
+{
+    private static final String NONE = "(None)";
+
+    /** The preferences store */
+    private IPreferenceStore store;
+
+    /** The TreeViewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of SchemasViewLabelProvider.
+     */
+    public HierarchyViewLabelProvider( TreeViewer viewer )
+    {
+        store = Activator.getDefault().getPreferenceStore();
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object obj )
+    {
+        String label = ""; //$NON-NLS-1$
+
+        int labelValue = store.getInt( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL );
+        boolean abbreviate = store.getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE );
+        int abbreviateMaxLength = store.getInt( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH );
+        boolean secondaryLabelDisplay = store.getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY );
+        int secondaryLabelValue = store.getInt( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL );
+        boolean secondaryLabelAbbreviate = store
+            .getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE );
+        int secondaryLabelAbbreviateMaxLength = store
+            .getInt( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
+
+        if ( obj instanceof AttributeTypeWrapper )
+        {
+            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) obj ).getAttributeType();
+
+            // Label
+            if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = ViewUtils.concateAliases( names );
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
+            {
+                label = at.getOid();
+            }
+            else
+            // Default
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+
+            // Abbreviate
+            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
+            {
+                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+        }
+        else if ( obj instanceof ObjectClassWrapper )
+        {
+            ObjectClassImpl oc = ( ( ObjectClassWrapper ) obj ).getObjectClass();
+
+            // Label
+            if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = ViewUtils.concateAliases( names );
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
+            {
+                label = oc.getOid();
+            }
+            else
+            // Default
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+
+            // Abbreviate
+            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
+            {
+                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+        }
+
+        // Secondary Label
+        if ( secondaryLabelDisplay )
+        {
+            String secondaryLabel = ""; //$NON-NLS-1$
+            if ( obj instanceof AttributeTypeWrapper )
+            {
+                AttributeTypeImpl at = ( ( AttributeTypeWrapper ) obj ).getAttributeType();
+
+                if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
+                {
+                    String[] names = at.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = names[0];
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
+                {
+                    String[] names = at.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = ViewUtils.concateAliases( names );
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
+                {
+                    secondaryLabel = at.getOid();
+                }
+            }
+            else if ( obj instanceof ObjectClassWrapper )
+            {
+                ObjectClassImpl oc = ( ( ObjectClassWrapper ) obj ).getObjectClass();
+
+                if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
+                {
+                    String[] names = oc.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = names[0];
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
+                {
+                    String[] names = oc.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = ViewUtils.concateAliases( names );
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
+                {
+                    secondaryLabel = oc.getOid();
+                }
+            }
+
+            if ( secondaryLabelAbbreviate && ( secondaryLabelAbbreviateMaxLength < secondaryLabel.length() ) )
+            {
+                secondaryLabel = secondaryLabel.substring( 0, secondaryLabelAbbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+
+            label += "  [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        return label;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object obj )
+    {
+        if ( obj instanceof AttributeTypeWrapper )
+        {
+            if ( ( ( AttributeTypeWrapper ) obj ).getAttributeType().equals( viewer.getInput() ) )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_ATTRIBUTE_TYPE_HIERARCHY_SELECTED ).createImage();
+            }
+            else
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage();
+            }
+        }
+        else if ( obj instanceof ObjectClassWrapper )
+        {
+
+            if ( ( ( ObjectClassWrapper ) obj ).getObjectClass().equals( viewer.getInput() ) )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OBJECT_CLASS_HIERARCHY_SELECTED ).createImage();
+            }
+            else
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OBJECT_CLASS ).createImage();
+            }
+        }
+
+        // Default
+        return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_WARN_TSK );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,214 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.ProblemsViewController;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProblemsViewRoot;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class represents the SchemaView. 
+ * It is used to display the Schema and its elements (Schemas, AttributeTypes 
+ * and ObjectClasses).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProblemsView extends ViewPart
+{
+    /** The ID of the View */
+    public static final String ID = Activator.PLUGIN_ID + ".view.ProblemsView"; //$NON-NLS-1$
+
+    /** The viewer */
+    private TreeViewer treeViewer;
+
+    /** The content provider of the viewer */
+    private ProblemsViewContentProvider contentProvider;
+
+    /** The overview label */
+    private Label overviewLabel;
+
+    /** The SchemaChecker */
+    private SchemaChecker schemaChecker;
+
+    /** The Controller */
+    private ProblemsViewController controller;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPartControl( Composite parent )
+    {
+        // Help Context for Dynamic Help
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, Activator.PLUGIN_ID + "." + "problems_view" );
+
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.horizontalSpacing = 0;
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        gridLayout.verticalSpacing = 0;
+        parent.setLayout( gridLayout );
+
+        // Overview Label
+        overviewLabel = new Label( parent, SWT.NULL );
+        setErrorsAndWarningsCount( 0, 0 );
+        overviewLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Separator Label
+        Label separatorLabel = new Label( parent, SWT.SEPARATOR | SWT.HORIZONTAL );
+        separatorLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Viewer
+        initViewer( parent );
+
+        // Adding the controller
+        controller = new ProblemsViewController( this );
+    }
+
+
+    /**
+     * Initializes the Viewer
+     */
+    private void initViewer( Composite parent )
+    {
+        treeViewer = new TreeViewer( parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL );
+        Tree tree = treeViewer.getTree();
+        tree.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        tree.setHeaderVisible( true );
+        tree.setLinesVisible( true );
+        TreeColumn descriptionColumn = new TreeColumn( tree, SWT.LEFT );
+        descriptionColumn.setText( "Description" );
+        descriptionColumn.setWidth( 500 );
+        TreeColumn resourceColumn = new TreeColumn( tree, SWT.LEFT );
+        resourceColumn.setText( "Resource" );
+        resourceColumn.setWidth( 100 );
+        contentProvider = new ProblemsViewContentProvider();
+        treeViewer.setContentProvider( contentProvider );
+        treeViewer.setLabelProvider( new ProblemsViewLabelProvider() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    public void setFocus()
+    {
+        treeViewer.getTree().setFocus();
+    }
+
+
+    /**
+     * Gets the TreeViewer.
+     *
+     * @return
+     *      the TreeViewer
+     */
+    public TreeViewer getViewer()
+    {
+        return treeViewer;
+    }
+
+
+    /**
+     * Reloads the Viewer
+     */
+    public void reloadViewer()
+    {
+        treeViewer.setInput( new ProblemsViewRoot() );
+        treeViewer.expandAll();
+
+        schemaChecker = Activator.getDefault().getSchemaChecker();
+        if ( schemaChecker != null )
+        {
+            setErrorsAndWarningsCount( schemaChecker.getErrors().size(), schemaChecker.getWarnings().size() );
+        }
+        else
+        {
+            setErrorsAndWarningsCount( 0, 0 );
+        }
+    }
+
+
+    /**
+     * Refresh the overview label with the number of errors and warnings.
+     *
+     * @param errors
+     *      the number of errors
+     * @param warnings
+     *      the number of warnings
+     */
+    public void setErrorsAndWarningsCount( int errors, int warnings )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( errors );
+        sb.append( " " );
+        if ( errors > 1 )
+        {
+            sb.append( "errors" );
+        }
+        else
+        {
+            sb.append( "error" );
+        }
+
+        sb.append( ", " );
+
+        sb.append( warnings );
+        sb.append( " " );
+        if ( warnings > 1 )
+        {
+            sb.append( "warnings" );
+        }
+        else
+        {
+            sb.append( "warning" );
+        }
+
+        overviewLabel.setText( sb.toString() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+     */
+    public void dispose()
+    {
+        controller.dispose();
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,179 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaWarning;
+import org.apache.directory.studio.schemaeditor.view.wrappers.Folder.FolderType;
+import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProblemsViewRoot;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaErrorWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWarningWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the ContentProvider for the ProblemsView.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProblemsViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do.
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+     *      java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+        // Nothing to do.
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    public Object[] getChildren( Object parentElement )
+    {
+        List<TreeNode> children = null;
+
+        if ( parentElement instanceof ProblemsViewRoot )
+        {
+            ProblemsViewRoot root = ( ProblemsViewRoot ) parentElement;
+
+            if ( root.getChildren().isEmpty() )
+            {
+                SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
+
+                if ( schemaChecker != null )
+                {
+                    List<SchemaError> errors = schemaChecker.getErrors();
+                    if ( !errors.isEmpty() )
+                    {
+                        Folder errorsFolder = new Folder( FolderType.ERROR, root );
+                        root.addChild( errorsFolder );
+                        for ( SchemaError error : errors )
+                        {
+                            errorsFolder.addChild( new SchemaErrorWrapper( error, errorsFolder ) );
+                        }
+                    }
+
+                    List<SchemaWarning> warnings = schemaChecker.getWarnings();
+                    if ( !warnings.isEmpty() )
+                    {
+                        Folder warningsFolder = new Folder( FolderType.WARNING, root );
+                        root.addChild( warningsFolder );
+                        for ( SchemaWarning warning : warnings )
+                        {
+                            warningsFolder.addChild( new SchemaWarningWrapper( warning, warningsFolder ) );
+                        }
+                    }
+                }
+            }
+
+            children = root.getChildren();
+        }
+        else if ( parentElement instanceof Folder )
+        {
+            Folder folder = ( Folder ) parentElement;
+
+            children = folder.getChildren();
+        }
+        else if ( parentElement instanceof SchemaErrorWrapper )
+        {
+            children = new ArrayList<TreeNode>();
+        }
+        else if ( parentElement instanceof SchemaWarningWrapper )
+        {
+            children = new ArrayList<TreeNode>();
+        }
+
+        return children.toArray();
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).getParent();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).hasChildren();
+        }
+
+        // Default
+        return false;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,309 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.ClassTypeHierarchyError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.DifferentCollectiveAsSuperiorError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.DifferentUsageAsSuperiorError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.DuplicateAliasError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.DuplicateOidError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NoAliasWarning;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingATSuperiorError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingMandatoryATError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingMatchingRuleError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingOCSuperiorError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingOptionalATError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingSyntaxError;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaCheckerElement;
+import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaErrorWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWarningWrapper;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProblemsViewLabelProvider extends LabelProvider implements ITableLabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+     */
+    public Image getColumnImage( Object element, int columnIndex )
+    {
+        if ( columnIndex == 0 )
+        {
+            if ( element instanceof SchemaErrorWrapper )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_PROBLEMS_ERROR ).createImage();
+            }
+            else if ( element instanceof SchemaWarningWrapper )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_PROBLEMS_WARNING ).createImage();
+            }
+            else if ( element instanceof Folder )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_PROBLEMS_GROUP ).createImage();
+            }
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+     */
+    public String getColumnText( Object element, int columnIndex )
+    {
+        if ( element instanceof SchemaErrorWrapper )
+        {
+            SchemaErrorWrapper errorWrapper = ( SchemaErrorWrapper ) element;
+
+            if ( columnIndex == 0 )
+            {
+                return getMessage( errorWrapper.getSchemaError() );
+            }
+            else if ( columnIndex == 1 )
+            {
+                return getDisplayName( errorWrapper.getSchemaError().getSource() );
+            }
+        }
+        else if ( element instanceof SchemaWarningWrapper )
+        {
+            SchemaWarningWrapper warningWrapper = ( SchemaWarningWrapper ) element;
+
+            if ( columnIndex == 0 )
+            {
+                return getMessage( warningWrapper.getSchemaWarning() );
+            }
+            else if ( columnIndex == 1 )
+            {
+                String name = warningWrapper.getSchemaWarning().getSource().getName();
+
+                if ( ( name != null ) && ( !name.equals( "" ) ) )
+                {
+                    return name;
+                }
+                else
+                {
+                    return warningWrapper.getSchemaWarning().getSource().getOid();
+                }
+            }
+        }
+        else if ( element instanceof Folder )
+        {
+            Folder folder = ( Folder ) element;
+            if ( columnIndex == 0 )
+            {
+                return folder.getName() + " (" + folder.getChildren().size() + ")";
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        // Default
+        return element.toString();
+    }
+
+
+    private String getMessage( SchemaCheckerElement element )
+    {
+        StringBuffer message = new StringBuffer();
+
+        if ( element instanceof DuplicateAliasError )
+        {
+            DuplicateAliasError duplicateAliasError = ( DuplicateAliasError ) element;
+
+            message.append( "Alias '" + duplicateAliasError.getAlias() + "' is already used by another item: " );
+            SchemaObject duplicate = duplicateAliasError.getDuplicate();
+            if ( duplicate instanceof AttributeTypeImpl )
+            {
+                message.append( "attribute type" );
+            }
+            else if ( duplicate instanceof ObjectClassImpl )
+            {
+                message.append( "object class" );
+            }
+            message.append( " with OID '" + duplicate.getOid() + "'." );
+        }
+        else if ( element instanceof DuplicateOidError )
+        {
+            DuplicateOidError duplicateOidError = ( DuplicateOidError ) element;
+
+            message.append( "OID '" + duplicateOidError.getOid() + "' is already used by another item: " );
+            SchemaObject duplicate = duplicateOidError.getDuplicate();
+            if ( duplicate instanceof AttributeTypeImpl )
+            {
+                message.append( "attribute type" );
+            }
+            else if ( duplicate instanceof ObjectClassImpl )
+            {
+                message.append( "object class" );
+            }
+            message.append( " with alias '" + duplicate.getName() + "'." );
+        }
+        else if ( element instanceof NonExistingATSuperiorError )
+        {
+            NonExistingATSuperiorError nonExistingATSuperiorError = ( NonExistingATSuperiorError ) element;
+
+            message.append( "Superior attribute type '" + nonExistingATSuperiorError.getSuperiorAlias()
+                + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingOCSuperiorError )
+        {
+            NonExistingOCSuperiorError nonExistingOCSuperiorError = ( NonExistingOCSuperiorError ) element;
+
+            message.append( "Superior object class '" + nonExistingOCSuperiorError.getSuperiorAlias()
+                + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingMandatoryATError )
+        {
+            NonExistingMandatoryATError nonExistingMandatoryATError = ( NonExistingMandatoryATError ) element;
+
+            message
+                .append( "Mandatory attribute type '" + nonExistingMandatoryATError.getAlias() + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingOptionalATError )
+        {
+            NonExistingOptionalATError nonExistingOptionalATError = ( NonExistingOptionalATError ) element;
+
+            message.append( "Optional attribute type '" + nonExistingOptionalATError.getAlias() + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingSyntaxError )
+        {
+            NonExistingSyntaxError nonExistingSyntaxError = ( NonExistingSyntaxError ) element;
+
+            message.append( "Syntax with OID '" + nonExistingSyntaxError.getSyntaxOid() + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingMatchingRuleError )
+        {
+            NonExistingMatchingRuleError nonExistingMatchingRuleError = ( NonExistingMatchingRuleError ) element;
+
+            message.append( "Matching rule '" + nonExistingMatchingRuleError.getMatchingRuleAlias()
+                + "' does not exist." );
+        }
+        else if ( element instanceof NoAliasWarning )
+        {
+            NoAliasWarning noAliasWarning = ( NoAliasWarning ) element;
+            SchemaObject source = noAliasWarning.getSource();
+            if ( source instanceof AttributeTypeImpl )
+            {
+                message.append( "Attribute type" );
+            }
+            else if ( source instanceof ObjectClassImpl )
+            {
+                message.append( "Object class" );
+            }
+            message.append( " with OID '" + source.getOid() + "' does not have any alias." );
+        }
+        else if ( element instanceof ClassTypeHierarchyError )
+        {
+            ClassTypeHierarchyError classTypeHierarchyError = ( ClassTypeHierarchyError ) element;
+            ObjectClassImpl source = ( ObjectClassImpl ) classTypeHierarchyError.getSource();
+            ObjectClassImpl superior = ( ObjectClassImpl ) classTypeHierarchyError.getSuperior();
+
+            if ( source.getType().equals( ObjectClassTypeEnum.ABSTRACT ) )
+            {
+                message.append( "Abstract object class '" + getDisplayName( source ) + "' can not extend " );
+
+                if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
+                {
+                    message.append( "Structural object class :'" + getDisplayName( superior ) + "'." );
+                }
+                else if ( superior.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
+                {
+                    message.append( "Auxiliary object class :'" + getDisplayName( superior ) + "'." );
+                }
+            }
+            else if ( source.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
+            {
+                message.append( "Auxiliary object class '" + getDisplayName( source ) + "' can not extend " );
+
+                if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
+                {
+                    message.append( "Structural object class :'" + getDisplayName( superior ) + "'." );
+                }
+            }
+        }
+        else if ( element instanceof DifferentUsageAsSuperiorError )
+        {
+            DifferentUsageAsSuperiorError differentUsageAsSuperiorError = ( DifferentUsageAsSuperiorError ) element;
+            AttributeTypeImpl source = ( AttributeTypeImpl ) differentUsageAsSuperiorError.getSource();
+            AttributeTypeImpl superior = ( AttributeTypeImpl ) differentUsageAsSuperiorError.getSuperior();
+
+            message.append( "Attribute type '" + getDisplayName( source )
+                + "' has a different usage value than its superior '" + getDisplayName( superior ) + "'." );
+        }
+        else if ( element instanceof DifferentCollectiveAsSuperiorError )
+        {
+            DifferentCollectiveAsSuperiorError differentCollectiveAsSuperiorError = ( DifferentCollectiveAsSuperiorError ) element;
+            AttributeTypeImpl source = ( AttributeTypeImpl ) differentCollectiveAsSuperiorError.getSource();
+            AttributeTypeImpl superior = ( AttributeTypeImpl ) differentCollectiveAsSuperiorError.getSuperior();
+
+            message.append( "Attribute type '" + getDisplayName( source ) + "' must be collective as its superior '"
+                + getDisplayName( superior ) + "'." );
+        }
+
+        return message.toString();
+    }
+
+
+    /**
+     * Gets the displayable name of the given SchemaObject.
+     *
+     * @param so
+     *      the SchemaObject
+     * @return
+     *      the displayable name of the given SchemaObject
+     */
+    private String getDisplayName( SchemaObject so )
+    {
+        String name = so.getName();
+
+        if ( ( name != null ) && ( !name.equals( "" ) ) )
+        {
+            return name;
+        }
+        else
+        {
+            return so.getOid();
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsView.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsView.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsView.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,95 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.ProjectsViewController;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class represents the ProjectsView. 
+ * It is used to display the projects the user has created.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsView extends ViewPart
+{
+    /** The ID of the View */
+    public static final String ID = Activator.PLUGIN_ID + ".view.ProjectsView"; //$NON-NLS-1$
+
+    /** The viewer */
+    private TableViewer tableViewer;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPartControl( Composite parent )
+    {
+        // Help Context for Dynamic Help
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, Activator.PLUGIN_ID + "." + "projects_view" );
+
+        initViewer( parent );
+
+        // Adding the controller
+        new ProjectsViewController( this );
+    }
+
+
+    /**
+     * Initializes the Viewer
+     */
+    private void initViewer( Composite parent )
+    {
+        tableViewer = new TableViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        tableViewer.setContentProvider( new ProjectsViewContentProvider( tableViewer ) );
+        tableViewer.setLabelProvider( new DecoratingLabelProvider( new ProjectsViewLabelProvider(), Activator
+            .getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    public void setFocus()
+    {
+        tableViewer.getTable().setFocus();
+    }
+
+
+    /**
+     * Gets the TableViewer.
+     *
+     * @return
+     *      the TableViewer
+     */
+    public TableViewer getViewer()
+    {
+        return tableViewer;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,152 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProjectSorter;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProjectWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProjectsViewRoot;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the ContentProvider for the ProblemsView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+    /** The viewer */
+    private TableViewer tableViewer;
+
+    /** The Sorter */
+    private ProjectSorter projectSorter;
+
+
+    /**
+     * Creates a new instance of ProjectsViewContentProvider.
+     *
+     * @param tableViewer
+     *      the TableViewer
+     */
+    public ProjectsViewContentProvider( TableViewer tableViewer )
+    {
+        this.tableViewer = tableViewer;
+        projectSorter = new ProjectSorter();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do.
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+        // Nothing to do.
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    @SuppressWarnings("unchecked")
+    public Object[] getChildren( Object parentElement )
+    {
+        List<TreeNode> children = new ArrayList<TreeNode>();
+
+        if ( parentElement instanceof ProjectsViewRoot )
+        {
+            ProjectsViewRoot projectsViewRoot = ( ProjectsViewRoot ) parentElement;
+
+            if ( !projectsViewRoot.hasChildren() )
+            {
+                for ( Project project : Activator.getDefault().getProjectsHandler().getProjects() )
+                {
+                    projectsViewRoot.addChild( new ProjectWrapper( project, tableViewer ) );
+                }
+            }
+
+            children = projectsViewRoot.getChildren();
+
+            // Sorting Children
+            Collections.sort( children, projectSorter );
+        }
+
+        return children.toArray();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).getParent();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).hasChildren();
+        }
+
+        // Default
+        return false;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,97 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.model.ProjectType;
+import org.apache.directory.studio.schemaeditor.model.Project.ProjectState;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProjectWrapper;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the ProjectsView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsViewLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof ProjectWrapper )
+        {
+            Project project = ( ( ProjectWrapper ) element ).getProject();
+            ProjectType type = project.getType();
+            switch ( type )
+            {
+                case OFFLINE:
+                    ProjectState state = project.getState();
+                    switch ( state )
+                    {
+                        case OPEN:
+                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                                PluginConstants.IMG_PROJECT_OFFLINE ).createImage();
+                        case CLOSED:
+                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                                PluginConstants.IMG_PROJECT_OFFLINE_CLOSED ).createImage();
+                    }
+                case ONLINE:
+                    ProjectState state2 = project.getState();
+                    switch ( state2 )
+                    {
+                        case OPEN:
+                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                                PluginConstants.IMG_PROJECT_ONLINE ).createImage();
+                        case CLOSED:
+                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                                PluginConstants.IMG_PROJECT_ONLINE_CLOSED ).createImage();
+                    }
+            }
+        }
+
+        // Default
+        return super.getImage( element );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof ProjectWrapper )
+        {
+            ProjectWrapper projectWrapper = ( ProjectWrapper ) element;
+            return projectWrapper.getProject().getName();
+        }
+
+        // Default
+        return super.getText( element );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProjectsViewLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaView.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaView.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaView.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,119 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.SchemaViewController;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaViewRoot;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class represents the SchemaView. 
+ * It is used to display the Schema and its elements (Schemas, AttributeTypes 
+ * and ObjectClasses).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaView extends ViewPart
+{
+    /** The ID of the View */
+    public static final String ID = Activator.PLUGIN_ID + ".view.SchemaView"; //$NON-NLS-1$
+
+    /** The viewer */
+    private TreeViewer treeViewer;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPartControl( Composite parent )
+    {
+        initViewer( parent );
+
+        // Registering the Viewer, so other views can be notified when the viewer selection changes
+        getSite().setSelectionProvider( treeViewer );
+
+        // Adding the controller
+        new SchemaViewController( this );
+
+        // Help Context for Dynamic Help
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, Activator.PLUGIN_ID + "." + "schema_view" );
+    }
+
+
+    /**
+     * Initializes the Viewer
+     */
+    private void initViewer( Composite parent )
+    {
+        treeViewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        treeViewer.setContentProvider( new SchemaViewContentProvider() );
+        treeViewer.setLabelProvider( new DecoratingLabelProvider( new SchemaViewLabelProvider(), Activator.getDefault()
+            .getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+        treeViewer.getTree().setEnabled( false );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    public void setFocus()
+    {
+        treeViewer.getTree().setFocus();
+    }
+
+
+    /**
+     * Gets the TreeViewer.
+     *
+     * @return
+     *      the TreeViewer
+     */
+    public TreeViewer getViewer()
+    {
+        return treeViewer;
+    }
+
+
+    /**
+     * Reloads the Viewer
+     */
+    public void reloadViewer()
+    {
+        treeViewer.setInput( new SchemaViewRoot() );
+    }
+
+
+    /**
+     * Refreshes the viewer
+     */
+    public void refresh()
+    {
+        treeViewer.refresh();
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaView.java
------------------------------------------------------------------------------
    svn:eol-style = native