1 9 10 package org.netbeans.modules.xml.refactoring; 11 12 import java.awt.event.ActionEvent ; 13 import javax.swing.Action ; 14 import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImpl; 15 import org.netbeans.modules.refactoring.spi.ui.UI; 16 import org.netbeans.modules.xml.refactoring.spi.UIHelper; 17 import org.netbeans.modules.xml.refactoring.ui.util.AnalysisUtilities; 18 import org.netbeans.modules.xml.xam.Component; 19 import org.netbeans.modules.xml.xam.Referenceable; 20 import org.openide.filesystems.FileObject; 21 import org.openide.nodes.Node; 22 import org.openide.text.PositionBounds; 23 24 28 public class FileRenameElement extends SimpleRefactoringElementImpl { 29 30 Usage usage; 31 Node node; 32 FileObject fobj; 33 34 35 public FileRenameElement(Usage u) { 36 this.usage=u; 37 Component comp = usage.getComponent(); 38 node = usage.getContainer().getEngine().getUIHelper().getDisplayNode(comp); 39 } 40 41 public String getText() { 42 return node.getName(); 43 } 44 45 public String getDisplayText() { 46 return node.getHtmlDisplayName(); 47 48 49 } 50 51 public void performChange() { 52 System.out.println("Perform change called"); 53 54 } 55 56 public Object getComposite() { 57 return usage; 58 } 60 61 public FileObject getParentFile() { 62 return usage.getContainer().getFileObject(); 63 } 64 65 public PositionBounds getPosition() { 66 return null; 67 } 68 69 public void showPreview() { 70 } 72 73 public void openInEditor(){ 74 System.out.println("openInEditor::called"); 75 80 81 Action preferredAction = node.getPreferredAction(); 82 if (preferredAction != null) { 83 String command = (String )preferredAction.getValue(Action.ACTION_COMMAND_KEY); 84 ActionEvent ae = new ActionEvent (node, 0, command); 85 preferredAction.actionPerformed(ae); 86 } 87 } 88 89 public void setEnabled(boolean enabled){ 90 usage.setIncludedInRefactoring(enabled); 91 System.out.println("setEnabled called with " + enabled); 92 } 93 94 95 96 } 97 | Popular Tags |