directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r514680 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ./ ressources/icons/ src/main/java/org/apache/directory/ldapstudio/schemas/ src/main/java/org/apache/directory/ldapstudio/schemas/view/ src/main/java/org/apache/directory/l...
Date Mon, 05 Mar 2007 14:48:40 GMT
Author: pamarcelot
Date: Mon Mar  5 06:48:39 2007
New Revision: 514680

URL: http://svn.apache.org/viewvc?view=rev&rev=514680
Log:
Fixed DIRSTUDIO-44 (Add small hover icon identifiers for OC and AC to differenciate them).
The icons will need to be updated later.

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_operation.gif
  (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_userApplication.gif
  (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_abstract.gif
  (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_auxiliary.gif
  (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_structural.gif
  (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/SchemasEditorLabelDecorator.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/TableDecoratingLabelProvider.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewContentProvider.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml?view=diff&rev=514680&r1=514679&r2=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml Mon Mar  5 06:48:39 2007
@@ -200,4 +200,29 @@
          point="org.eclipse.core.runtime.preferences">
       <initializer class="org.apache.directory.ldapstudio.schemas.controller.PreferenceInitializer"/>
    </extension>
+   <extension
+         point="org.eclipse.ui.decorators">
+      <decorator
+            adaptable="false"
+            class="org.apache.directory.ldapstudio.schemas.view.SchemasEditorLabelDecorator"
+            id="org.apache.directory.ldapstudio.schemas.decorator"
+            label="Schemas Editor Decorator"
+            lightweight="true"
+            location="BOTTOM_RIGHT"
+            state="true">
+            <enablement>
+          		<or>
+            		<objectClass name="org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper"/>
+            		<objectClass name="org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper"/>
+            		<objectClass name="org.apache.directory.ldapstudio.schemas.model.AttributeType"/>
+            		<objectClass name="org.apache.directory.ldapstudio.schemas.model.ObjectClass"/>
+          		
+          		
+          		</or>
+       		</enablement>
+       		<description>
+          		Decorates Schemas Editor icons
+       		</description>
+       	</decorator>
+   </extension>
 </plugin>

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_operation.gif
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_operation.gif?view=auto&rev=514680
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_operation.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_userApplication.gif
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_userApplication.gif?view=auto&rev=514680
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/attribute_type_overlay_userApplication.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_abstract.gif
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_abstract.gif?view=auto&rev=514680
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_abstract.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_auxiliary.gif
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_auxiliary.gif?view=auto&rev=514680
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_auxiliary.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_structural.gif
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_structural.gif?view=auto&rev=514680
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/object_class_overlay_structural.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java?view=diff&rev=514680&r1=514679&r2=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
Mon Mar  5 06:48:39 2007
@@ -150,13 +150,12 @@
 
     /** The prefence value for Schemas View Sorting 'descending' */
     public static final int PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING = 1;
-    
+
     // Preferences - Search View
-    
+
     /** The preference ID for Search History of the Search View */
     public static final String PREFS_SEARCH_VIEW_SEARCH_HISTORY = Activator.PLUGIN_ID
-    + ".preferences.SearchView.searchHistory";;
-    
+        + ".preferences.SearchView.searchHistory";;
 
     // Images - Actions
     public static final String IMG_ABOUT = "ressources/icons/flag_blue.png"; //$NON-NLS-1$
@@ -185,6 +184,11 @@
     public static final String IMG_OBJECT_CLASS_WARNING = "ressources/icons/object_class_warning.gif";
//$NON-NLS-1$
     public static final String IMG_SCHEMA = "ressources/icons/schema.gif"; //$NON-NLS-1$
     public static final String IMG_SCHEMA_CORE = "ressources/icons/schema_core.gif"; //$NON-NLS-1$
+    public static final String IMG_OBJECT_CLASS_OVERLAY_ABSTRACT = "ressources/icons/object_class_overlay_abstract.gif";
//$NON-NLS-1$
+    public static final String IMG_OBJECT_CLASS_OVERLAY_STRUCTURAL = "ressources/icons/object_class_overlay_structural.gif";
//$NON-NLS-1$
+    public static final String IMG_OBJECT_CLASS_OVERLAY_AUXILIARY = "ressources/icons/object_class_overlay_auxiliary.gif";
//$NON-NLS-1$
+    public static final String IMG_ATTRIBUTE_TYPE_OVERLAY_USER_APPLICATION = "ressources/icons/attribute_type_overlay_userApplication.gif";
//$NON-NLS-1$
+    public static final String IMG_ATTRIBUTE_TYPE_OVERLAY_OPERATION = "ressources/icons/attribute_type_overlay_operation.gif";
//$NON-NLS-1$
 
     // Images - Wizards
     public static final String IMG_ATTRIBUTE_TYPE_NEW_WIZARD = "ressources/icons/attribute_type_new_wizard.png";
//$NON-NLS-1$

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/SchemasEditorLabelDecorator.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/SchemasEditorLabelDecorator.java?view=auto&rev=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/SchemasEditorLabelDecorator.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/SchemasEditorLabelDecorator.java
Mon Mar  5 06:48:39 2007
@@ -0,0 +1,132 @@
+/*
+ *  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.ldapstudio.schemas.view;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+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 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 SchemasEditorLabelDecorator 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.getMyAttributeType().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.getMyObjectClass().getClassType();
+
+            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
);
+            }
+        }
+        else if ( element instanceof AttributeType )
+        {
+            AttributeType at = ( AttributeType ) element;
+
+            UsageEnum usage = at.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 ObjectClass )
+        {
+            ObjectClass oc = ( ObjectClass ) element;
+
+            ObjectClassTypeEnum classType = oc.getClassType();
+
+            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
);
+            }
+        }
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java?view=diff&rev=514680&r1=514679&r2=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
Mon Mar  5 06:48:39 2007
@@ -35,10 +35,11 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.FirstNameSorter;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.OidSorter;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.OidSorter;
 import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -225,7 +226,7 @@
                         if ( sups.length == 0 )
                         {
                             ObjectClassWrapper wrapper = new ObjectClassWrapper( oClass,
intermediate );
-                            if ( !"2.5.6.0".equals( oClass.getOid() )  )
+                            if ( !"2.5.6.0".equals( oClass.getOid() ) )
                             {
                                 wrapper.setState( ObjectClassWrapper.State.unResolved );
                             }
@@ -409,7 +410,8 @@
     public void bindToTreeViewer( TreeViewer viewer )
     {
         viewer.setContentProvider( this );
-        viewer.setLabelProvider( new HierarchyViewLabelProvider() );
+        viewer.setLabelProvider( new DecoratingLabelProvider( new HierarchyViewLabelProvider(),
Activator.getDefault()
+            .getWorkbench().getDecoratorManager().getLabelDecorator() ) );
 
         IntermediateNode invisibleNode = new IntermediateNode( "**Primary Node**", null );
//$NON-NLS-1$
         viewer.setInput( invisibleNode );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java?view=diff&rev=514680&r1=514679&r2=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
Mon Mar  5 06:48:39 2007
@@ -41,6 +41,7 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode.IntermediateNodeType;
 import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -66,7 +67,7 @@
 
     /** The OID Sorter */
     private OidSorter oidSorter;
-    
+
     /** The Schema Sorter */
     private SchemaSorter schemaSorter;
 
@@ -115,7 +116,7 @@
                 {
                     children.add( new SchemaWrapper( schemas[i], ( IntermediateNode ) parentElement
) );
                 }
-                
+
                 Collections.sort( children, schemaSorter );
             }
             else if ( intermediate.getType().equals( IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER
) )
@@ -257,7 +258,8 @@
     public void bindToTreeViewer( TreeViewer viewer )
     {
         viewer.setContentProvider( this );
-        viewer.setLabelProvider( new SchemasViewLabelProvider() );
+        viewer.setLabelProvider( new DecoratingLabelProvider( new SchemasViewLabelProvider(),
Activator.getDefault()
+            .getWorkbench().getDecoratorManager().getLabelDecorator() ) );
 
         IntermediateNode invisibleNode = new IntermediateNode( "**Primary Node**", null );
//$NON-NLS-1$
         viewer.setInput( invisibleNode );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchView.java?view=diff&rev=514680&r1=514679&r2=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchView.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchView.java
Mon Mar  5 06:48:39 2007
@@ -169,7 +169,8 @@
         createTableViewer();
         this.searchContentProvider = new SearchViewContentProvider();
         resultsTableViewer.setContentProvider( searchContentProvider );
-        resultsTableViewer.setLabelProvider( new SearchViewLabelProvider() );
+        resultsTableViewer.setLabelProvider( new TableDecoratingLabelProvider( new SearchViewLabelProvider(),
Activator
+            .getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
 
         initSearchHistory();
         initListeners();

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewContentProvider.java?view=diff&rev=514680&r1=514679&r2=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewContentProvider.java
Mon Mar  5 06:48:39 2007
@@ -41,6 +41,8 @@
 /**
  * Content provider for the search view
  *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class SearchViewContentProvider implements IStructuredContentProvider, PoolListener
 {

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/TableDecoratingLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/TableDecoratingLabelProvider.java?view=auto&rev=514680
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/TableDecoratingLabelProvider.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/TableDecoratingLabelProvider.java
Mon Mar  5 06:48:39 2007
@@ -0,0 +1,113 @@
+/*
+ *  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.ldapstudio.schemas.view.viewers;
+
+
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelDecorator;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ *  Class that supports Decoration of TableViewer and TreeViewer with TreeColumns
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class TableDecoratingLabelProvider extends DecoratingLabelProvider implements ITableLabelProvider
+{
+    ITableLabelProvider provider;
+    ILabelDecorator decorator;
+
+
+    /**
+     * @param provider
+     * @param decorator
+     */
+    public TableDecoratingLabelProvider( ILabelProvider provider, ILabelDecorator decorator
)
+    {
+        super( provider, decorator );
+        this.provider = ( ITableLabelProvider ) provider;
+        this.decorator = decorator;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
int)
+     */
+    public Image getColumnImage( Object element, int columnIndex )
+    {
+        Image image = provider.getColumnImage( element, columnIndex );
+        if ( decorator != null )
+        {
+            if ( decorator instanceof LabelDecorator )
+            {
+                LabelDecorator ld2 = ( LabelDecorator ) decorator;
+                Image decorated = ld2.decorateImage( image, element, getDecorationContext()
);
+                if ( decorated != null )
+                {
+                    return decorated;
+                }
+            }
+            else
+            {
+                Image decorated = decorator.decorateImage( image, element );
+                if ( decorated != null )
+                {
+                    return decorated;
+                }
+            }
+        }
+        return image;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
int)
+     */
+    public String getColumnText( Object element, int columnIndex )
+    {
+        String text = provider.getColumnText( element, columnIndex );
+        if ( decorator != null )
+        {
+            if ( decorator instanceof LabelDecorator )
+            {
+                LabelDecorator ld2 = ( LabelDecorator ) decorator;
+                String decorated = ld2.decorateText( text, element, getDecorationContext()
);
+                if ( decorated != null )
+                {
+                    return decorated;
+                }
+            }
+            else
+            {
+                String decorated = decorator.decorateText( text, element );
+                if ( decorated != null )
+                {
+                    return decorated;
+                }
+            }
+        }
+        return text;
+    }
+}
\ No newline at end of file



Mime
View raw message