1 20 21 package org.apache.directory.ldapstudio.schemas.view.editors.objectClass; 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.view.ViewUtils; 28 import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType; 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 41 public class ObjectClassEditorAttributesTableLabelProvider extends LabelProvider implements ITableLabelProvider 42 { 43 46 public Image getColumnImage( Object element, int columnIndex ) 47 { 48 if ( ( element instanceof AttributeType ) || ( element instanceof NonExistingAttributeType ) ) 49 { 50 return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_ATTRIBUTE_TYPE ) 51 .createImage(); 52 } 53 54 return null; 56 } 57 58 59 62 public String getColumnText( Object element, int columnIndex ) 63 { 64 if ( element instanceof AttributeType ) 65 { 66 return ViewUtils.concateAliases( ( ( AttributeType ) element ).getNames() ); 67 } 68 else if ( element instanceof NonExistingAttributeType ) 69 { 70 return ( ( NonExistingAttributeType ) element ).getDisplayName(); 71 } 72 73 return null; 75 } 76 } 77 | Popular Tags |