KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > scripting > php > dbginterface > VariablesActionsProvider


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.scripting.php.dbginterface;
21
22
23 import javax.swing.Action JavaDoc;
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 JavaDoc EDIT_FILTERS_ACTION = Models.createAction (
34         "Filters...",
35         new Models.ActionPerformer () {
36             public boolean isEnabled(Object JavaDoc node) {
37                 return true;
38             }
39             public void perform(Object JavaDoc[] nodes) {
40                 editFilters();
41             }
42         },
43         Models.MULTISELECTION_TYPE_ANY
44     );
45
46     public Action JavaDoc[] getActions(Object JavaDoc node) throws UnknownTypeException {
47         if(node == TreeModel.ROOT || node instanceof VariableNode) {
48             return new Action JavaDoc [] {
49                 EDIT_FILTERS_ACTION
50             };
51         }
52 // if(node instanceof Variable)
53
// return new Action [] {
54
// };
55
// if(node.toString().startsWith ("SubArray")) // NOI18N
56
// return new Action [] {
57
// };
58
// if(node.equals ("NoInfo")) // NOI18N
59
// return new Action [] {
60
// };
61
throw new UnknownTypeException (node);
62     }
63
64     public void performDefaultAction(Object JavaDoc node) throws UnknownTypeException {
65         if(node == TreeModel.ROOT) {
66             return;
67         } else if(node instanceof VariableNode) {
68             return;
69         }
70 // if(node.toString().startsWith ("SubArray")) // NOI18N
71
// return ;
72
// if(node.equals ("NoInfo")) // NOI18N
73
// return;
74
throw new UnknownTypeException (node);
75     }
76
77     // !PW FIXME can we make this modeless?
78
private void editFilters() {
79         VariablesFilter.showDialog();
80     }
81
82 }
83
Popular Tags