01: /*
02: * To change this template, choose Tools | Templates
03: * and open the template in the editor.
04: */
05: package org.netbeans.modules.bpel.design.actions;
06:
07: import java.awt.event.ActionEvent;
08: import javax.swing.Action;
09: import org.netbeans.modules.bpel.design.DesignView;
10: import org.netbeans.modules.bpel.design.model.patterns.Pattern;
11: import org.openide.nodes.Node;
12:
13: /**
14: *
15: * @author Alexey
16: */
17: public class FindUsagesAction extends DesignModeAction {
18:
19: private static final long serialVersionUID = 1L;
20:
21: public FindUsagesAction(DesignView view) {
22: super (view);
23: }
24:
25: public void actionPerformed(ActionEvent e) {
26: Pattern selected = getDesignView().getSelectionModel()
27: .getSelectedPattern();
28:
29: if (selected == null) {
30: return;
31: }
32:
33: Node node = getDesignView().getNodeForPattern(selected);
34:
35: if (node == null) {
36: return;
37: }
38:
39: Action[] actions = node.getActions(true);
40: if (actions == null) {
41: return;
42: }
43:
44: for (int i = actions.length - 1; i >= 0; i--) {
45: Action action = actions[i];
46: if (action instanceof org.netbeans.modules.bpel.nodes.actions.FindUsagesAction) {
47: ((org.netbeans.modules.bpel.nodes.actions.FindUsagesAction) action)
48: .performAction(new Node[] { node });
49: return;
50: }
51: }
52: }
53: }
|