1 19 20 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor.newtype; 21 22 import java.io.IOException ; 23 24 import org.netbeans.modules.xml.wsdl.model.Input; 25 import org.netbeans.modules.xml.wsdl.model.Operation; 26 import org.netbeans.modules.xml.wsdl.model.PortType; 27 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 28 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 29 import org.netbeans.modules.xml.wsdl.ui.actions.ActionHelper; 30 import org.netbeans.modules.xml.wsdl.ui.actions.NameGenerator; 31 import org.openide.util.NbBundle; 32 import org.openide.util.datatransfer.NewType; 33 34 public class OneWayOperationNewType extends NewType { 35 private PortType mPortType = null; 36 37 public OneWayOperationNewType(WSDLComponent message) { 38 mPortType = (PortType) message; 39 } 40 41 42 @Override 43 public String getName() { 44 return NbBundle.getMessage(OneWayOperationNewType.class, "LBL_NewType_OneWayOperation"); 45 } 46 47 48 @Override 49 public void create() throws IOException { 50 WSDLModel model = mPortType.getModel(); 51 model.startTransaction(); 52 String operationName = NameGenerator.getInstance().generateUniqueOperationName(mPortType); 53 Operation operation = model.getFactory().createOneWayOperation(); 54 operation.setName(operationName); 55 mPortType.addOperation(operation); 56 Input input = model.getFactory().createInput(); 57 String inputName = NameGenerator.getInstance().generateUniqueOperationInputName(operation); 58 input.setName(inputName); 59 operation.setInput(input); 60 model.endTransaction(); 61 ActionHelper.selectNode(operation); 62 } 63 } 64 | Popular Tags |