1 20 21 package org.apache.directory.ldapstudio.schemas.view.views.wrappers; 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.Schema; 27 import org.eclipse.swt.graphics.Image; 28 import org.eclipse.ui.plugin.AbstractUIPlugin; 29 30 31 34 public class SchemaWrapper extends TreeNode 35 { 36 37 private Schema mySchema; 38 39 40 45 public SchemaWrapper( Schema mySchema, ITreeNode parent ) 46 { 47 super( parent ); 48 this.mySchema = mySchema; 49 } 50 51 52 55 public Schema getMySchema() 56 { 57 return mySchema; 58 } 59 60 61 64 public Image getImage() 65 { 66 if ( this.mySchema.type.equals( Schema.SchemaType.coreSchema ) ) 67 { 68 return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA_CORE ) 69 .createImage(); 70 } 71 else 72 { 73 return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA ) 74 .createImage(); 75 } 76 } 77 78 79 85 public String getName() 86 { 87 String res = ""; if ( mySchema.hasBeenModified() ) 89 res += "*"; return res + mySchema.getName(); 91 } 92 93 94 97 public boolean equals( Object obj ) 98 { 99 if ( obj instanceof SchemaWrapper ) 100 { 101 SchemaWrapper compared = ( SchemaWrapper ) obj; 102 return compared.getName().equals( this.getName() ); 103 } 104 return false; 105 } 106 107 108 111 public String toString() 112 { 113 return mySchema.getName() + " wrapper"; } 115 } 116 | Popular Tags |