Java Code Examples for org.eclipse.swt.widgets.Button#notifyListeners()

The following examples show how to use org.eclipse.swt.widgets.Button#notifyListeners() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadioGroupTest.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void simulateClick(RadioItem item) {
	simulateDeselect(group.getSelection());

	Button button = item.getButton();
	button.setSelection(true);
	button.notifyListeners(SWT.Selection, null);
}
 
Example 2
Source File: RadioGroupTest.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void simulateDeselect(RadioItem item) {
	if (item == null)
		return;
	if (!item.isSelected())
		return;

	Button button = item.getButton();
	button.setSelection(false);
	button.notifyListeners(SWT.Selection, null);
}
 
Example 3
Source File: SpellingConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void updateCheckBox(Button curr) {
	super.updateCheckBox(curr);
	Event event= new Event();
	event.type= SWT.Selection;
	event.display= curr.getDisplay();
	event.widget= curr;
	curr.notifyListeners(SWT.Selection, event);
}
 
Example 4
Source File: FieldWidget_Tests.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void doChangeFromControl() {
	Button[] radioControls = field.getRadioControls();
	
	radioControls[field.getSelectionIndex()].setSelection(false);
	radioControls[1].setSelection(true);
	for (Button button : radioControls) {
		button.notifyListeners(SWT.Selection, null);
	}
}
 
Example 5
Source File: ContractConstraintsTableViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createAddListener_add_a_selection_listener_that_add_a_contract_constraint() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    viewer.createAddListener(button);
    assertThat(viewer.getTable().getItemCount()).isEqualTo(2);
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(viewer.getTable().getItemCount()).isEqualTo(3);
}
 
Example 6
Source File: ContractConstraintsTableViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createRemoveListener_add_a_selection_listener_that_remove_selected_contract_constraints() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    viewer.createRemoveListener(button);
    viewer.setSelection(new StructuredSelection(constraint));
    assertThat(viewer.getTable().getItemCount()).isEqualTo(2);
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(viewer.getTable().getItemCount()).isEqualTo(1);
}
 
Example 7
Source File: ContractConstraintsTableViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createMoveUpListener_add_a_selection_listener_that_moveUp_selected_contract_constraint() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    viewer.createMoveUpListener(button);
    assertThat(viewer.getTable().getItem(1).getData()).isEqualTo(constraint2);
    viewer.setSelection(new StructuredSelection(constraint2));
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(viewer.getTable().getItem(0).getData()).isEqualTo(constraint2);
}
 
Example 8
Source File: ContractConstraintsTableViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createMoveUpListener_add_a_selection_listener_that_moveDown_selected_contract_constraint() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    viewer.createMoveDownListener(button);
    assertThat(viewer.getTable().getItem(0).getData()).isEqualTo(constraint);
    viewer.setSelection(new StructuredSelection(constraint));
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(viewer.getTable().getItem(1).getData()).isEqualTo(constraint);
}
 
Example 9
Source File: ContractInputTreeViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createAddListener_add_a_selection_listener_that_add_a_contract_input() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    inputTreeViewer.createAddListener(button);
    assertThat(inputTreeViewer.getTree().getItemCount()).isEqualTo(1);
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(inputTreeViewer.getTree().getItemCount()).isEqualTo(2);
}
 
Example 10
Source File: ContractInputTreeViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createRemoveListener_add_a_selection_listener_that_remove_selected_contract_inputs() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    inputTreeViewer.createRemoveListener(button);
    inputTreeViewer.setSelection(new StructuredSelection(input));
    assertThat(inputTreeViewer.getTree().getItemCount()).isEqualTo(1);
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(inputTreeViewer.getTree().getItemCount()).isEqualTo(0);
}
 
Example 11
Source File: ContractInputTreeViewerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void shoud_createAddChildListener_add_a_selection_listener_that_add_a_child_input_to_the_selected_contract_inputs() throws Exception {
    final Button button = new Button(parent, SWT.PUSH);
    inputTreeViewer.createAddChildListener(button);
    inputTreeViewer.setSelection(new StructuredSelection(input));
    assertThat(inputTreeViewer.getTree().getItemCount()).isEqualTo(1);
    button.notifyListeners(SWT.Selection, new Event());
    assertThat(input.getInputs()).hasSize(1);
}