Removing of Link in Correlation Mapper was implemented. iz_83282_root
authoralexpetrov@netbeans.org
Wed, 16 Jan 2008 15:07:05 +0000
changeset 162382f27598a8bc
parent 1622 533a25b1bd51
child 1624 5d889540134f
Removing of Link in Correlation Mapper was implemented.
bpel.editors/src/org/netbeans/modules/bpel/properties/editors/DefineCorrelationWizard.java
     1.1 --- a/bpel.editors/src/org/netbeans/modules/bpel/properties/editors/DefineCorrelationWizard.java	Wed Jan 16 14:44:29 2008 +0000
     1.2 +++ b/bpel.editors/src/org/netbeans/modules/bpel/properties/editors/DefineCorrelationWizard.java	Wed Jan 16 15:07:05 2008 +0000
     1.3 @@ -615,11 +615,28 @@
     1.4          //====================================================================//
     1.5          private class ActionDeleteKey extends AbstractAction {
     1.6              public void actionPerformed(ActionEvent e) {
     1.7 -                TreePath selectedTreePath = correlationMapper.getSelectionModel().getSelectedPath();
     1.8                  List<Link> selectedLinks =  correlationMapper.getSelectionModel().getSelectedLinks();
     1.9 -                if ((selectedTreePath != null) && (selectedLinks != null) &&
    1.10 -                    (! selectedLinks.isEmpty())) {
    1.11 -                    // fireTreeChangedEvent(...); !!!
    1.12 +                if ((selectedLinks != null) && (! selectedLinks.isEmpty())) {
    1.13 +                    for (Link link : selectedLinks) {
    1.14 +                        SourcePin sourcePin = link.getSource();
    1.15 +                        if ((sourcePin == null) || (! (sourcePin instanceof TreeSourcePin))) break;
    1.16 +
    1.17 +                        Graph targetGraph = link.getGraph();
    1.18 +                        if (targetGraph == null) break;
    1.19 +                        targetGraph.removeLink(link);
    1.20 +
    1.21 +                        CorrelationMapperModel mapperModel = (CorrelationMapperModel) correlationMapper.getModel();
    1.22 +                        CorrelationMapperTreeModel rightTreeModel = 
    1.23 +                            (CorrelationMapperTreeModel) mapperModel.getRightTreeModel();
    1.24 +                        Map<TreePath, Graph> mapTreePathGraph = mapperModel.getMapTreePathGraphs();
    1.25 +                        for (Map.Entry<TreePath, Graph> mapEntry : mapTreePathGraph.entrySet()) {
    1.26 +                            if (mapEntry.getValue().equals(targetGraph)) {
    1.27 +                                TreePath treePath = mapEntry.getKey();
    1.28 +                                rightTreeModel.fireTreeChanged(this, treePath);
    1.29 +                                break;
    1.30 +                            }
    1.31 +                        }
    1.32 +                    }
    1.33                  }
    1.34              }
    1.35          }
    1.36 @@ -846,6 +863,10 @@
    1.37                  return leftTreeModel;
    1.38              }
    1.39  
    1.40 +            public TreeModel getRightTreeModel() {
    1.41 +                return rightTreeModel;
    1.42 +            }
    1.43 +
    1.44              public TreeSourcePin getTreeSourcePin(TreePath treePath) {
    1.45                  return new TreeSourcePin(treePath);
    1.46              }