1 19 20 package org.netbeans.modules.xml.wsdlextui.property; 21 22 23 import java.util.Arrays ; 24 import java.util.Collection ; 25 26 import javax.xml.namespace.QName ; 27 28 import org.netbeans.modules.xml.wsdl.model.BindingInput; 29 import org.netbeans.modules.xml.wsdl.model.BindingOutput; 30 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement; 31 import org.netbeans.modules.xml.wsdl.model.Input; 32 import org.netbeans.modules.xml.wsdl.model.Message; 33 import org.netbeans.modules.xml.wsdl.model.Output; 34 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 35 import org.netbeans.modules.xml.wsdl.ui.api.property.ExtensibilityElementPropertyAdapter; 36 import org.netbeans.modules.xml.wsdl.ui.api.property.MessageProvider; 37 import org.netbeans.modules.xml.wsdl.ui.api.property.PartAttributeProperty; 38 import org.netbeans.modules.xml.wsdl.ui.spi.ExtensibilityElementConfigurator; 39 import org.openide.ErrorManager; 40 import org.openide.nodes.Node; 41 import org.openide.util.NbBundle; 42 43 47 public class SoapBodyConfigurator extends ExtensibilityElementConfigurator { 48 49 50 private static QName myQName = new QName ("http://schemas.xmlsoap.org/wsdl/soap/", "body"); 51 52 private static QName [] supportedQNames = {myQName}; 53 54 public SoapBodyConfigurator() { 55 } 56 57 @Override 58 public Collection <QName > getSupportedQNames() { 59 return Arrays.asList(supportedQNames); 60 } 61 62 @Override 63 public Node.Property getProperty(ExtensibilityElement extensibilityElement, QName qname, String attributeName) { 64 Node.Property property = null; 65 if (myQName.equals(qname)) { 66 if ("parts".equals(attributeName)) { 67 try { 68 property = new PartAttributeProperty(new SoapBodyMessageProvider(extensibilityElement), extensibilityElement.getModel(), new ExtensibilityElementPropertyAdapter(extensibilityElement, attributeName), String .class, "getValue", "setValue", true); 69 property.setName(NbBundle.getMessage(SoapAddressConfigurator.class, "PROP_NAME_BODY_PARTS")); 70 } catch (NoSuchMethodException e) { 71 ErrorManager.getDefault().notify(e); 72 } 73 } 74 } 75 return property; 76 } 77 78 79 static class SoapBodyMessageProvider implements MessageProvider { 80 private ExtensibilityElement element; 81 82 public SoapBodyMessageProvider(ExtensibilityElement elem) { 83 element = elem; 84 } 85 86 public String getMessage() { 87 return null; 88 } 89 90 public Message getWSDLMessage() { 91 WSDLComponent component = element.getParent(); 92 Message message = null; 93 if (component instanceof BindingInput) { 94 BindingInput bi = (BindingInput)component; 95 if (bi.getInput() != null) { 96 Input input = bi.getInput().get(); 97 if (input != null && input.getMessage() != null) { 98 message = input.getMessage().get(); 99 return message; 100 } 101 } 102 } else if (component instanceof BindingOutput) { 103 BindingOutput bi = (BindingOutput)component; 104 if (bi.getOutput() != null) { 105 Output output = bi.getOutput().get(); 106 if (output != null && output.getMessage() != null) { 107 message = output.getMessage().get(); 108 return message; 109 } 110 } 111 } 112 return null; 113 } 114 115 } 116 117 118 @Override 119 public String getDisplayAttributeName(ExtensibilityElement extensibilityElement, QName qname) { 120 return null; 122 } 123 124 @Override 125 public String getAttributeUniqueValuePrefix(ExtensibilityElement extensibilityElement, QName qname, String attributeName) { 126 return null; 128 } 129 130 @Override 131 public String getDefaultValue(ExtensibilityElement extensibilityElement, QName qname, String attributeName) { 132 return null; 134 } 135 136 @Override 137 public String getTypeDisplayName(ExtensibilityElement extensibilityElement, QName qname) { 138 return NbBundle.getMessage(SoapBodyConfigurator.class, "LBL_SoapBody_TypeDisplayName"); 139 } 140 } 141 | Popular Tags |