1 19 20 package org.netbeans.modules.j2ee.refactoring.jaxwssupport; 21 22 import java.io.IOException ; 23 import org.netbeans.modules.j2ee.refactoring.rename.AbstractRenameRefactoringElement; 24 import org.netbeans.modules.javacore.internalapi.ExternalChange; 25 import org.netbeans.modules.javacore.internalapi.JavaMetamodel; 26 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 27 import org.netbeans.modules.websvc.api.jaxws.project.config.Service; 28 import org.openide.ErrorManager; 29 import org.openide.filesystems.FileObject; 30 31 36 public abstract class JaxWsXmlRefactoringElementSupport extends AbstractRenameRefactoringElement implements ExternalChange { 37 38 protected JaxWsModel model; 39 protected Service service; 40 41 48 public JaxWsXmlRefactoringElementSupport(String oldName, String newName, 49 JaxWsModel model, Service service, FileObject parentFile) { 50 51 this.oldName = oldName; 52 this.newName = newName; 53 this.model = model; 54 this.parentFile = parentFile; 55 this.service = service; 56 } 57 58 59 public void performExternalChange() { 60 service.setImplementationClass(newName); 61 writeModel(); 62 } 63 64 public void undoExternalChange() { 65 service.setImplementationClass(oldName); 66 writeModel(); 67 } 68 69 private void writeModel(){ 70 try { 71 model.write(); 72 } catch (IOException ex) { 73 ErrorManager.getDefault().notify(ex); 74 } 75 } 76 77 80 public void performChange() { 81 JavaMetamodel.getManager().registerExtChange(this); 82 } 83 84 } 85 | Popular Tags |