*/
private AttributTableViewer createTabAttrSection(ScrolledForm managedForm, String sectionTitle,
SelectionListener AddAfterCb, SelectionListener AddBeforeCb, SelectionListener DelCb, SelectionListener UpCb,
SelectionListener DownCb)
{
final AttributTableViewer tabv;
Composite body = managedForm.getForm().getBody();
body.setLayout(FormLayoutFactory.createFormTableWrapLayout(true, 1));
Composite left = toolkit.createComposite(body);
left.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false, 1));
left.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
Section section = Parts.createStaticSection(toolkit, left, sectionTitle);
Composite container = toolkit.createComposite(section, SWT.NONE);
container.setLayout(FormLayoutFactory.createSectionClientTableWrapLayout(false, 2));
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
container.setLayoutData(data);
tabv = new AttributTableViewer(container);
tabv.addModifyListener(new ModifyListener()
{
@Override
public void modifyText(ModifyEvent e)
{
setDirty(true);
}
});
Composite containerBtn = toolkit.createComposite(container, SWT.NONE);
containerBtn.setLayout(FormLayoutFactory.createClearGridLayout(true, 1));
/*Button btnAddAfter =*/toolkit.createGridButton(containerBtn, "Add After", AddAfterCb);
/*Button btnAddBefore =*/toolkit.createGridButton(containerBtn, "Add Before", AddBeforeCb);
/*Button btnRem =*/toolkit.createGridButton(containerBtn, "Delete", DelCb);
// Add "up" and "down" for display order management.
/*Button btnUp =*/toolkit.createGridButton(containerBtn, "Up", UpCb);
/*Button btnDown =*/toolkit.createGridButton(containerBtn, "Down", DownCb);
tabv.createMMI(new ITableLabelProvider()
{
public Image getColumnImage(Object element, int columnIndex)
{
Attribut attr = (Attribut) element;
if (columnIndex == 0)
{
if (attr.getDisplayOrder() == getFD().getIconAttrIndex())
{
return RscMan.getImage(RscMan.IN_BOSS);
}
else
{
if (attr.getDisplayOrder() == getFD().getLabelAttrIndex())
{
return RscMan.getImage(RscMan.IN_GREENBOOKMARK);
}
}
}
return null;
}
public String getColumnText(Object element, int columnIndex)
{
return tabv.getLstAttr().get(columnIndex).format(element);
}
public void addListener(ILabelProviderListener listener)
{
}