use of eu.esdihumboldt.hale.ui.common.definition.AttributeInputDialog in project hale by halestudio.
the class ClassificationMappingParameterPage method createFixedValueInputButton.
/**
* Creates an button to open an editor for setting the fixed value.
*
* @param initialValue the initial value or null
*/
private void createFixedValueInputButton(final String initialValue) {
if (fixedValueInputButton != null) {
fixedValueInputButton.dispose();
if (fixedValueText != null) {
fixedValueText.dispose();
fixedValueText = null;
}
}
setPageComplete(false);
fixedValueInputButton = new Button(notClassifiedActionComposite, SWT.PUSH);
fixedValueInputButton.setText("Select");
fixedValueInputButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
// Set the text for the label
if (fixedValueText == null && initialValue != null) {
fixedValueText = new Text(notClassifiedActionComposite, SWT.READ_ONLY | SWT.BORDER);
fixedValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
notClassifiedActionComposite.layout();
fixedValueText.setText(initialValue);
}
fixedValueInputButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AttributeInputDialog dialog = new AttributeInputDialog(targetProperty, targetEntity, Display.getCurrent().getActiveShell(), "Set default value", "This value will be assigned to targets when the source value is not mapped", new TransformationVariableReplacer());
if (initialValue != null) {
AttributeEditor<?> editor = dialog.getEditor();
if (editor != null) {
editor.setAsText(initialValue);
}
}
if (dialog.open() == Dialog.OK) {
if (fixedValueText == null) {
fixedValueText = new Text(notClassifiedActionComposite, SWT.READ_ONLY | SWT.BORDER);
fixedValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
notClassifiedActionComposite.layout();
}
fixedValueText.setText(dialog.getValueAsText());
setPageComplete(true);
}
}
});
notClassifiedActionComposite.layout();
notClassifiedActionComposite.getParent().layout();
}
use of eu.esdihumboldt.hale.ui.common.definition.AttributeInputDialog in project hale by halestudio.
the class ClassificationMappingParameterPage method selectValue.
private Value selectValue(PropertyDefinition property, EntityDefinition entity, String title, String message, String initialValue) {
AttributeInputDialog dialog = new AttributeInputDialog(property, entity, Display.getCurrent().getActiveShell(), title, message, new TransformationVariableReplacer());
dialog.create();
if (initialValue != null)
dialog.getEditor().setAsText(initialValue);
if (dialog.open() == Dialog.OK)
return Value.of(dialog.getValueAsText());
else
return null;
}
Aggregations