directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r554663 [1/2] - in /directory/studio/trunk/studio-apacheds-schemaeditor: ./ resources/icons/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ src/ma...
Date Mon, 09 Jul 2007 14:35:10 GMT
Author: pamarcelot
Date: Mon Jul  9 07:35:09 2007
New Revision: 554663

URL: http://svn.apache.org/viewvc?view=rev&rev=554663
Log:
Added the 'Schema Editor' Perspective.
Added the 'Problems' View.
Updated the Schema Checker and its Errors and Warnings.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemaeditor_perspective.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NoAliasWarning.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOptionalATError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerListener.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProblemsViewRoot.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaErrorWrapper.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaWarningWrapper.java
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateAliasError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateMandatoryOptionalAttributeError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateOidError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingSyntaxError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Mon Jul  9 07:35:09 2007
@@ -20,6 +20,14 @@
 -->
 <plugin>
 	<extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            class="org.apache.directory.studio.apacheds.schemaeditor.view.Perspective"
+            icon="resources/icons/schemaeditor_perspective.gif"
+            id="org.apache.directory.studio.apacheds.schemaeditor.perspective"
+            name="Schema Editor"/>
+   </extension>
+	<extension
          point="org.eclipse.ui.views">
       <category
             id="org.apache.directory.studio.apacheds.schemaeditor.view.category"
@@ -30,7 +38,14 @@
             class="org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView"
             icon="resources/icons/schemas_view.png"
             id="org.apache.directory.studio.apacheds.schemaeditor.view.SchemaView"
-            name="Apache DS Schema"/>
+            name="Schema"/>
+	  <view
+            allowMultiple="false"
+            category="org.apache.directory.studio.apacheds.schemaeditor.view.category"
+            class="org.apache.directory.studio.apacheds.schemaeditor.view.views.ProblemsView"
+            icon="resources/icons/problems_view.gif"
+            id="org.apache.directory.studio.apacheds.schemaeditor.view.ProblemsView"
+            name="Problems"/>
    </extension>
  <extension
        point="org.eclipse.core.runtime.preferences">

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemaeditor_perspective.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemaeditor_perspective.gif?view=auto&rev=554663
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemaeditor_perspective.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java Mon Jul  9 07:35:09 2007
@@ -47,6 +47,8 @@
         oc1.setNames(new String[] { "oc1", "objectClass1" } );
         oc1.setSchema( schema1.getName() );
         schema1.addObjectClass( oc1 );
+        oc1.setMayNamesList( new String[] { "nonexistingAT", "at1" } );
+        oc1.setMustNamesList( new String[] { "at1" } );
         
         schemaHandler.addSchema( schema1 );
         schemaHandler.addListener( new SchemaHandlerAdapter(){

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,188 @@
+/*
+ *  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.apacheds.schemaeditor.controller;
+
+
+import java.rmi.activation.Activatable;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaCheckerListener;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProblemsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaErrorWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWarningWrapper;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Controller for the ProblemsView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProblemsViewController
+{
+    /** The associated view */
+    private ProblemsView view;
+
+
+    // The Actions
+
+    /**
+     * Creates a new instance of SchemasViewController.
+     *
+     * @param view
+     *      the associated view
+     */
+    public ProblemsViewController( ProblemsView view )
+    {
+        this.view = view;
+
+        initActions();
+        initToolbar();
+        initDoubleClickListener();
+        initSchemaCheckerListener();
+    }
+
+
+    /**
+     * Initializes the Actions.
+     */
+    private void initActions()
+    {
+    }
+
+
+    /**
+     * Initializes the Toolbar.
+     */
+    private void initToolbar()
+    {
+        IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+    }
+
+
+    /**
+     * Initializes the DoubleClickListener.
+     */
+    private void initDoubleClickListener()
+    {
+        view.getViewer().addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+                TreeViewer viewer = view.getViewer();
+
+                // What we get from the treeViewer is a StructuredSelection
+                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+                // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
+                Object objectSelection = selection.getFirstElement();
+                IEditorInput input = null;
+                String editorId = null;
+
+                // Selecting the right editor and input
+                if ( objectSelection instanceof SchemaErrorWrapper )
+                {
+                    SchemaObject object = ( ( SchemaErrorWrapper ) objectSelection ).getSchemaError().getSource();
+
+                    if ( object instanceof AttributeTypeImpl )
+                    {
+                        input = new AttributeTypeEditorInput( ( AttributeTypeImpl ) object );
+                        editorId = AttributeTypeEditor.ID;
+                    }
+                    else if ( object instanceof ObjectClassImpl )
+                    {
+                        input = new ObjectClassEditorInput( ( ObjectClassImpl ) object );
+                        editorId = ObjectClassEditor.ID;
+                    }
+                }
+                else if ( objectSelection instanceof SchemaWarningWrapper )
+                {
+                    SchemaObject object = ( ( SchemaWarningWrapper ) objectSelection ).getSchemaWarning().getSource();
+
+                    if ( object instanceof AttributeTypeImpl )
+                    {
+                        input = new AttributeTypeEditorInput( ( AttributeTypeImpl ) object );
+                        editorId = AttributeTypeEditor.ID;
+                    }
+                    else if ( object instanceof ObjectClassImpl )
+                    {
+                        input = new ObjectClassEditorInput( ( ObjectClassImpl ) object );
+                        editorId = ObjectClassEditor.ID;
+                    }
+                }
+                else if ( ( objectSelection instanceof Folder ) )
+                {
+                    // Here we don't open an editor, we just expand the node.
+                    viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
+                }
+
+                // Let's open the editor
+                if ( input != null )
+                {
+                    try
+                    {
+                        page.openEditor( input, editorId );
+                    }
+                    catch ( PartInitException e )
+                    {
+                        // TODO
+                    }
+                }
+            }
+        } );
+    }
+
+
+    /**
+     * Initializes the SchemaCheckerListener.
+     */
+    private void initSchemaCheckerListener()
+    {
+        Activator.getDefault().getSchemaChecker().addListener( new SchemaCheckerListener()
+        {
+            /* (non-Javadoc)
+             * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaCheckerListener#schemaCheckerUpdated()
+             */
+            public void schemaCheckerUpdated()
+            {
+                view.reloadViewer();
+            }
+        } );
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateAliasError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateAliasError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateAliasError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateAliasError.java Mon Jul  9 07:35:09 2007
@@ -59,11 +59,8 @@
     }
 
 
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateMandatoryOptionalAttributeError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateMandatoryOptionalAttributeError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateMandatoryOptionalAttributeError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateMandatoryOptionalAttributeError.java Mon Jul  9 07:35:09 2007
@@ -53,11 +53,8 @@
     }
 
 
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateOidError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateOidError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateOidError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateOidError.java Mon Jul  9 07:35:09 2007
@@ -59,11 +59,8 @@
     }
 
 
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NoAliasWarning.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NoAliasWarning.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NoAliasWarning.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NoAliasWarning.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,56 @@
+/*
+ *  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.apacheds.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+/**
+ * This class represents the NoAliasWarning.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NoAliasWarning implements SchemaWarning
+{
+    /** The source object */
+    private SchemaObject source;
+
+
+    /**
+     * Creates a new instance of NoAliasWarning.
+     *
+     * @param source
+     *      the source object
+     */
+    public NoAliasWarning( SchemaObject source )
+    {
+        this.source = source;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaWarning#getSource()
+     */
+    public SchemaObject getSource()
+    {
+        return source;
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java Mon Jul  9 07:35:09 2007
@@ -53,11 +53,8 @@
     }
 
 
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,84 @@
+/*
+ *  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.apacheds.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingMandatoryATError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingMandatoryATError implements SchemaError
+{
+    /** The source object */
+    private SchemaObject source;
+
+    /** The mandatory attribute type's alias */
+    private String alias;
+
+
+    /**
+     * Creates a new instance of NonExistingMandatoryATError.
+     *
+     * @param source
+     *      the source object
+     * @param alias
+     *      the mandatory attribute type's alias
+     */
+    public NonExistingMandatoryATError( SchemaObject source, String alias )
+    {
+        this.source = source;
+        this.alias = alias;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
+     */
+    public SchemaObject getSource()
+    {
+        return source;
+    }
+
+
+    /**
+     * Gets the mandatory attribute type's alias.
+     * 
+     * @return
+     *      the mandatory attribute type's alias
+     */
+    public String getAlias()
+    {
+        return alias;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "[NonExistingMandatoryATError - Source: " + getSource() + " - alias: " + getAlias() + "]";
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java Mon Jul  9 07:35:09 2007
@@ -68,11 +68,8 @@
     }
 
 
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java Mon Jul  9 07:35:09 2007
@@ -52,12 +52,9 @@
         this.supAlias = supAlias;
     }
 
-
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOptionalATError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOptionalATError.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOptionalATError.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingOptionalATError.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,84 @@
+/*
+ *  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.apacheds.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingOptionalATError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingOptionalATError implements SchemaError
+{
+    /** The source object */
+    private SchemaObject source;
+
+    /** The optional attribute type's alias */
+    private String alias;
+
+
+    /**
+     * Creates a new instance of NonExistingOptionalATError.
+     *
+     * @param source
+     *      the source object
+     * @param alias
+     *      the optional attribute type's alias
+     */
+    public NonExistingOptionalATError( SchemaObject source, String alias )
+    {
+        this.source = source;
+        this.alias = alias;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
+     */
+    public SchemaObject getSource()
+    {
+        return source;
+    }
+
+
+    /**
+     * Gets the optional attribute type's alias.
+     * 
+     * @return
+     *      the optional attribute type's alias
+     */
+    public String getAlias()
+    {
+        return alias;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "[NonExistingOptionalATError - Source: " + getSource() + " - alias: " + getAlias() + "]";
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingSyntaxError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingSyntaxError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingSyntaxError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/NonExistingSyntaxError.java Mon Jul  9 07:35:09 2007
@@ -53,11 +53,8 @@
     }
 
 
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
      */
     public SchemaObject getSource()
     {

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java Mon Jul  9 07:35:09 2007
@@ -29,12 +29,11 @@
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerAdapter;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener;
 import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
-import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
 import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
 import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
-import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
 import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingMatchingRuleError.NonExistingMatchingRuleErrorEnum;
 
 
@@ -66,107 +65,78 @@
     /** The 'listening to modifications' flag*/
     private boolean listeningToModifications = false;
 
+    /** The listeners List */
+    private List<SchemaCheckerListener> listeners;
+
     /** The SchemaHandlerListener */
-    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerListener()
+    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
     {
         public void attributeTypeAdded( AttributeTypeImpl at )
         {
-            // TODO Auto-generated method stub
-            System.out.println( "AT Added" );
             checkAttributeType( at );
         }
 
 
         public void attributeTypeModified( AttributeTypeImpl at )
         {
-            // TODO Auto-generated method stub
-
+            checkAttributeType( at );
         }
 
 
         public void attributeTypeRemoved( AttributeTypeImpl at )
         {
-            // TODO Auto-generated method stub
-
-        }
-
-
-        public void matchingRuleAdded( MatchingRuleImpl mr )
-        {
-            // TODO Auto-generated method stub
-
-        }
-
-
-        public void matchingRuleModified( MatchingRuleImpl mr )
-        {
-            // TODO Auto-generated method stub
-
-        }
-
-
-        public void matchingRuleRemoved( MatchingRuleImpl mr )
-        {
-            // TODO Auto-generated method stub
-
+            removeSchemaObject( at );
         }
 
 
         public void objectClassAdded( ObjectClassImpl oc )
         {
-            // TODO Auto-generated method stub
-
+            checkObjectClass( oc );
         }
 
 
         public void objectClassModified( ObjectClassImpl oc )
         {
-            // TODO Auto-generated method stub
-
+            checkObjectClass( oc );
         }
 
 
         public void objectClassRemoved( ObjectClassImpl oc )
         {
-            // TODO Auto-generated method stub
-
+            removeSchemaObject( oc );
         }
 
 
         public void schemaAdded( Schema schema )
         {
-            // TODO Auto-generated method stub
+            List<AttributeTypeImpl> ats = schema.getAttributeTypes();
+            for ( AttributeTypeImpl at : ats )
+            {
+                checkAttributeType( at );
+            }
 
+            List<ObjectClassImpl> ocs = schema.getObjectClasses();
+            for ( ObjectClassImpl oc : ocs )
+            {
+                checkObjectClass( oc );
+            }
         }
 
 
         public void schemaRemoved( Schema schema )
         {
-            // TODO Auto-generated method stub
-
-        }
-
-
-        public void syntaxAdded( SyntaxImpl syntax )
-        {
-            // TODO Auto-generated method stub
-
-        }
-
-
-        public void syntaxModified( SyntaxImpl syntax )
-        {
-            // TODO Auto-generated method stub
-
-        }
-
-
-        public void syntaxRemoved( SyntaxImpl syntax )
-        {
-            // TODO Auto-generated method stub
+            List<AttributeTypeImpl> ats = schema.getAttributeTypes();
+            for ( AttributeTypeImpl at : ats )
+            {
+                removeSchemaObject( at );
+            }
 
+            List<ObjectClassImpl> ocs = schema.getObjectClasses();
+            for ( ObjectClassImpl oc : ocs )
+            {
+                removeSchemaObject( oc );
+            }
         }
-
     };
 
 
@@ -180,6 +150,7 @@
         errorsMap = new MultiValueMap();
         warningsList = new ArrayList<SchemaWarning>();
         warningsMap = new MultiValueMap();
+        listeners = new ArrayList<SchemaCheckerListener>();
     }
 
 
@@ -268,7 +239,7 @@
      */
     private void checkAttributeType( AttributeTypeImpl at )
     {
-        removeSchemaObject( at );
+        removeSchemaObject( at, false );
 
         // Checking OID
         String oid = at.getOid();
@@ -292,7 +263,13 @@
 
         // Checking aliases
         String[] aliases = at.getNames();
-        if ( ( aliases != null ) && ( aliases.length >= 1 ) )
+        if ( ( aliases == null ) || ( aliases.length == 0 ) )
+        {
+            SchemaWarning warning = new NoAliasWarning( at );
+            warningsList.add( warning );
+            warningsMap.put( at, warning );
+        }
+        else if ( ( aliases != null ) && ( aliases.length >= 1 ) )
         {
             for ( String alias : aliases )
             {
@@ -375,6 +352,8 @@
                 errorsMap.put( at, error );
             }
         }
+
+        notifyListeners();
     }
 
 
@@ -386,7 +365,7 @@
      */
     private void checkObjectClass( ObjectClassImpl oc )
     {
-        removeSchemaObject( oc );
+        removeSchemaObject( oc, false );
 
         // Checking OID
         String oid = oc.getOid();
@@ -410,7 +389,13 @@
 
         // Checking aliases
         String[] aliases = oc.getNames();
-        if ( ( aliases != null ) && ( aliases.length >= 1 ) )
+        if ( ( aliases == null ) || ( aliases.length == 0 ) )
+        {
+            SchemaWarning warning = new NoAliasWarning( oc );
+            warningsList.add( warning );
+            warningsMap.put( oc, warning );
+        }
+        else if ( ( aliases != null ) && ( aliases.length >= 1 ) )
         {
             for ( String alias : aliases )
             {
@@ -462,9 +447,27 @@
                     errorsList.add( error );
                     errorsMap.put( oc, error );
                 }
+
+                if ( schemaHandler.getAttributeType( mandatoryAT ) == null )
+                {
+                    SchemaError error = new NonExistingMandatoryATError( oc, mandatoryAT );
+                    errorsList.add( error );
+                    errorsMap.put( oc, error );
+                }
             }
 
+            for ( String optionalAT : optionalATsList )
+            {
+                if ( schemaHandler.getAttributeType( optionalAT ) == null )
+                {
+                    SchemaError error = new NonExistingOptionalATError( oc, optionalAT );
+                    errorsList.add( error );
+                    errorsMap.put( oc, error );
+                }
+            }
         }
+
+        notifyListeners();
     }
 
 
@@ -476,6 +479,20 @@
      */
     private void removeSchemaObject( SchemaObject element )
     {
+        removeSchemaObject( element, true );
+    }
+
+
+    /**
+     * Remove the errors and warnings for the given schema element.
+     *
+     * @param element
+     *      a schema element
+     * @param notify
+     *      true if the listeners needs to be notified
+     */
+    private void removeSchemaObject( SchemaObject element, boolean notify )
+    {
         // Removing old errors and warnings
         List<?> errors = ( List<?> ) errorsMap.get( element );
         if ( ( errors != null ) && ( errors.size() >= 1 ) )
@@ -556,5 +573,44 @@
     public List<SchemaWarning> getWarnings()
     {
         return warningsList;
+    }
+
+
+    /**
+     * Adds a SchemaCheckerListener.
+     *
+     * @param listener
+     *      the listener
+     */
+    public void addListener( SchemaCheckerListener listener )
+    {
+        if ( !listeners.contains( listener ) )
+        {
+            listeners.add( listener );
+        }
+    }
+
+
+    /**
+     * Removes a SchemaCheckerListener.
+     *
+     * @param listener
+     *      the listener
+     */
+    public void removeListener( SchemaCheckerListener listener )
+    {
+        listeners.remove( listener );
+    }
+
+
+    /**
+     * Notifies the listeners.
+     */
+    private void notifyListeners()
+    {
+        for ( SchemaCheckerListener listener : listeners )
+        {
+            listener.schemaCheckerUpdated();
+        }
     }
 }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerListener.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerListener.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerListener.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,35 @@
+/*
+ *  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.apacheds.schemaeditor.model.schemachecker;
+
+/**
+ * Classes which implement this interface provide methods that deal with the 
+ * events that are generated when an event occurrs on the SchemaChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface SchemaCheckerListener
+{
+    /**
+     * This methods is called when the SchemaChecker is updated.
+     */
+    public void schemaCheckerUpdated();
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java Mon Jul  9 07:35:09 2007
@@ -20,6 +20,9 @@
 package org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker;
 
 
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
 /**
  * Common interface for the all the schema errors.
  *
@@ -28,4 +31,11 @@
  */
 public interface SchemaError
 {
+    /**
+     * Gets the source object.
+     * 
+     * @return
+     *      the source object
+     */
+    public SchemaObject getSource();
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java Mon Jul  9 07:35:09 2007
@@ -20,6 +20,9 @@
 package org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker;
 
 
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
 /**
  * Common interface for all the schema warnings.
  *
@@ -28,4 +31,11 @@
  */
 public interface SchemaWarning
 {
+    /**
+     * Gets the source object.
+     * 
+     * @return
+     *      the source object
+     */
+    public SchemaObject getSource();
 }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,76 @@
+/*
+ *  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.apacheds.schemaeditor.view;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProblemsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+
+/**
+ * This class represents the Schema Editor Perspective.
+ * <p>
+ * It is composed of two views, the Schema View and the Problems View, and the editor part.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Perspective implements IPerspectiveFactory
+{
+    /** The ID of the view */
+    public static final String ID = Activator.PLUGIN_ID + ".perspective"; //$NON-NLS-1$
+
+    /** The ID of the top left folder */
+    public static final String topLeftFolderId = "org.apache.directory.studio.apacheds.schemaeditor.topleftfolder"; //$NON-NLS-1$
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
+     */
+    public void createInitialLayout( IPageLayout layout )
+    {
+        // Allowing the Editor Area
+        layout.setEditorAreaVisible( true );
+        String editorAreaId = layout.getEditorArea();
+
+        // Creating top left folder 
+        IFolderLayout topLeftFolder = layout.createFolder( topLeftFolderId, IPageLayout.LEFT, 0.3f, editorAreaId );
+        layout.addPlaceholder( topLeftFolderId, IPageLayout.LEFT, 0.3f, editorAreaId );
+
+        // Adding Views
+        topLeftFolder.addView( SchemaView.ID );
+        layout.addStandaloneView( ProblemsView.ID, true, IPageLayout.BOTTOM, 0.7f, editorAreaId );
+
+        // Setting up non-closeable views
+        layout.getViewLayout( SchemaView.ID ).setCloseable( false );
+
+        // Adding Perspective shortcuts
+        layout.addPerspectiveShortcut( "org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective" ); //$NON-NLS-1$
+        layout.addPerspectiveShortcut( Perspective.ID );
+
+        // Adding View shortcuts
+        layout.addShowViewShortcut( SchemaView.ID );
+        layout.addShowViewShortcut( ProblemsView.ID );
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,138 @@
+/*
+ *  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.apacheds.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProblemsViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProblemsViewRoot;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+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.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;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPartControl( Composite parent )
+    {
+        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 );
+
+        Label overviewLabel = new Label( parent, SWT.NULL );
+        overviewLabel.setText( "X error(s), X warning(s)" );
+        overviewLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        initViewer( parent );
+
+        // Adding the 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 );
+        treeViewer.setContentProvider( contentProvider );
+        treeViewer.setLabelProvider( new ProblemsViewLabelProvider() );
+        treeViewer.setInput( new ProblemsViewRoot() );
+        treeViewer.expandAll();
+    }
+
+
+    /* (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();
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewContentProvider.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewContentProvider.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,180 @@
+/*
+ *  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.apacheds.schemaeditor.view.views;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaChecker;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaWarning;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProblemsViewRoot;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaErrorWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWarningWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.TreeNode;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder.FolderType;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+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
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of ProblemsViewContentProvider.
+     *
+     * @param viewer
+     *      the associated TreeViewer
+     */
+    public ProblemsViewContentProvider( TreeViewer viewer )
+    {
+        this.viewer = viewer;
+    }
+
+
+    /* (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();
+
+                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;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,131 @@
+/*
+ *  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.apacheds.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaErrorWrapper;
+import org.apache.directory.studio.apacheds.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
+{
+    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;
+    }
+
+
+    public String getColumnText( Object element, int columnIndex )
+    {
+        if ( element instanceof SchemaErrorWrapper )
+        {
+            SchemaErrorWrapper errorWrapper = ( SchemaErrorWrapper ) element;
+
+            if ( columnIndex == 0 )
+            {
+                return errorWrapper.getSchemaError().toString();
+            }
+            else if ( columnIndex == 1 )
+            {
+                String name = errorWrapper.getSchemaError().getSource().getName();
+
+                if ( ( name != null ) && ( !name.equals( "" ) ) )
+                {
+                    return name;
+                }
+                else
+                {
+                    return errorWrapper.getSchemaError().getSource().getOid();
+                }
+            }
+
+        }
+        else if ( element instanceof SchemaWarningWrapper )
+        {
+            SchemaWarningWrapper warningWrapper = ( SchemaWarningWrapper ) element;
+
+            if ( columnIndex == 0 )
+            {
+                return warningWrapper.getSchemaWarning().toString();
+            }
+            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();
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java Mon Jul  9 07:35:09 2007
@@ -48,10 +48,10 @@
 public class SchemaView extends ViewPart
 {
     /** The ID of the View */
-    public static final String ID = Activator.PLUGIN_ID + ".view.SchemasView"; //$NON-NLS-1$
+    public static final String ID = Activator.PLUGIN_ID + ".view.SchemaView"; //$NON-NLS-1$
 
     /** The viewer */
-    private TreeViewer viewer;
+    private TreeViewer treeViewer;
 
     /** The content provider of the viewer */
     private SchemaViewContentProvider contentProvider;
@@ -65,51 +65,51 @@
         initViewer( parent );
 
         // Registering the Viewer, so other views can be notified when the viewer selection changes
-        getSite().setSelectionProvider( viewer );
+        getSite().setSelectionProvider( treeViewer );
 
         // Adding the controller
         new SchemaViewController( this );
-        
-        DifferencesWidget differencesWidget = new DifferencesWidget();
-        differencesWidget.createWidget( parent );
-        
-        List<Difference> differences = new ArrayList<Difference>();
-        differences.add( new AddAliasDifference(null, null, "alias1") );
-        differences.add( new RemoveAliasDifference(null, null, "alias2") );
-        differences.add( new AddDescriptionDifference(null, null, "Description") );
-        differences.add( new ModifyDescriptionDifference(null, null, "Old description", "New Description") );
-        differences.add( new RemoveDescriptionDifference(null, null, "Description") );
-        differences.add( new AddEqualityDifference(null, null, "equality") );
-        differences.add( new ModifyEqualityDifference(null, null, "old equality", "new equality") );
-        differences.add( new RemoveEqualityDifference(null, null, "equality") );
-        differences.add( new AddMandatoryATDifference(null, null, "name") );
-        differences.add( new RemoveMandatoryATDifference(null, null, "name2") );
-        differences.add( new AddOptionalATDifference(null, null, "name") );
-        differences.add( new RemoveOptionalATDifference(null, null, "name2") );
-        differences.add( new AddOrderingDifference(null, null, "ordering") );
-        differences.add( new ModifyOrderingDifference(null, null, "old ordering", "new ordering") );
-        differences.add( new RemoveOrderingDifference(null, null, "ordering") );
-        differences.add( new AddSubstringDifference(null, null, "substring") );
-        differences.add( new ModifySubstringDifference(null, null, "old substring", "new substring") );
-        differences.add( new RemoveSubstringDifference(null, null, "substring") );
-        differences.add( new AddSuperiorATDifference(null, null, "supAT") );
-        differences.add( new ModifySuperiorATDifference(null, null, "oldSupAT", "newSupAT") );
-        differences.add( new RemoveSuperiorATDifference(null, null, "supAT") );
-        differences.add( new AddSuperiorOCDifference(null, null, "supOC") );
-        differences.add( new RemoveSuperiorOCDifference(null, null, "supOC") );
-        differences.add( new AddSyntaxDifference(null, null, "syntax") );
-        differences.add( new ModifySyntaxDifference(null, null, "syntax1", "syntax2") );
-        differences.add( new RemoveSyntaxDifference(null, null, "syntax") );
-        differences.add( new AddSyntaxLengthDifference(null, null, 1234) );
-        differences.add( new ModifySyntaxLengthDifference(null, null, 1234, 12345) );
-        differences.add( new RemoveSyntaxLengthDifference(null, null, 1234) );
-        differences.add( new ModifyClassTypeDifference(null, null, ObjectClassTypeEnum.AUXILIARY, ObjectClassTypeEnum.ABSTRACT) );
-        differences.add( new ModifyCollectiveDifference(null, null, false, true) );
-        differences.add( new ModifyNoUserModificationDifference(null, null, true, false) );
-        differences.add( new ModifyObsoleteDifference(null, null, true, false) );
-        differences.add( new ModifySingleValueDifference(null, null, true, false) );
-        differences.add( new ModifyUsageDifference(null, null, UsageEnum.DISTRIBUTED_OPERATION, UsageEnum.DSA_OPERATION) );
-        differencesWidget.setInput( differences );
+
+        //        DifferencesWidget differencesWidget = new DifferencesWidget();
+        //        differencesWidget.createWidget( parent );
+        //        
+        //        List<Difference> differences = new ArrayList<Difference>();
+        //        differences.add( new AddAliasDifference(null, null, "alias1") );
+        //        differences.add( new RemoveAliasDifference(null, null, "alias2") );
+        //        differences.add( new AddDescriptionDifference(null, null, "Description") );
+        //        differences.add( new ModifyDescriptionDifference(null, null, "Old description", "New Description") );
+        //        differences.add( new RemoveDescriptionDifference(null, null, "Description") );
+        //        differences.add( new AddEqualityDifference(null, null, "equality") );
+        //        differences.add( new ModifyEqualityDifference(null, null, "old equality", "new equality") );
+        //        differences.add( new RemoveEqualityDifference(null, null, "equality") );
+        //        differences.add( new AddMandatoryATDifference(null, null, "name") );
+        //        differences.add( new RemoveMandatoryATDifference(null, null, "name2") );
+        //        differences.add( new AddOptionalATDifference(null, null, "name") );
+        //        differences.add( new RemoveOptionalATDifference(null, null, "name2") );
+        //        differences.add( new AddOrderingDifference(null, null, "ordering") );
+        //        differences.add( new ModifyOrderingDifference(null, null, "old ordering", "new ordering") );
+        //        differences.add( new RemoveOrderingDifference(null, null, "ordering") );
+        //        differences.add( new AddSubstringDifference(null, null, "substring") );
+        //        differences.add( new ModifySubstringDifference(null, null, "old substring", "new substring") );
+        //        differences.add( new RemoveSubstringDifference(null, null, "substring") );
+        //        differences.add( new AddSuperiorATDifference(null, null, "supAT") );
+        //        differences.add( new ModifySuperiorATDifference(null, null, "oldSupAT", "newSupAT") );
+        //        differences.add( new RemoveSuperiorATDifference(null, null, "supAT") );
+        //        differences.add( new AddSuperiorOCDifference(null, null, "supOC") );
+        //        differences.add( new RemoveSuperiorOCDifference(null, null, "supOC") );
+        //        differences.add( new AddSyntaxDifference(null, null, "syntax") );
+        //        differences.add( new ModifySyntaxDifference(null, null, "syntax1", "syntax2") );
+        //        differences.add( new RemoveSyntaxDifference(null, null, "syntax") );
+        //        differences.add( new AddSyntaxLengthDifference(null, null, 1234) );
+        //        differences.add( new ModifySyntaxLengthDifference(null, null, 1234, 12345) );
+        //        differences.add( new RemoveSyntaxLengthDifference(null, null, 1234) );
+        //        differences.add( new ModifyClassTypeDifference(null, null, ObjectClassTypeEnum.AUXILIARY, ObjectClassTypeEnum.ABSTRACT) );
+        //        differences.add( new ModifyCollectiveDifference(null, null, false, true) );
+        //        differences.add( new ModifyNoUserModificationDifference(null, null, true, false) );
+        //        differences.add( new ModifyObsoleteDifference(null, null, true, false) );
+        //        differences.add( new ModifySingleValueDifference(null, null, true, false) );
+        //        differences.add( new ModifyUsageDifference(null, null, UsageEnum.DISTRIBUTED_OPERATION, UsageEnum.DSA_OPERATION) );
+        //        differencesWidget.setInput( differences );
     }
 
 
@@ -118,12 +118,12 @@
      */
     private void initViewer( Composite parent )
     {
-        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
-        contentProvider = new SchemaViewContentProvider( viewer );
-        viewer.setContentProvider( contentProvider );
-        viewer.setLabelProvider( new DecoratingLabelProvider( new SchemaViewLabelProvider(), Activator.getDefault()
+        treeViewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        contentProvider = new SchemaViewContentProvider( treeViewer );
+        treeViewer.setContentProvider( contentProvider );
+        treeViewer.setLabelProvider( new DecoratingLabelProvider( new SchemaViewLabelProvider(), Activator.getDefault()
             .getWorkbench().getDecoratorManager().getLabelDecorator() ) );
-        viewer.setInput( new SchemaViewRoot() );
+        treeViewer.setInput( new SchemaViewRoot() );
     }
 
 
@@ -132,8 +132,7 @@
      */
     public void setFocus()
     {
-        // TODO Auto-generated method stub
-
+        treeViewer.getTree().setFocus();
     }
 
 
@@ -145,7 +144,7 @@
      */
     public TreeViewer getViewer()
     {
-        return viewer;
+        return treeViewer;
     }
 
 
@@ -154,6 +153,6 @@
      */
     public void reloadViewer()
     {
-        viewer.setInput( new SchemaViewRoot() );
+        treeViewer.setInput( new SchemaViewRoot() );
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java Mon Jul  9 07:35:09 2007
@@ -17,7 +17,7 @@
      */
     public enum FolderType
     {
-        NONE, ATTRIBUTE_TYPE, OBJECT_CLASS
+        NONE, ATTRIBUTE_TYPE, OBJECT_CLASS, ERROR, WARNING
     }
 
     /** The type of the Folder */
@@ -25,9 +25,11 @@
 
     /** The name of the Folder */
     private String name = "";
-    
+
     private static final String NAME_AT = "Attribute Types";
     private static final String NAME_OC = "Object Classes";
+    private static final String NAME_ERROR = "Errors";
+    private static final String NAME_WARNING = "Warnings";
 
 
     /**
@@ -42,7 +44,7 @@
     {
         super( parent );
         this.type = type;
-        
+
         switch ( type )
         {
             case ATTRIBUTE_TYPE:
@@ -50,6 +52,12 @@
                 break;
             case OBJECT_CLASS:
                 name = NAME_OC;
+                break;
+            case ERROR:
+                name = NAME_ERROR;
+                break;
+            case WARNING:
+                name = NAME_WARNING;
                 break;
         }
     }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProblemsViewRoot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProblemsViewRoot.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProblemsViewRoot.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProblemsViewRoot.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,38 @@
+/*
+ *  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.apacheds.schemaeditor.view.wrappers;
+
+
+/**
+ * This wrapper is used as root in the Problems View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProblemsViewRoot extends AbstractTreeNode
+{
+    /**
+     * Creates a new instance of ProblemsViewRoot.
+     */
+    public ProblemsViewRoot()
+    {
+        super( null );
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaErrorWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaErrorWrapper.java?view=auto&rev=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaErrorWrapper.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaErrorWrapper.java Mon Jul  9 07:35:09 2007
@@ -0,0 +1,85 @@
+/*
+ *  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.apacheds.schemaeditor.view.wrappers;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError;
+
+
+/**
+ * This class is used to wrap a SchemaError in a TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaErrorWrapper extends AbstractTreeNode
+{
+    /** The wrapped SchemaError */
+    private SchemaError schemaError;
+
+
+    /**
+     * Creates a new instance of SchemaErrorWrapper.
+     *
+     * @param error
+     *      the wrapped SchemaError
+     */
+    public SchemaErrorWrapper( SchemaError error )
+    {
+        super( null );
+        schemaError = error;
+    }
+
+
+    /**
+     * Creates a new instance of SchemaErrorWrapper.
+     * 
+     * @param error
+     *      the wrapped SchemaError
+     * @param parent
+     *      the parent TreeNode
+     */
+    public SchemaErrorWrapper( SchemaError error, TreeNode parent )
+    {
+        super( parent );
+        schemaError = error;
+    }
+
+
+    /**
+     * Gets the wrapped SchemaError.
+     *
+     * @return
+     *      the wrapped SchemaError
+     */
+    public SchemaError getSchemaError()
+    {
+        return schemaError;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AbstractTreeNode#hasChildren()
+     */
+    public boolean hasChildren()
+    {
+        return false;
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java?view=diff&rev=554663&r1=554662&r2=554663
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java Mon Jul  9 07:35:09 2007
@@ -1,6 +1,31 @@
-
+/*
+ *  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.apacheds.schemaeditor.view.wrappers;
 
+
+/**
+ * This wrapper is used as root in the Schema View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class SchemaViewRoot extends AbstractTreeNode
 {
     /**



Mime
View raw message