1 19 20 package org.netbeans.modules.j2ee.refactoring.safedelete; 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 35 public abstract class AbstractSafeDeleteRefactoringElement extends SimpleRefactoringElementImpl implements RefactoringElementImplementation { 36 37 private int status = RefactoringElementImplementation.NORMAL; 38 39 protected boolean enabled = true; 40 protected FileObject parentFile; 41 42 protected AbstractSafeDeleteRefactoringElement(FileObject parentFile) { 43 this.parentFile = parentFile; 44 } 45 46 protected AbstractSafeDeleteRefactoringElement(){ 47 } 48 49 52 public boolean isEnabled() { 53 return enabled; 54 } 55 56 59 public void setEnabled(boolean enabled) { 60 this.enabled = enabled; 61 } 62 63 66 public String getText() { 67 return getDisplayText(); 68 } 69 70 73 public Element getJavaElement() { 74 return null; 75 } 76 77 80 public FileObject getParentFile() { 81 return parentFile; 82 } 83 84 86 public PositionBounds getPosition() { 87 try { 88 return new DefaultPositionBoundsResolver(DataObject.find(getParentFile()), null).getPositionBounds(); 89 } catch (DataObjectNotFoundException ex) { 90 ErrorManager.getDefault().notify(ex); 91 } 92 return null; 93 } 94 95 99 public int getStatus() { 100 return status; 101 } 102 103 public void setStatus(int status) { 104 this.status = status; 105 } 106 } | Popular Tags |