Skip to content

Commit f963d85

Browse files
committed
fix ClassDefinitionRule for dark theme (#179)
1 parent 62b7075 commit f963d85

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

com.sap.adt.abapcleaner.gui/src/com/sap/adt/abapcleaner/gui/ConfigComboBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void widgetSelected(SelectionEvent e) {
4747
for (String item : items)
4848
cboValue.add(item);
4949
cboValue.select(configValue.getValue());
50-
}
50+
}
5151

5252
@Override
5353
protected void detachControls() {

com.sap.adt.abapcleaner.gui/src/com/sap/adt/abapcleaner/gui/ConfigLabel.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ public Control[] getControlsForHighlight() {
2727
lblDescription = new Label(parent, SWT.NONE);
2828
lblDescription.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
2929
lblDescription.setText(configValue.description);
30-
if (configValue.isWarning)
30+
if (configValue.isWarning) {
3131
lblDescription.setForeground(new Color(255, 0, 0));
32+
}
3233
}
3334

3435
@Override
3536
protected void detachControls() {
36-
if (lblDescription != null)
37+
if (lblDescription != null) {
3738
lblDescription = null;
39+
}
3840
}
3941

4042
@Override
@@ -43,8 +45,13 @@ public void setDefault() {
4345

4446
@Override
4547
public void setEnabled(boolean enabled) {
46-
lblDescription.setText(enabled ? configValue.description : " ");
47-
if (enabled)
48-
lblDescription.requestLayout();
48+
String newText = enabled ? configValue.description : " ";
49+
// avoid layout request when the Control is first created to avoid issues with background color in dark theme
50+
if (!newText.equals(lblDescription.getText())) {
51+
lblDescription.setText(newText);
52+
if (enabled) {
53+
lblDescription.requestLayout();
54+
}
55+
}
4956
}
5057
}

com.sap.adt.abapcleaner.gui/src/com/sap/adt/abapcleaner/gui/FrmProfiles.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ public void widgetSelected(SelectionEvent e) {
836836
new Label(pnlOptionsInfo, SWT.NONE);
837837
new Label(pnlOptionsInfo, SWT.NONE);
838838
new Label(pnlOptionsInfo, SWT.NONE);
839-
839+
840840
pnlRuleOptions = new Composite(pnlRule, SWT.NONE);
841841
GridLayout gl_pnlRuleOptions = new GridLayout(3, false);
842842
gl_pnlRuleOptions.marginWidth = 0;

0 commit comments

Comments
 (0)