1 19 20 package org.netbeans.modules.j2ee.refactoring.changeparam; 21 22 import org.netbeans.jmi.javamodel.Element; 23 import org.netbeans.modules.j2ee.refactoring.DefaultPositionBoundsResolver; 24 import org.netbeans.modules.refactoring.api.ChangeParametersRefactoring.ParameterInfo; 25 import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation; 26 import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImpl; 27 import org.openide.ErrorManager; 28 import org.openide.filesystems.FileObject; 29 import org.openide.loaders.DataObject; 30 import org.openide.loaders.DataObjectNotFoundException; 31 import org.openide.text.PositionBounds; 32 33 37 public abstract class AbstractChangeParamsRefactoringElement extends SimpleRefactoringElementImpl implements RefactoringElementImplementation { 38 39 private int status = RefactoringElementImplementation.NORMAL; 40 41 protected boolean enabled = true; 42 protected String methodName; 43 protected ParameterInfo[] paramInfo; 44 45 protected FileObject parentFile; 46 47 50 public boolean isEnabled() { 51 return enabled; 52 } 53 54 57 public void setEnabled(boolean enabled) { 58 this.enabled = enabled; 59 } 60 61 64 public String getText() { 65 return getDisplayText(); 66 } 67 68 71 public Element getJavaElement() { 72 return null; 73 } 74 75 78 public FileObject getParentFile() { 79 return parentFile; 80 } 81 82 84 public PositionBounds getPosition() { 85 try { 86 return new DefaultPositionBoundsResolver(DataObject.find(getParentFile()), methodName).getPositionBounds(); 87 } catch (DataObjectNotFoundException ex) { 88 ErrorManager.getDefault().notify(ex); 89 } 90 return null; 91 } 92 93 97 public int getStatus() { 98 return status; 99 } 100 101 public void setStatus(int status) { 102 this.status = status; 103 } 104 105 } | Popular Tags |