use of org.talend.expressionbuilder.test.shadow.ExpressionTestMain in project tdi-studio-se by Talend.
the class TestComposite method installListener.
private void installListener() {
buttonAddVar.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
List<Variable> input = (List<Variable>) variableTableViewer.getInput();
input.add(new Variable(input.size()));
variableTableViewer.refresh();
}
});
buttonRemoveVar.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
ISelection selection = variableTableViewer.getSelection();
List<Variable> list = ((List<Variable>) variableTableViewer.getInput());
if (!selection.isEmpty() && selection instanceof StructuredSelection) {
Object[] vars = ((StructuredSelection) selection).toArray();
for (Object var : vars) {
list.remove(var);
variableTableViewer.refresh();
}
} else if (!list.isEmpty()) {
list.remove(list.size() - 1);
variableTableViewer.refresh();
}
}
});
testButton.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
new ExpressionTestMain(CategoryComposite.getSelectedFunction(), testResultText);
}
});
clearButton.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
//$NON-NLS-1$
testResultText.setText("");
}
});
}
Aggregations