Skip to content

Commit

Permalink
fix ClassDefinitionRule for dark theme (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgrassau committed Nov 1, 2023
1 parent 62b7075 commit f963d85
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void widgetSelected(SelectionEvent e) {
for (String item : items)
cboValue.add(item);
cboValue.select(configValue.getValue());
}
}

@Override
protected void detachControls() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ public Control[] getControlsForHighlight() {
lblDescription = new Label(parent, SWT.NONE);
lblDescription.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
lblDescription.setText(configValue.description);
if (configValue.isWarning)
if (configValue.isWarning) {
lblDescription.setForeground(new Color(255, 0, 0));
}
}

@Override
protected void detachControls() {
if (lblDescription != null)
if (lblDescription != null) {
lblDescription = null;
}
}

@Override
Expand All @@ -43,8 +45,13 @@ public void setDefault() {

@Override
public void setEnabled(boolean enabled) {
lblDescription.setText(enabled ? configValue.description : " ");
if (enabled)
lblDescription.requestLayout();
String newText = enabled ? configValue.description : " ";
// avoid layout request when the Control is first created to avoid issues with background color in dark theme
if (!newText.equals(lblDescription.getText())) {
lblDescription.setText(newText);
if (enabled) {
lblDescription.requestLayout();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public void widgetSelected(SelectionEvent e) {
new Label(pnlOptionsInfo, SWT.NONE);
new Label(pnlOptionsInfo, SWT.NONE);
new Label(pnlOptionsInfo, SWT.NONE);

pnlRuleOptions = new Composite(pnlRule, SWT.NONE);
GridLayout gl_pnlRuleOptions = new GridLayout(3, false);
gl_pnlRuleOptions.marginWidth = 0;
Expand Down

0 comments on commit f963d85

Please sign in to comment.