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.JaxWsModel; 32 import org.openide.filesystems.FileObject; 33 import org.openide.util.NbBundle; 34 35 42 public class JaxWsXmlWhereUsedRefactoring extends JaxWsXmlRefactoringSupport { 43 44 47 public JaxWsXmlWhereUsedRefactoring() { 48 } 49 50 53 public Problem prepare(AbstractRefactoring refactoring, RefObject refObject, RefactoringElementsBag refactoringElements) { 54 55 if (!(refObject instanceof JavaClass) || !isWebSvcFromWsdl((JavaClass) refObject)){ 56 return null; 57 } 58 59 JavaClass javaClass = (JavaClass) refObject; 60 61 JaxWsModel model = getModel(javaClass); 62 if (model != null && model.findServiceByImplementationClass(javaClass.getName()) != null){ 63 RefactoringElementImplementation elem = new JaxWsXmlWhereUsedElement(javaClass.getName(), model.getJaxWsFile()); 64 refactoringElements.add(refactoring, elem); 65 } 66 67 return null; 68 69 70 } 71 72 private static class JaxWsXmlWhereUsedElement extends AbstractWhereUsedRefactoringElement { 73 74 public JaxWsXmlWhereUsedElement(String name, FileObject parentFile) { 75 this.name = name; 76 this.parentFile = parentFile; 77 } 78 79 public String getDisplayText() { 80 Object [] args = new Object [] {name}; 81 return MessageFormat.format(NbBundle.getMessage(JaxWsXmlWhereUsedRefactoring.class, "TXT_JaxWsXmlImplementationClassWhereUsed"), args); 82 } 83 84 } 85 } | Popular Tags |