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