1 20 package org.apache.directory.ldapstudio.schemas.view.views; 21 22 23 import java.util.HashMap ; 24 import java.util.Map ; 25 26 import org.eclipse.jface.text.TextAttribute; 27 import org.eclipse.swt.SWT; 28 import org.eclipse.swt.graphics.Color; 29 import org.eclipse.swt.graphics.RGB; 30 import org.eclipse.swt.widgets.Display; 31 32 33 39 public class SchemaTextAttributeProvider 40 { 41 public static final String DEFAULT_ATTRIBUTE = "__pos_schema_default_attribute"; public static final String STRING_ATTRIBUTE = "__pos_schema_string_attribute"; public static final String KEYWORD_ATTRIBUTE = "__pos_schema_keyword_attribute"; public static final String ATTRIBUTETYPE_ATTRIBUTE = "__pos_schema_attributetype_attribute"; public static final String OBJECTCLASS_ATTRIBUTE = "__pos_schema_objectclass_attribute"; public static final String OID_ATTRIBUTE = "__pos_schema_oid_attribute"; 48 private Map <String , TextAttribute> attributes = new HashMap <String , TextAttribute>(); 49 50 51 55 public SchemaTextAttributeProvider() 56 { 57 attributes.put( DEFAULT_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 0, 0 ) ) ) ); 58 59 attributes.put( KEYWORD_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 127, 0, 85 ) ), 60 null, SWT.BOLD ) ); 61 62 attributes.put( STRING_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 0, 255 ) ) ) ); 63 64 attributes.put( ATTRIBUTETYPE_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 89, 71, 65 158 ) ), null, SWT.BOLD ) ); 66 67 attributes.put( OBJECTCLASS_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), 68 new RGB( 45, 124, 68 ) ), null, SWT.BOLD ) ); 69 70 attributes.put( OID_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 255, 0, 0 ) ) ) ); 71 } 72 73 74 82 public TextAttribute getAttribute( String type ) 83 { 84 TextAttribute attr = ( TextAttribute ) attributes.get( type ); 85 if ( attr == null ) 86 { 87 attr = ( TextAttribute ) attributes.get( DEFAULT_ATTRIBUTE ); 88 } 89 return attr; 90 } 91 } 92 | Popular Tags |