1 19 20 package org.netbeans.modules.websvc.core.jaxws.actions; 21 22 import org.netbeans.api.java.classpath.ClassPath; 23 import org.netbeans.api.project.FileOwnerQuery; 24 import org.netbeans.api.project.Project; 25 import org.netbeans.modules.j2ee.common.Util; 26 import org.netbeans.modules.websvc.core.InvokeOperationActionProvider; 27 import org.netbeans.modules.websvc.core.InvokeOperationCookie; 28 import org.netbeans.modules.websvc.core.dev.wizard.ProjectInfo; 29 import org.openide.filesystems.FileObject; 30 import org.openide.loaders.*; 31 32 public class JaxWsInvokeOperationProvider implements InvokeOperationActionProvider { 33 public InvokeOperationCookie getInvokeOperationCookie(FileObject targetSource) { 34 Project project = FileOwnerQuery.getOwner(targetSource); 35 ProjectInfo projectInfo = new ProjectInfo(project); 36 int projectType = projectInfo.getProjectType(); 37 if ((projectType == ProjectInfo.JSE_PROJECT_TYPE && isJaxWsLibraryOnClasspath(targetSource)) || 38 (Util.isJavaEE5orHigher(project) && (projectType == ProjectInfo.WEB_PROJECT_TYPE || projectType == ProjectInfo.EJB_PROJECT_TYPE)) || 39 (projectInfo.isJwsdpSupported()) 40 ) { 41 return new JaxWsInvokeOperation(project); 42 } 43 return null; 44 } 45 46 private boolean isJaxWsLibraryOnClasspath(FileObject targetSource) { 47 ClassPath classPath = ClassPath.getClassPath(targetSource,ClassPath.COMPILE); 50 if (classPath != null) { 51 if (classPath.findResource("javax/xml/ws/Service.class")!=null) return true; 52 } 53 classPath = ClassPath.getClassPath(targetSource,ClassPath.BOOT); 55 if (classPath != null) { 56 if (classPath.findResource("javax/xml/ws/Service.class")!=null) return true; 57 } 58 return false; 59 } 60 61 62 63 } 64 | Popular Tags |