You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/07/24 17:26:12 UTC

svn commit: r559082 - 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/view/

Author: pamarcelot
Date: Tue Jul 24 08:26:10 2007
New Revision: 559082

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

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/attribute_type_overlay_operation.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/attribute_type_overlay_userApplication.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class_overlay_abstract.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class_overlay_auxiliary.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class_overlay_structural.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorTypeLabelDecorator.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

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=559082&r1=559081&r2=559082
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Tue Jul 24 08:26:10 2007
@@ -192,4 +192,29 @@
             id="org.apache.directory.studio.apacheds.schemaeditor.preferences.schemaView"
             name="Schema View"/>
    </extension>
+    <extension
+          point="org.eclipse.ui.decorators">
+       <decorator
+             adaptable="false"
+             class="org.apache.directory.studio.apacheds.schemaeditor.view.SchemaEditorTypeLabelDecorator"
+             id="org.apache.directory.studio.schemas.typeDecorator"
+             label="Schema Editor Type Decorator"
+             lightweight="true"
+             location="BOTTOM_RIGHT"
+             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 type information
+          </description>
+       </decorator>
+    </extension>
 </plugin>

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

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

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

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

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

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

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

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

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

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class_overlay_structural.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=559082&r1=559081&r2=559082
==============================================================================
--- 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:26:10 2007
@@ -35,6 +35,8 @@
     public static final String IMG_ATTRIBUTE_TYPE = "resources/icons/attribute_type.gif";
     public static final String IMG_ATTRIBUTE_TYPE_NEW = "resources/icons/attribute_type_new.gif";
     public static final String IMG_ATTRIBUTE_TYPE_NEW_WIZARD = "resources/icons/attribute_type_new_wizard.png";
+    public static final String IMG_ATTRIBUTE_TYPE_OVERLAY_OPERATION = "resources/icons/attribute_type_overlay_operation.gif";
+    public static final String IMG_ATTRIBUTE_TYPE_OVERLAY_USER_APPLICATION = "resources/icons/attribute_type_overlay_userApplication.gif";
     public static final String IMG_CONNECT = "resources/icons/connect.gif";
     public static final String IMG_COMMIT_CHANGES_WIZARD = "resources/icons/commit_changes_wizard.png";
     public static final String IMG_COLLAPSE_ALL = "resources/icons/collapse_all.gif";
@@ -59,6 +61,9 @@
     public static final String IMG_OBJECT_CLASS = "resources/icons/object_class.gif";
     public static final String IMG_OBJECT_CLASS_NEW = "resources/icons/object_class_new.gif";
     public static final String IMG_OBJECT_CLASS_NEW_WIZARD = "resources/icons/object_class_new_wizard.png";
+    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_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";

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorTypeLabelDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorTypeLabelDecorator.java?view=auto&rev=559082
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorTypeLabelDecorator.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/SchemaEditorTypeLabelDecorator.java Tue Jul 24 08:26:10 2007
@@ -0,0 +1,90 @@
+/*
+ *  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.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+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.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 Type 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 SchemaEditorTypeLabelDecorator 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 )
+    {
+        if ( element instanceof AttributeTypeWrapper )
+        {
+            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) element;
+
+            UsageEnum usage = atw.getAttributeType().getUsage();
+
+            if ( usage == UsageEnum.USER_APPLICATIONS )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_ATTRIBUTE_TYPE_OVERLAY_USER_APPLICATION ), IDecoration.BOTTOM_RIGHT );
+            }
+            else if ( ( usage == UsageEnum.DIRECTORY_OPERATION ) || ( usage == UsageEnum.DISTRIBUTED_OPERATION )
+                || ( usage == UsageEnum.DSA_OPERATION ) )
+            {
+                decoration.addOverlay( Activator.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_ATTRIBUTE_TYPE_OVERLAY_OPERATION ), IDecoration.BOTTOM_RIGHT );
+            }
+        }
+        else if ( element instanceof ObjectClassWrapper )
+        {
+            ObjectClassWrapper ocw = ( ObjectClassWrapper ) element;
+
+            ObjectClassTypeEnum classType = ocw.getObjectClass().getType();
+
+            if ( classType == ObjectClassTypeEnum.ABSTRACT )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OBJECT_CLASS_OVERLAY_ABSTRACT ), IDecoration.BOTTOM_RIGHT );
+            }
+            else if ( classType == ObjectClassTypeEnum.STRUCTURAL )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OBJECT_CLASS_OVERLAY_STRUCTURAL ), IDecoration.BOTTOM_RIGHT );
+            }
+            else if ( classType == ObjectClassTypeEnum.AUXILIARY )
+            {
+                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_OBJECT_CLASS_OVERLAY_AUXILIARY ), IDecoration.BOTTOM_RIGHT );
+            }
+        }
+    }
+}