1 20 21 package org.apache.directory.ldapstudio.schemas.view.views; 22 23 24 import org.apache.directory.ldapstudio.schemas.Activator; 25 import org.apache.directory.ldapstudio.schemas.PluginConstants; 26 import org.apache.directory.ldapstudio.schemas.model.AttributeType; 27 import org.apache.directory.ldapstudio.schemas.model.ObjectClass; 28 import org.apache.directory.ldapstudio.schemas.model.SchemaElement; 29 import org.eclipse.jface.viewers.ITableLabelProvider; 30 import org.eclipse.jface.viewers.LabelProvider; 31 import org.eclipse.swt.graphics.Image; 32 import org.eclipse.ui.plugin.AbstractUIPlugin; 33 34 35 39 public class SearchViewLabelProvider extends LabelProvider implements ITableLabelProvider 40 { 41 42 45 public Image getColumnImage( Object element, int columnIndex ) 46 { 47 if ( columnIndex == 0 ) 48 { 49 if ( element instanceof ObjectClass ) 50 { 51 return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, 52 PluginConstants.IMG_OBJECT_CLASS ).createImage(); 53 } 54 55 if ( element instanceof AttributeType ) 56 { 57 return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, 58 PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage(); 59 } 60 } 61 62 return null; 63 } 64 65 66 69 public String getColumnText( Object element, int columnIndex ) 70 { 71 String result = ""; if ( element instanceof SchemaElement ) 73 { 74 SchemaElement schemaElement = ( SchemaElement ) element; 75 switch ( columnIndex ) 76 { 77 case 0: break; 79 case 1: 80 result = schemaElement.getNames()[0]; 81 break; 82 case 2: 83 result = schemaElement.getOriginatingSchema().getName(); 84 break; 85 default: 86 break; 87 } 88 } 89 return result; 90 } 91 92 } 93 | Popular Tags |