Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added possibility to configure descriptions for synthesis options and show them in tooltips on hover. #108

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ private SynthesisOptionControlFactory createCategorySynthesisOptionControlFactor
// Create category container for diagram synthesis options
Section categorySection = formToolkit.createSection(parent,
Section.CLIENT_INDENT | Section.NO_TITLE_FOCUS_BOX | Section.TWISTIE);


categorySection.setToolTipText(option.getDescription());
if (option.getName() != null && !option.getName().isEmpty()) {
categorySection.setText(option.getName());
} else {
Expand Down Expand Up @@ -406,7 +407,7 @@ private void createCheckOptionControl(final SynthesisOption option,
final ViewContext context) {

final Button checkButton = formToolkit.createButton(parent, option.getName(), SWT.CHECK);
checkButton.setToolTipText(option.getName());
checkButton.setToolTipText(option.getDescription());
controls.add(checkButton);

// set initial value
Expand Down Expand Up @@ -462,7 +463,8 @@ private void createChoiceOptionControl(final SynthesisOption option, final ViewC
controls.add(valuesContainer);

// add the radio group label ...
formToolkit.createLabel(valuesContainer, option.getName() + ":");
Label label = formToolkit.createLabel(valuesContainer, option.getName() + ":");
label.setToolTipText(option.getDescription());

// ... and a radio button for each possible value
GridData vGd;
Expand All @@ -472,7 +474,7 @@ private void createChoiceOptionControl(final SynthesisOption option, final ViewC

// create the button ...
final Button button = formToolkit.createButton(valuesContainer, value.toString(), SWT.RADIO);
button.setToolTipText(value.toString());
button.setToolTipText(option.getDescription());;
button.setLayoutData(vGd);

final String us = option.getUpdateStrategy();
Expand Down Expand Up @@ -533,12 +535,13 @@ private void createRangeOptionControl(final SynthesisOption option, final ViewCo

// add the label ...
final Label label = formToolkit.createLabel(container, "");
label.setToolTipText(option.getDescription());

// ... and the scaler for choosing the value
final Scale scale = new Scale(container, SWT.NONE);
// the following setting is needed on windows
scale.setBackground(container.getBackground());
scale.setToolTipText(option.getName());
scale.setToolTipText(option.getDescription());

// configure its layout, esp. the minimal width and the 'grab additional space'
final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
Expand Down Expand Up @@ -678,9 +681,11 @@ private void createTextOptionControl(final SynthesisOption option, final ViewCon

// add the label ...
final Label label = formToolkit.createLabel(container, "");
label.setToolTipText(option.getDescription());

// ... and the text box for choosing the value
final Text text = formToolkit.createText(container, (String) context.getOptionValue(option));
text.setToolTipText(option.getDescription());

// configure its layout
final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ private enum TransformationOptionType {
private String updateAction = null;
/** The optional category option. */
private SynthesisOption category = null;
/** An optional description of this option. */
private String description = null;

/**
* Constructor.
Expand Down Expand Up @@ -883,6 +885,24 @@ public SynthesisOption setCategory(final SynthesisOption newCategory) {
return this;
}

/**
* @return the description of what this option does, or the option's name if not configured.
*/
public String getDescription() {
return description != null ? description : getName();
}

/**
* Sets the description of what this option does.
* @param newDescription
* the new description for this option, or <code>null</code> to unset this option.
* @return <code>this</code> {@link SynthesisOption} for convenience.
*/
public SynthesisOption setDescription(final String newDescription) {
this.description = newDescription;
return this;
}

/**
* Creates a synthesis option id using the class and the name of the option.
*
Expand Down