1 23 package org.objectweb.clif.scenario.util.isac.gui.action; 24 25 import java.net.URL ; 26 27 import org.apache.log4j.Category; 28 import org.eclipse.jface.action.Action; 29 import org.eclipse.jface.resource.ImageDescriptor; 30 import org.eclipse.jface.window.ApplicationWindow; 31 import org.objectweb.clif.scenario.util.isac.FileName; 32 import org.objectweb.clif.scenario.util.isac.gui.ScenarioGUIEditor; 33 import org.objectweb.clif.scenario.util.isac.gui.tree.ScenarioTreeViewer; 34 import org.objectweb.clif.scenario.util.isac.util.tree.ScenarioNode; 35 import org.objectweb.clif.scenario.util.isac.util.tree.TreeManager; 36 42 public class DeleteNodeAction extends Action { 43 46 ScenarioGUIEditor window; 47 ScenarioTreeViewer viewer; 48 static Category cat = Category 49 .getInstance(DeleteNodeAction.class.getName()); 50 56 public DeleteNodeAction(ApplicationWindow w) { 57 cat.debug("-> constructor"); 58 this.window = (ScenarioGUIEditor) w; 59 this.setText("Delete node"); 60 this 61 .setToolTipText("Delete the selected node, in the treeViewer which has the focus"); 62 try { 63 this.setImageDescriptor(ImageDescriptor.createFromURL(new URL ( 64 "file:" + FileName.DELETE_ICON))); 65 } catch (Exception e) { 66 cat.warn("Unable to find exit icon file"); 67 } 68 } 69 70 public void run() { 71 cat.debug("-> run"); 72 this.viewer = this.window.getTreeViewer(); 73 ScenarioNode node = this.viewer.getSelectedNode(); 74 if (node == null) 75 return; 76 (TreeManager.getTreeManager(null)).deleteBehaviorsTreeNode(node); 77 this.viewer.refresh(); 78 this.window.setScenarioSavedState(false); 80 } 81 } | Popular Tags |