Exemplo n.º 1
0
 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 test_addPaintListenerLorg_eclipse_swt_events_PaintListener() {
   PaintListener listener =
       new PaintListener() {
         public void paintControl(PaintEvent e) {
           eventOccurred = true;
         }
       };
   control.addPaintListener(listener);
   eventOccurred = false;
   Event event = new Event();
   GC gc = event.gc = new GC(control);
   control.notifyListeners(SWT.Paint, event);
   gc.dispose();
   assertTrue(eventOccurred);
   control.removePaintListener(listener);
 }