~danilovesky/workcraft/trunk-stg-transform-tools

« back to all changes in this revision

Viewing changes to CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java

  • Committer: Danil Sokolov
  • Date: 2014-04-08 12:07:21 UTC
  • mfrom: (495.1.1 trunk-bug-1288340)
  • Revision ID: danilovesky@gmail.com-20140408120721-9xvx1697vgt6o0hw
Merge proposal for bug #1288340 approved.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import java.awt.Font;
5
5
import java.awt.event.ActionEvent;
6
6
import java.awt.event.ActionListener;
 
7
import java.awt.event.MouseEvent;
7
8
import java.awt.geom.Point2D;
8
9
import java.util.HashMap;
9
10
 
13
14
import javax.swing.JScrollPane;
14
15
import javax.swing.JTextArea;
15
16
 
 
17
import org.workcraft.dom.visual.HitMan;
 
18
import org.workcraft.dom.visual.VisualModel;
 
19
import org.workcraft.dom.visual.VisualNode;
 
20
import org.workcraft.gui.events.GraphEditorMouseEvent;
16
21
import org.workcraft.gui.graph.tools.GraphEditor;
17
22
import org.workcraft.gui.graph.tools.SelectionTool;
18
23
import org.workcraft.plugins.cpog.VisualCPOG;
 
24
import org.workcraft.plugins.cpog.VisualVariable;
19
25
import org.workcraft.plugins.cpog.VisualVertex;
20
26
import org.workcraft.plugins.cpog.expressions.CpogConnector;
21
27
import org.workcraft.plugins.cpog.expressions.CpogFormula;
125
131
                //       I think it is  fixed now (by not keeping a reference to the visualModel in the activated method)
126
132
                we.saveMemento();
127
133
        }
 
134
        
 
135
        @Override
 
136
        public void mouseClicked(GraphEditorMouseEvent e) {
 
137
                boolean processed = false;
 
138
                
 
139
                if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) {
 
140
                        VisualModel model = e.getEditor().getModel();
 
141
                        VisualNode node = (VisualNode) HitMan.hitTestForSelection(e.getPosition(), model);
 
142
                        if (node != null) {
 
143
                                if(node instanceof VisualVariable) {
 
144
                                        VisualVariable var = (VisualVariable) node;
 
145
                                        var.toggle();
 
146
                                        processed = true;
 
147
                                }
 
148
                        }
 
149
                }
 
150
 
 
151
                if (!processed) {
 
152
                        super.mouseClicked(e);
 
153
 
 
154
                }
 
155
        }
128
156
 
129
157
}