private void fireItemSelectionChanged(int button) { Event event = new Event(); event.button = button; event.x = 0; event.y = 0; event.width = -1; event.height = -1; event.item = selectedAnnotation; event.data = (selectedAnnotation != null) ? selectedAnnotation.getData() : null; notifyListeners(SWT.Selection, event); }
private void fireSelectionChanged() { Event event = new Event(); event.button = 1; Rectangle bounds = getCanvas().getBounds(); int visualLow = getVisualLow(); int visualHigh = getVisualHigh(); event.x = visualLow + bounds.x; event.y = bounds.y; event.width = visualHigh - visualLow; event.height = bounds.height; event.item = null; notifyListeners(SWT.Selection, event); }
public void selectionChanged(SelectionChangedEvent event) { GC gc = new GC(viewer.getTextWidget()); try { Event e = new Event(); e.gc = gc; e.widget = viewer.getTextWidget(); Rectangle bounds = viewer.getTextWidget().getBounds(); e.height = bounds.height; e.width = bounds.width; e.x = 0; e.y = 0; PaintEvent paintEvent = new PaintEvent(e); painter.paintControl(paintEvent); } finally { gc.dispose(); } }
@Test public void testUntypedEventConstructor() { Event event = new Event(); event.display = display; event.widget = mock(Widget.class); event.item = mock(Item.class); event.x = 1; event.y = 2; event.width = 3; event.height = 4; event.doit = true; event.data = new Object(); CTabFolderEvent selectionEvent = new CTabFolderEvent(event); EventTestHelper.assertFieldsEqual(selectionEvent, event); }