I'm creating a graph using the visualization toolkit Zest. I start by creating a graph then I add a node. I want to add to this node a mouse Double click event. I tried the following code, but it doesn't work. Is it because of the verification e.button == 3?
[...]
Graph graph = new Graph(parent, SWT.BORDER);
graph.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event e) {
if (e.button == 3) {
Menu menu = new Menu(parent);
final MenuItem a1 = new MenuItem(menu, SWT.None);
a1.setText("New Node");
a1.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
GraphNode graphNode = new GraphNode(graph, SWT.NONE);
graphNode.addListener(SWT.MouseDoubleClick, new Listener
(
@Override
public void handleEvent(Event event) {
System.out.println("node created");});
@Override
public void widgetDefaultSelected(SelectionEvent e) {}
}
}
});
Thank you