1 19 package org.netbeans.modules.xml.refactoring.actions; 20 21 import org.netbeans.modules.refactoring.spi.ui.UI; 22 import org.netbeans.modules.xml.refactoring.FileRenameRequest; 23 import org.netbeans.modules.xml.refactoring.RefactoringManager; 24 import org.netbeans.modules.xml.refactoring.impl.RefactoringUtil; 25 import org.netbeans.modules.xml.refactoring.ui.j.spi.ui.FileRenameRefactoringUI; 26 import org.netbeans.modules.xml.refactoring.ui.j.ui.RefactoringPanel; 27 import org.netbeans.modules.xml.refactoring.ui.util.AnalysisUtilities; 28 import org.netbeans.modules.xml.refactoring.ui.views.WhereUsedView; 29 import org.netbeans.modules.xml.xam.Model; 30 import org.netbeans.modules.xml.xam.Referenceable; 31 import org.openide.nodes.Node; 32 import org.openide.text.CloneableEditorSupport; 33 import org.openide.util.HelpCtx; 34 import org.openide.util.NbBundle; 35 import org.openide.util.actions.CookieAction; 36 import org.openide.windows.TopComponent; 37 38 42 public class FileRenameAction extends CookieAction { 43 public static Class [] EMPTY_CLASS_ARRAY = new Class [0]; 44 45 46 public FileRenameAction() { 47 super(); 48 } 49 50 protected boolean enable(Node[] activatedNodes) { 51 if (activatedNodes.length != 1) { 52 return false; 53 } 54 Referenceable ref = AnalysisUtilities.getReferenceable(activatedNodes); 55 return ref instanceof Model && RefactoringUtil.isWritable((Model)ref) && 56 RefactoringManager.getInstance().canChange(FileRenameRequest.class, ref); 57 } 58 59 protected void performAction(Node[] activatedNodes) { 60 System.out.println("FileRename called"); 61 if (activatedNodes.length != 1) return; 62 63 Referenceable ref = AnalysisUtilities.getReferenceable(activatedNodes); 64 if (ref instanceof Model) { 65 Model model = (Model) ref; 66 WhereUsedView wuv = new WhereUsedView(model); 67 FileRenameRefactoringUI ui = new FileRenameRefactoringUI(wuv, model); 68 TopComponent activetc = TopComponent.getRegistry().getActivated(); 69 71 if (activetc instanceof CloneableEditorSupport.Pane) { 72 } else { 74 } 76 } 77 } 78 79 protected int mode() { 80 return CookieAction.MODE_EXACTLY_ONE; 81 } 82 83 public String getName() { 84 return NbBundle.getMessage(FileRenameAction.class, "LBL_FileRename"); 85 } 86 87 public HelpCtx getHelpCtx() { 88 return HelpCtx.DEFAULT_HELP; 89 } 90 91 protected Class [] cookieClasses() { 92 return EMPTY_CLASS_ARRAY; 93 } 94 95 protected boolean asynchronous() { 96 return false; 97 } 98 } 99 | Popular Tags |