1 26 27 package org.objectweb.util.explorer.plugin.java; 28 29 import org.objectweb.util.explorer.api.MenuItem; 30 import org.objectweb.util.explorer.api.MenuItemTreeView; 31 import org.objectweb.util.explorer.api.TreeView; 32 import org.objectweb.util.explorer.swing.gui.api.DialogAction; 33 import org.objectweb.util.explorer.swing.gui.api.DialogBox; 34 import org.objectweb.util.explorer.swing.gui.lib.DefaultDialogBox; 35 import org.objectweb.util.explorer.swing.gui.lib.LabelBox; 36 37 44 public class RenameInitialEntryAction 45 implements MenuItem, DialogAction 46 { 47 48 54 55 protected LabelBox labelBox_ = null; 56 57 58 protected TreeView treeView_ = null; 59 60 61 protected String currentName_ = null; 62 63 69 75 81 84 public int getStatus(TreeView treeView) { 85 return MenuItem.ENABLED_STATUS; 86 } 87 88 91 public void actionPerformed(MenuItemTreeView treeView) throws Exception { 92 treeView_ = treeView; 93 currentName_ = treeView.getSelectedEntry().getName().toString(); 94 95 DialogBox box = new DefaultDialogBox("Renames the entry"); 96 labelBox_ = new LabelBox("Entry name", currentName_); 97 box.addElementBox(labelBox_); 98 box.setValidateAction(this); 99 box.show(); 100 } 101 102 108 111 public void executeAction() throws Exception { 112 treeView_.getTree().renameInitialEntry(currentName_, labelBox_.getLabel()); 113 } 114 } 115 | Popular Tags |