1 19 20 package org.netbeans.modules.scripting.php.dbginterface; 21 22 23 import javax.swing.Action ; 24 import org.netbeans.modules.scripting.php.dbginterface.api.VariableNode; 25 import org.netbeans.modules.scripting.php.dbginterface.ui.VariablesFilter; 26 import org.netbeans.spi.viewmodel.Models; 27 import org.netbeans.spi.viewmodel.NodeActionsProvider; 28 import org.netbeans.spi.viewmodel.TreeModel; 29 import org.netbeans.spi.viewmodel.UnknownTypeException; 30 31 public class VariablesActionsProvider implements NodeActionsProvider { 32 33 private final Action EDIT_FILTERS_ACTION = Models.createAction ( 34 "Filters...", 35 new Models.ActionPerformer () { 36 public boolean isEnabled(Object node) { 37 return true; 38 } 39 public void perform(Object [] nodes) { 40 editFilters(); 41 } 42 }, 43 Models.MULTISELECTION_TYPE_ANY 44 ); 45 46 public Action [] getActions(Object node) throws UnknownTypeException { 47 if(node == TreeModel.ROOT || node instanceof VariableNode) { 48 return new Action [] { 49 EDIT_FILTERS_ACTION 50 }; 51 } 52 throw new UnknownTypeException (node); 62 } 63 64 public void performDefaultAction(Object node) throws UnknownTypeException { 65 if(node == TreeModel.ROOT) { 66 return; 67 } else if(node instanceof VariableNode) { 68 return; 69 } 70 throw new UnknownTypeException (node); 75 } 76 77 private void editFilters() { 79 VariablesFilter.showDialog(); 80 } 81 82 } 83 | Popular Tags |