Skip to content
Open
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 @@ -1352,12 +1352,16 @@ private RGB getColorTakingPreferenceDefaultValueIntoAccount(ColorDefinition defi
return valueFromExtension;
}
String storeDefault = store.getDefaultString(id);
if (storeDefault == null) {
if (storeDefault == null || storeDefault.isBlank()) {
return valueFromExtension;
}
try {
RGB defaultRGB = ColorUtil.getColorValue(storeDefault);
if (defaultRGB != null && !defaultRGB.equals(valueFromExtension)) {
if (getActiveTheme() != null
&& LightColorFactory.isColorDefinitionIdPartOfLightColorFactory(id)) {
return valueFromExtension;
}
return defaultRGB;
}
} catch (DataFormatException e) { // silently ignored
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.eclipse.ui.internal.themes;

import java.util.Hashtable;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.swt.graphics.RGB;
Expand All @@ -31,6 +30,10 @@
*/
public class LightColorFactory implements IColorFactory, IExecutableExtension {

private static final String ACTIVE_NOFOCUS_TAB_BG_START = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START"; //$NON-NLS-1$
private static final String ACTIVE_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"; //$NON-NLS-1$
private static final String ACTIVE_TAB_BG_END = "org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"; //$NON-NLS-1$
private static final String ACTIVE_TAB_BG_START = "org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"; //$NON-NLS-1$
protected static final RGB white = ColorUtil.getColorValue("COLOR_WHITE"); //$NON-NLS-1$
protected static final RGB black = ColorUtil.getColorValue("COLOR_BLACK"); //$NON-NLS-1$

Expand Down Expand Up @@ -157,23 +160,30 @@ private RGB getActiveNofocusStartColor() {
return ColorUtil.blend(white, base, 40);
}

static boolean isColorDefinitionIdPartOfLightColorFactory(String id) {
if (ACTIVE_TAB_BG_START.equals(id) || ACTIVE_TAB_BG_END.equals(id) || ACTIVE_TAB_TEXT_COLOR.equals(id)
|| ACTIVE_NOFOCUS_TAB_BG_START.equals(id)) {
return true;
}
return false;
}

@Override
public RGB createColor() {
// should have base, otherwise error in the xml
if (baseColorName == null || definitionId == null) {
return white;
}

if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START")) { //$NON-NLS-1$
if (definitionId.equals(ACTIVE_TAB_BG_START)) {
return getActiveFocusStartColor();
}
if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END")) { //$NON-NLS-1$
if (definitionId.equals(ACTIVE_TAB_BG_END)) {
return getActiveFocusEndColor();
}
if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")) { //$NON-NLS-1$
if (definitionId.equals(ACTIVE_TAB_TEXT_COLOR)) {
return getActiveFocusTextColor();
}
if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START")) { //$NON-NLS-1$
if (definitionId.equals(ACTIVE_NOFOCUS_TAB_BG_START)) {
return getActiveNofocusStartColor();
}

Expand Down
Loading