Skip to content

Commit

Permalink
synchronize the views with the template selector
Browse files Browse the repository at this point in the history
The plug-in template selector has two components -
template list, and the help text (FormBrowser).
While the first widget follows the toggle button
properly, the formbrowser does not.

Fix that, by toggling between enabled and disabled
states following the template selector button.
  • Loading branch information
gireeshpunathil authored and vogella committed Mar 22, 2023
1 parent 3707839 commit adbfaf2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class FormBrowser {
FormToolkit toolkit;
Composite container;
ScrolledFormText formText;
FormText ftext;
String text;
int style;

Expand All @@ -44,7 +45,7 @@ public void createControl(Composite parent) {
formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
toolkit.paintBordersFor(container);
}
FormText ftext = toolkit.createFormText(formText, false);
ftext = toolkit.createFormText(formText, false);
formText.setFormText(ftext);
formText.setExpandHorizontal(true);
formText.setExpandVertical(true);
Expand Down Expand Up @@ -72,4 +73,11 @@ public void setText(String text) {
if (formText != null)
formText.setText(text);
}

public void setEnabled(boolean enabled) {
if (formText != null)
formText.setEnabled(enabled);
if (ftext != null)
ftext.setEnabled(enabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ public void setDescriptionEnabled(boolean enabled) {
Control dcontrol = descriptionBrowser.getControl();
if (dcontrol != null)
dcontrol.setEnabled(enabled);
descriptionBrowser.setEnabled(enabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ protected void initializeViewer() {
wizardSelectionViewer.addFilter(new WizardFilter());
if (getInitialTemplateId() != null)
selectInitialTemplate();
setDescriptionEnabled(false);
}

private void selectInitialTemplate() {
Expand Down

0 comments on commit adbfaf2

Please sign in to comment.