O'Reilly logo

Eclipse 4 Plug-in Development by Example Beginner's Guide by Dr. Alex Blewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using layouts

Now that ClockWidget has been created, multiple instances can be added into ClockView.

  1. Modify the ClockView class's createPartControl() method to create three ClockWidget instances:
    final ClockWidget clock1 = new ClockWidget(parent, SWT.NONE);
    final ClockWidget clock2 = new ClockWidget(parent, SWT.NONE);
    final ClockWidget clock3 = new ClockWidget(parent, SWT.NONE);
  2. Run the test Eclipse instance and show the Clock View. Three clocks will be shown, counting in seconds:
    Time for action – using layouts
  3. In the ClockView constructor, create a new RowLayout with SWT.HORIZONTAL, and then set it as the layout on parent Composite:
    public void createPartControl(Composite ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required