}
}
public static void createMapcalcConstructsButtons( Composite buttonsComposite, final StyledText text ) {
final CTabFolder tabFolder = new CTabFolder(buttonsComposite, SWT.TOP);
tabFolder.setBorderVisible(true);
tabFolder.setMaximized(true);
GridData tabGD = new GridData(SWT.CENTER, SWT.FILL, false, true);
tabFolder.setLayoutData(tabGD);
HashMap<String, CTabItem> tabsMap = new HashMap<String, CTabItem>();
Constructs[] values = Constructs.values();
for( final Constructs construct : values ) {
String category = construct.category;
CTabItem tabItem = tabsMap.get(category);
if (tabItem == null) {
Composite composite = new Composite(tabFolder, SWT.NONE);
GridLayout compositeLayout = new GridLayout(2, true);
composite.setLayout(compositeLayout);
GridData compositeGD = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(compositeGD);
tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setText(category);
tabItem.setControl(composite);
tabsMap.put(category, tabItem);
}
Control control = tabItem.getControl();
Button constructButton = new Button((Composite) control, SWT.PUSH);
constructButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
constructButton.setText(construct.name);
constructButton.setToolTipText(construct.toolTip);
constructButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected( SelectionEvent e ) {
insertTextAtCaretPosition(text, construct.construct);
}
});
}
tabFolder.setSelection(0);
tabFolder.setSingle(true);
tabFolder.pack();
}