1 19 20 package org.netbeans.modules.j2ee.refactoring.moveclass; 21 22 import org.netbeans.jmi.javamodel.Element; 23 import org.netbeans.modules.j2ee.refactoring.DefaultPositionBoundsResolver; 24 import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation; 25 import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImpl; 26 import org.openide.ErrorManager; 27 import org.openide.filesystems.FileObject; 28 import org.openide.loaders.DataObject; 29 import org.openide.loaders.DataObjectNotFoundException; 30 import org.openide.text.PositionBounds; 31 32 36 public abstract class AbstractMoveClassRefactoringElement extends SimpleRefactoringElementImpl implements RefactoringElementImplementation { 37 38 private int status = RefactoringElementImplementation.NORMAL; 39 40 protected boolean enabled = true; 41 protected String oldName; 42 protected String newName; 43 protected FileObject parentFile; 44 45 48 public boolean isEnabled() { 49 return enabled; 50 } 51 52 55 public void setEnabled(boolean enabled) { 56 this.enabled = enabled; 57 } 58 59 62 public String getText() { 63 return getDisplayText(); 64 } 65 66 69 public Element getJavaElement() { 70 return null; 71 } 72 73 76 public FileObject getParentFile() { 77 return parentFile; 78 } 79 80 82 public PositionBounds getPosition() { 83 try { 84 return new DefaultPositionBoundsResolver(DataObject.find(getParentFile()), oldName).getPositionBounds(); 85 } catch (DataObjectNotFoundException ex) { 86 ErrorManager.getDefault().notify(ex); 87 } 88 return null; 89 } 90 91 95 public int getStatus() { 96 return status; 97 } 98 99 public void setStatus(int status) { 100 this.status = status; 101 } 102 103 } | Popular Tags |