1 19 20 package org.netbeans.modules.xml.schema.ui.nodes.categorized.customizer; 21 22 import java.io.IOException ; 23 import java.util.Map ; 24 import org.netbeans.modules.xml.schema.model.Redefine; 25 import org.netbeans.modules.xml.schema.model.Schema; 26 import org.netbeans.modules.xml.schema.model.SchemaModel; 27 import org.netbeans.modules.xml.xam.Model; 28 import org.netbeans.modules.xml.xam.ui.customizer.ExternalReferenceCustomizer; 29 import org.netbeans.modules.xml.xam.ui.customizer.ExternalReferenceDecorator; 30 import org.openide.util.HelpCtx; 31 32 38 public class RedefineCustomizer extends ExternalReferenceCustomizer<Redefine> { 39 private static final long serialVersionUID = 1L; 40 private ExternalReferenceDecorator decorator; 41 42 47 public RedefineCustomizer(Redefine redefine) { 48 super(redefine, null); 49 } 50 51 @Override 52 public void applyChanges() throws IOException { 53 super.applyChanges(); 54 if (isLocationChanged()) { 55 Redefine redefine = getModelComponent(); 56 redefine.setSchemaLocation(getEditedLocation()); 57 } 58 } 59 60 public boolean mustNamespaceDiffer() { 61 return false; 62 } 63 64 protected String getReferenceLocation() { 65 Redefine redefine = getModelComponent(); 66 return redefine.getSchemaLocation(); 67 } 68 69 protected String getNamespace() { 70 return null; 71 } 72 73 protected String getPrefix() { 74 return null; 75 } 76 77 public HelpCtx getHelpCtx() { 78 return new HelpCtx(RedefineCustomizer.class); 79 } 80 81 protected String getTargetNamespace(Model model) { 82 if (model instanceof SchemaModel) { 83 SchemaModel sm = (SchemaModel) model; 84 Schema schema = sm.getSchema(); 85 if (schema != null) { 86 return schema.getTargetNamespace(); 87 } 88 } 89 return null; 90 } 91 92 protected Map <String , String > getPrefixes(Model model) { 93 if (model instanceof SchemaModel) { 94 SchemaModel sm = (SchemaModel) model; 95 Schema schema = sm.getSchema(); 96 if (schema != null) { 97 return schema.getPrefixes(); 98 } 99 } 100 return null; 101 } 102 103 protected ExternalReferenceDecorator getNodeDecorator() { 104 if (decorator == null) { 105 decorator = new SchemaReferenceDecorator(this); 106 } 107 return decorator; 108 } 109 110 protected String generatePrefix() { 111 return ""; 112 } 113 } 114 | Popular Tags |