Sometimes you want to detect the metakey which was pressed during a mouse click on SWT widget. This information is available in the SelectionEvent via the stateMask property.
The following code shows an example for this.
Button button = new Button(shell, SWT.READ_ONLY); button.setText("Press me"); button.setSize(200, 200); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if ((e.stateMask & SWT.CTRL) != 0) { System.out.println("SWT.CTRL"); } } });