Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 328708 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java (-41 / +38 lines)
Lines 1453-1498 Link Here
1453
        updateControls();
1453
        updateControls();
1454
    }
1454
    }
1455
1455
1456
    /**
1456
	/**
1457
     * Resets the supplied definition to its default value.
1457
	 * Resets the supplied definition to its default value.
1458
     * 
1458
	 * 
1459
     * @param definition the <code>ColorDefinition</code> to reset.
1459
	 * @param definition
1460
     * @return whether any change was made.
1460
	 *            the <code>ColorDefinition</code> to reset
1461
     */
1461
	 */
1462
    private boolean resetColor(ColorDefinition definition) {
1462
	private void resetColor(ColorDefinition definition) {
1463
        if (!isDefault(definition)) {
1463
		if (!isDefault(definition)) {
1464
            RGB newRGB;
1464
			RGB newRGB;
1465
            if (definition.getValue() != null)
1465
			if (definition.getDefaultsTo() != null) {
1466
                newRGB = definition.getValue();
1466
				newRGB = getColorAncestorValue(definition);
1467
            else
1467
				colorPreferencesToSet.remove(definition.getId());
1468
                newRGB = getColorAncestorValue(definition);
1468
			} else {
1469
1469
				newRGB = definition.getValue();
1470
            if (newRGB != null) {
1470
				setColorPreferenceValue(definition, newRGB);
1471
                setColorPreferenceValue(definition, newRGB);
1471
			}
1472
                setRegistryValue(definition, newRGB);
1473
                return true;
1474
            }
1475
        }
1476
        return false;
1477
    }
1478
1472
1479
    protected boolean resetFont(FontDefinition definition) {
1473
			if (newRGB != null) {
1480
        if (!isDefault(definition)) {
1474
				setRegistryValue(definition, newRGB);
1481
            FontData[] newFD;
1475
			}
1482
            if (definition.getDefaultsTo() != null)
1476
		}
1483
                newFD = getFontAncestorValue(definition);
1477
	}
1484
            else
1478
1485
                newFD = PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(), ThemeElementHelper
1479
	private void resetFont(FontDefinition definition) {
1486
                                .createPreferenceKey(currentTheme, definition.getId()));
1480
		if (!isDefault(definition)) {
1487
1481
			FontData[] newFD;
1488
            if (newFD != null) {
1482
			if (definition.getDefaultsTo() != null) {
1489
                setFontPreferenceValue(definition, newFD);
1483
				newFD = getFontAncestorValue(definition);
1490
                setRegistryValue(definition, newFD);
1484
				fontPreferencesToSet.remove(definition.getId());
1491
                return true;
1485
			} else {
1492
            }
1486
				newFD = PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(),
1493
        }
1487
						ThemeElementHelper.createPreferenceKey(currentTheme, definition.getId()));
1494
        return false;
1488
				setFontPreferenceValue(definition, newFD);
1495
    }
1489
			}
1490
			setRegistryValue(definition, newFD);
1491
		}
1492
	}
1496
1493
1497
    /**
1494
    /**
1498
     * Set the value (in preferences) for the given color.
1495
     * Set the value (in preferences) for the given color.
Lines 1539-1546 Link Here
1539
    }
1536
    }
1540
1537
1541
    protected void setFontPreferenceValue(FontDefinition definition, FontData[] datas) {
1538
    protected void setFontPreferenceValue(FontDefinition definition, FontData[] datas) {
1542
        setDescendantRegistryValues(definition, datas);
1539
		setDescendantRegistryValues(definition, datas);
1543
        fontPreferencesToSet.put(definition.getId(), datas);
1540
		fontPreferencesToSet.put(definition.getId(), datas);
1544
    }
1541
    }
1545
1542
1546
    /**
1543
    /**

Return to bug 328708