int prefSize = 0;
for (final PanelRenderer p : panels) {
prefSize = Math.max(p.preferredSize(), prefSize);
}
if (panels.size() == 1) {
final PanelRenderer p = panels.iterator().next();
final Group g = new Group(parent, SWT.SHADOW_NONE);
p.initializePanel(g);
} else {
final TabFolder tab = new TabFolder(parent, SWT.NONE);
for (final PanelRenderer p : panels) {
final TabItem ti = new TabItem(tab, SWT.NONE);
ti.setText(p.getName());
final Composite comp = new Composite(tab, SWT.NONE);
ti.setControl(comp);
p.initializePanel(comp);
}
}
return prefSize;
}