1 19 20 package org.netbeans.modules.websvc.core.dev.wizard; 21 22 import java.io.IOException ; 23 import org.netbeans.api.project.Project; 24 import org.netbeans.modules.websvc.core.HandlerCreator; 25 import org.netbeans.spi.project.ui.templates.support.Templates; 26 import org.openide.WizardDescriptor; 27 import org.openide.cookies.EditorCookie; 28 import org.openide.filesystems.FileObject; 29 import org.openide.loaders.DataFolder; 30 import org.openide.loaders.DataObject; 31 import org.openide.util.RequestProcessor; 32 33 37 public class JaxWsHandlerCreator implements HandlerCreator { 38 private Project project; 39 private WizardDescriptor wiz; 40 43 public JaxWsHandlerCreator(Project project, WizardDescriptor wiz) { 44 this.project = project; 45 this.wiz = wiz; 46 } 47 48 public void createMessageHandler() throws IOException { 49 String handlerName = Templates.getTargetName(wiz); 50 FileObject pkg = Templates.getTargetFolder(wiz); 51 DataFolder df = DataFolder.findFolder(pkg); 52 FileObject template = Templates.getTemplate(wiz); 53 DataObject dTemplate = DataObject.find(template); 54 DataObject dobj = dTemplate.createFromTemplate(df, handlerName); 55 56 final EditorCookie ec = (EditorCookie) dobj.getCookie(EditorCookie.class); 58 RequestProcessor.getDefault().post(new Runnable (){ 59 public void run(){ 60 ec.open(); 61 } 62 }, 1000); 63 } 64 65 public void createLogicalHandler() throws IOException { 66 String handlerName = Templates.getTargetName(wiz); 67 FileObject pkg = Templates.getTargetFolder(wiz); 68 DataFolder df = DataFolder.findFolder(pkg); 69 FileObject template = Templates.getTemplate(wiz); 70 DataObject dTemplate = DataObject.find(template); 71 DataObject dobj = dTemplate.createFromTemplate(df, handlerName); 72 73 final EditorCookie ec = (EditorCookie) dobj.getCookie(EditorCookie.class); 75 RequestProcessor.getDefault().post(new Runnable (){ 76 public void run(){ 77 ec.open(); 78 } 79 }, 1000); 80 } 81 } 82 | Popular Tags |