@Override
protected Control createDialogArea(Composite parent) {
setTitleImage(MusicPlugin.getImage());
setMessage(MusicMessages.ManageSourcesDialog_0 + this.filename);
setTitle(MusicMessages.ManageSourcesDialog_1);
final WritableList writableList = new WritableList(this.sourceList, SourceBindingWrapper.class);
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
Button btnCreateSource = new Button(container, SWT.NONE);
btnCreateSource.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Source newSource = new Source();
newSource.setId("Source_" + (table.getItemCount() + 1)); //$NON-NLS-1$
SourceBindingWrapper sourceBindingWrapper = new SourceBindingWrapper(newSource);
writableList.add(sourceBindingWrapper);
tableViewer.setSelection(new StructuredSelection(sourceBindingWrapper));
}
});
btnCreateSource.setBounds(440, 15, 100, 30);
btnCreateSource.setText(MusicMessages.ManageSourcesDialog_3);
Button btnDeleteSource = new Button(container, SWT.NONE);
btnDeleteSource.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
StructuredSelection selection = (StructuredSelection) tableViewer.getSelection();
writableList.remove(selection.getFirstElement());
}
});
btnDeleteSource.setBounds(440, 51, 100, 30);
btnDeleteSource.setText(MusicMessages.ManageSourcesDialog_4);