コード例 #1
0
  @Override
  public void draw(IBNAView view, ICoordinateMapper cm, GL2 gl, Rectangle clip, IResources r) {

    if (control == null) {
      control = createControl(view, cm);
    }

    // update bounds
    final Rectangle newBounds = getBounds(control, view, cm);
    final Rectangle oldBounds = control.getBounds();
    if (!oldBounds.equals(newBounds)) {
      SWTWidgetUtils.async(
          control,
          new Runnable() {
            @Override
            public void run() {
              if (oldBounds.width != newBounds.width || oldBounds.height != newBounds.height) {
                control.setSize(newBounds.width, newBounds.height);
                if (control instanceof Composite) {
                  ((Composite) control).layout(true, true);
                  control.pack(true);
                }
              }
              control.setLocation(newBounds.x, newBounds.y);
            }
          });
    }
  }
コード例 #2
0
 @Override
 public void dispose() {
   super.dispose();
   control = SWTWidgetUtils.quietlyDispose(control);
 }