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.netbeans.modules.bpel.nodes.actions.ShowBpelMapperAction;
14: import org.openide.nodes.Node;
15: import org.openide.util.actions.SystemAction;
16:
17: /**
18: *
19: * @author Vitaly Bychkov
20: * @author Alexey
21: * @version 1.0
22: */
23: public class GoToMapperAction extends DesignModeAction {
24: private static final long serialVersionUID = 1L;
25:
26: public GoToMapperAction(DesignView view) {
27: super (view);
28: }
29:
30: public void actionPerformed(ActionEvent e) {
31: Pattern selected = getDesignView().getSelectionModel()
32: .getSelectedPattern();
33:
34: if (selected == null) {
35: return;
36: }
37:
38: Node node = getDesignView().getNodeForPattern(selected);
39:
40: if (node == null) {
41: return;
42: }
43:
44: Action[] actions = node.getActions(true);
45: if (actions == null) {
46: return;
47: }
48:
49: for (int i = actions.length - 1; i >= 0; i--) {
50: Action action = actions[i];
51: if (action instanceof GoToAction) {
52: ShowBpelMapperAction gotoAction = SystemAction
53: .get(ShowBpelMapperAction.class);
54: Node[] nodes = new Node[] { node };
55: if (gotoAction != null && gotoAction.enable(nodes)) {
56: gotoAction.performAction(nodes);
57: }
58: break;
59: }
60: }
61: }
62: }
|