use of eu.esdihumboldt.hale.ui.schema.presets.internal.SchemaPresetSelector in project hale by halestudio.
the class PresetsSource method createControls.
/**
* @see ImportSource#createControls(Composite)
*/
@Override
public void createControls(Composite parent) {
GridLayoutFactory parentLayout = GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false);
parentLayout.applyTo(parent);
GridDataFactory labelData = //
GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER);
GridDataFactory controlData = //
GridDataFactory.swtDefaults().align(SWT.FILL, //
SWT.CENTER).grab(true, false);
// preset label
Label label = new Label(parent, SWT.NONE);
label.setText("Select preset:");
labelData.applyTo(label);
// preset selector
selector = new SchemaPresetSelector(parent);
selector.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (description != null) {
SchemaPreset schema = selector.getSelectedObject();
if (schema != null && schema.getDescription() != null) {
description.setText(schema.getDescription());
} else {
description.setText("");
}
}
updateState(true);
}
});
controlData.applyTo(selector.getControl());
// skipper
Composite empty = new Composite(parent, SWT.NONE);
GridDataFactory.swtDefaults().hint(1, 1).applyTo(empty);
// description label
description = new Label(parent, SWT.WRAP);
GridDataFactory.fillDefaults().grab(true, true).applyTo(description);
// preset label
label = new Label(parent, SWT.NONE);
label.setText("Import as");
labelData.applyTo(label);
// create provider combo
ComboViewer providers = createProviders(parent);
controlData.applyTo(providers.getControl());
// prevent selector appearing very small
parent.pack();
// initial state update
updateState(true);
}
Aggregations