_model.fireModelChanged();
}
});
_tblViewerMediaKeys = new TableViewer(_tblMediaKeys);
CellEditor[] editors = new CellEditor[4];
editors[0] = new TextCellEditor(_tblMediaKeys);
editors[1] = new TextCellEditor(_tblMediaKeys);
editors[2] = new CheckboxCellEditor(_tblMediaKeys, SWT.CENTER);
editors[3] = new CheckboxCellEditor(_tblMediaKeys, SWT.CENTER);
_tblViewerMediaKeys.setCellEditors(editors);
BeanListTableModelCellModifier modifier = new BeanListTableModelCellModifier(_tblViewerMediaKeys, _mediaKeysModel);
modifier.setEditMode(2, BeanListTableModelCellModifier.EDIT_MODE_ON_SINGLE_CLICK);
modifier.setEditMode(3, BeanListTableModelCellModifier.EDIT_MODE_ON_SINGLE_CLICK);
_tblViewerMediaKeys.setCellModifier(modifier);
_tblViewerMediaKeys.setContentProvider(new BeanListTableModelContentProvider());
_tblViewerMediaKeys.setLabelProvider(new BeanListTableModelLabelProvider(_mediaKeysModel));
_tblViewerMediaKeys.setInput(_mediaKeysModel);
_btnAddMediaKey = toolkit.createButton(sectionClient, "add", SWT.PUSH);
_btnAddMediaKey.setLayoutData(btnLayout);
_btnAddMediaKey.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleAddMediaKey();
}
});
_btnRemoveMediaKey = toolkit.createButton(sectionClient, "remove", SWT.PUSH);
_btnRemoveMediaKey.setLayoutData(btnLayout);
_btnRemoveMediaKey.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleRemoveMediaKey();
}
});
// encoder section
section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
section.setText("Encoder Mappings");
sectionClient = toolkit.createComposite(section);
sectionClient.setLayout(sectionLayout);
section.setClient(sectionClient);
// create Table encoder mappings
_tblEncoderMappings = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
_tblEncoderMappings.setHeaderVisible(true);
_tblEncoderMappings.setLayoutData(GridDataFactory.copyData(tblLayoutData));
registerField("encoderMappings", _tblEncoderMappings);
_encoderNameColumn = new TableColumn(_tblEncoderMappings, SWT.NONE);
_encoderNameColumn.setText("Encoder name");
_encoderNameColumn.setWidth((int)(tableWidth * 0.5));
_encoderImplClassColumn = new TableColumn(_tblEncoderMappings, SWT.NONE);
_encoderImplClassColumn.setText("Implementation class");
_encoderImplClassColumn.setWidth((int)(tableWidth * 0.5));
_encoderMappingsModel = new EncoderMappingsModel(_model.getEncoderMappings());
_encoderMappingsModel.addListener(new BeanListTableModelListener() {
public void add(Object bean) {
_model.fireModelChanged();
}
public void remove(Object bean) {
_model.fireModelChanged();
}
public void update(Object bean) {
_model.fireModelChanged();
}
@SuppressWarnings("unchecked")
public void refresh(List beans) {
_model.fireModelChanged();
}
});
_tblViewerEncoderMappings = new TableViewer(_tblEncoderMappings);
// text editors for both columns
editors = new CellEditor[2];
editors[0] = new TextCellEditor(_tblEncoderMappings);
editors[1] = new TextCellEditor(_tblEncoderMappings);
_tblViewerEncoderMappings.setCellEditors(editors);
_tblViewerEncoderMappings.setCellModifier(new BeanListTableModelCellModifier(_tblViewerEncoderMappings, _encoderMappingsModel));
_tblViewerEncoderMappings.setContentProvider(new BeanListTableModelContentProvider());
_tblViewerEncoderMappings.setLabelProvider(new BeanListTableModelLabelProvider(_encoderMappingsModel));
_tblViewerEncoderMappings.setInput(_encoderMappingsModel);
_btnAddEncoderMapping = toolkit.createButton(sectionClient, "add", SWT.PUSH);
_btnAddEncoderMapping.setLayoutData(btnLayout);
_btnAddEncoderMapping.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleAddEncoderMapping();
}
});
_btnRemoveEncoderMapping = toolkit.createButton(sectionClient, "remove", SWT.PUSH);
_btnRemoveEncoderMapping.setLayoutData(btnLayout);
_btnRemoveEncoderMapping.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleRemoveEncoderMapping();
}
});
// element section
section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
section.setText("Element Mappings");
sectionClient = toolkit.createComposite(section);
section.setClient(sectionClient);
sectionLayout.numColumns = 2;
sectionClient.setLayout(sectionLayout);
// create Table element mappings
_tblElementMappings = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
_tblElementMappings.setHeaderVisible(true);
_tblElementMappings.setLayoutData(GridDataFactory.copyData(tblLayoutData));
registerField("elementMappings", _tblElementMappings);
_elementNameColumn = new TableColumn(_tblElementMappings, SWT.NONE);
_elementNameColumn.setText("Element name");
_elementNameColumn.setWidth((int)(tableWidth * 0.5));
_elementImplClassColumn = new TableColumn(_tblElementMappings, SWT.NONE);
_elementImplClassColumn.setText("Implementation class");
_elementImplClassColumn.setWidth((int)(tableWidth * 0.5));
_elementMappingsModel = new ElementMappingsModel(_model.getElementMappings());
_elementMappingsModel.addListener(new BeanListTableModelListener() {
public void add(Object bean) {
_model.fireModelChanged();
}
public void remove(Object bean) {
_model.fireModelChanged();
}
public void update(Object bean) {
_model.fireModelChanged();
}
@SuppressWarnings("unchecked")
public void refresh(List beans) {
_model.fireModelChanged();
}
});
_tblViewerElementMappings = new TableViewer(_tblElementMappings);
// text editors for both columns
editors = new CellEditor[2];
editors[0] = new TextCellEditor(_tblElementMappings);
editors[1] = new TextCellEditor(_tblElementMappings);