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.Message; 25 import org.netbeans.modules.xml.wsdl.model.Part; 26 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 27 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 28 import org.netbeans.modules.xml.wsdl.ui.actions.ActionHelper; 29 import org.netbeans.modules.xml.wsdl.ui.actions.NameGenerator; 30 import org.openide.util.NbBundle; 31 import org.openide.util.datatransfer.NewType; 32 33 public class MessagePartNewType extends NewType { 34 private Message mMessage = null; 35 36 public MessagePartNewType(WSDLComponent message) { 37 mMessage = (Message) message; 38 } 39 40 41 @Override 42 public String getName() { 43 return NbBundle.getMessage(MessagePartNewType.class, "LBL_NewType_Part"); 44 } 45 46 47 @Override 48 public void create() throws IOException { 49 WSDLModel model = mMessage.getModel(); 50 model.startTransaction(); 51 Part part = model.getFactory().createPart(); 52 String partName = NameGenerator.getInstance().generateUniqueMessagePartName(mMessage); 53 part.setName(partName); 54 mMessage.addPart(part); 55 model.endTransaction(); 56 ActionHelper.selectNode(part); 57 } 58 } 59 | Popular Tags |