1 19 20 package org.netbeans.modules.j2ee.refactoring.whereused; 21 22 import java.text.MessageFormat ; 23 import javax.jmi.reflect.RefObject; 24 import org.netbeans.jmi.javamodel.JavaClass; 25 import org.netbeans.modules.j2ee.refactoring.jaxwssupport.JaxWsXmlRefactoringSupport; 26 import org.netbeans.modules.refactoring.api.AbstractRefactoring; 27 import org.netbeans.modules.refactoring.api.Problem; 28 import org.netbeans.modules.refactoring.api.RefactoringElement; 29 import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation; 30 import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; 31 import org.netbeans.modules.websvc.api.jaxws.project.config.Endpoint; 32 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 33 import org.openide.filesystems.FileObject; 34 import org.openide.util.NbBundle; 35 36 43 public class SunJaxWsXmlWhereUsedRefactoring extends JaxWsXmlRefactoringSupport { 44 45 48 public SunJaxWsXmlWhereUsedRefactoring() { 49 } 50 51 54 public Problem prepare(AbstractRefactoring refactoring, RefObject refObject, RefactoringElementsBag refactoringElements) { 55 56 if (!(refObject instanceof JavaClass) || !isWebSvcFromWsdl((JavaClass) refObject)){ 57 return null; 58 } 59 60 JavaClass javaClass = (JavaClass) refObject; 61 FileObject sunjaxwsFo = getSunJaxWsXmlFile(javaClass); 62 63 for (Endpoint each : getEndpoints(javaClass)) { 64 RefactoringElementImplementation elem = new SunJaxWsXmlWhereUsedElement(javaClass.getName(), sunjaxwsFo); 65 refactoringElements.add(refactoring, elem); 66 } 67 68 return null; 69 } 70 71 private static class SunJaxWsXmlWhereUsedElement extends AbstractWhereUsedRefactoringElement { 72 73 public SunJaxWsXmlWhereUsedElement(String name, FileObject parentFile) { 74 this.name = name; 75 this.parentFile = parentFile; 76 } 77 78 public String getDisplayText() { 79 Object [] args = new Object [] {name}; 80 return MessageFormat.format(NbBundle.getMessage(SunJaxWsXmlWhereUsedRefactoring.class, "TXT_SunJaxWsXmlImplementationClassWhereUsed"), args); 81 } 82 } 83 } | Popular Tags |