directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r559090 - 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/model/schemachecker/ src...
Date Tue, 24 Jul 2007 15:59:51 GMT
Author: pamarcelot
Date: Tue Jul 24 08:59:49 2007
New Revision: 559090

URL: http://svn.apache.org/viewvc?view=rev&rev=559090
Log:
Added the Schema Editor Schema Checker Label Decorator.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/overlay_error.gif
  (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/overlay_warning.gif
  (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.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/PluginConstants.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.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=559090&r1=559089&r2=559090
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Tue Jul 24 08:59:49 2007
@@ -216,5 +216,27 @@
              Decorates Schema Editor icons with type information
           </description>
        </decorator>
+	   <decorator
+             adaptable="false"
+             class="org.apache.directory.studio.apacheds.schemaeditor.view.SchemaEditorSchemaCheckerLabelDecorator"
+             id="org.apache.directory.studio.schemas.schemaCheckerDecorator"
+             label="Schema Editor Schema Checker Decorator"
+             lightweight="true"
+             location="BOTTOM_LEFT"
+             state="true">
+          <enablement>
+             <or>
+                <objectClass
+                      name="org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper">
+                </objectClass>
+                <objectClass
+                      name="org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper">
+                </objectClass>
+             </or>
+          </enablement>
+          <description>
+             Decorates Schema Editor icons with schema checker information
+          </description>
+       </decorator>
     </extension>
 </plugin>

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

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

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

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

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java?view=diff&rev=559090&r1=559089&r2=559090
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
Tue Jul 24 08:59:49 2007
@@ -64,6 +64,8 @@
     public static final String IMG_OBJECT_CLASS_OVERLAY_ABSTRACT = "resources/icons/object_class_overlay_abstract.gif";
     public static final String IMG_OBJECT_CLASS_OVERLAY_AUXILIARY = "resources/icons/object_class_overlay_auxiliary.gif";
     public static final String IMG_OBJECT_CLASS_OVERLAY_STRUCTURAL = "resources/icons/object_class_overlay_structural.gif";
+    public static final String IMG_OVERLAY_ERROR = "resources/icons/overlay_error.gif";
+    public static final String IMG_OVERLAY_WARNING = "resources/icons/overlay_warning.gif";
     public static final String IMG_PROBLEMS_ERROR = "resources/icons/problems_error.gif";
     public static final String IMG_PROBLEMS_GROUP = "resources/icons/problems_group.gif";
     public static final String IMG_PROBLEMS_WARNING = "resources/icons/problems_warning.gif";

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=559090&r1=559089&r2=559090
==============================================================================
--- 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
Tue Jul 24 08:59:49 2007
@@ -627,4 +627,78 @@
             listener.schemaCheckerUpdated();
         }
     }
+
+
+    /**
+     * Gets the errors associated with the given Schema Object
+     *
+     * @param so
+     *      the Schema Object
+     * @return
+     *      the associated errors
+     */
+    public List<?> getErrors( SchemaObject so )
+    {
+        return ( List<?> ) errorsMap.get( so );
+    }
+
+
+    /**
+     * Returns whether the given Schema Object has errors.
+     *
+     * @param so
+     *      the Schema Object
+     * @return
+     *      true if the given Schema Object has errors.
+     */
+    public boolean hasErrors( SchemaObject so )
+    {
+        List<?> errors = getErrors( so );
+
+        if ( errors == null )
+        {
+            return false;
+        }
+        else
+        {
+            return errors.size() > 0;
+        }
+    }
+
+
+    /**
+     * Gets the warnings associated with the given Schema Object
+     *
+     * @param so
+     *      the Schema Object
+     * @return
+     *      the associated warnings
+     */
+    public List<?> getWarnings( SchemaObject so )
+    {
+        return ( List<?> ) warningsMap.get( so );
+    }
+
+
+    /**
+     * Returns whether the given Schema Object has warnings.
+     *
+     * @param so
+     *      the Schema Object
+     * @return
+     *      true if the given Schema Object has errors.
+     */
+    public boolean hasWarnings( SchemaObject so )
+    {
+        List<?> warnings = getWarnings( so );
+
+        if ( warnings == null )
+        {
+            return false;
+        }
+        else
+        {
+            return warnings.size() > 0;
+        }
+    }
 }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java?view=auto&rev=559090
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
(added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
Tue Jul 24 08:59:49 2007
@@ -0,0 +1,87 @@
+/*
+ *  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.PluginConstants;
+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.SchemaChecker;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Schemas Editor Schema Checker Label Decorator. 
+ * It displays specific icons overlays for attribute types and object classes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaEditorSchemaCheckerLabelDecorator extends LabelProvider implements ILightweightLabelDecorator
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object,
org.eclipse.jface.viewers.IDecoration)
+     */
+    public void decorate( Object element, IDecoration decoration )
+    {
+        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
+
+        if ( element instanceof AttributeTypeWrapper )
+        {
+            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) element ).getAttributeType();
+
+            if ( schemaChecker.hasErrors( at ) )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
+                return;
+            }
+
+            if ( schemaChecker.hasWarnings( at ) )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
+            }
+        }
+        else if ( element instanceof ObjectClassWrapper )
+        {
+            ObjectClassImpl oc = ( ( ObjectClassWrapper ) element ).getObjectClass();
+
+            if ( schemaChecker.hasErrors( oc ) )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
+                return;
+            }
+
+            if ( schemaChecker.hasWarnings( oc ) )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
+            }
+        }
+    }
+}



Mime
View raw message