Commit be5ba6e6 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

IDE: fixed occurrence marker color for dark scheme (issue #441)


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 657fde77
......@@ -42,6 +42,10 @@ public final class PreferenceConstantValues {
public static final RGB PLUM = new RGB(221, 160, 221);
public static final RGB YELLOW = new RGB(225, 225, 127);
public static final RGB LIGHTORANGE = new RGB(225, 225, 127);
// annotation colors
public static final RGB MARK_OCCURRENCE_COLOR = new RGB(212, 212, 212);
public static final RGB MARK_OCCURRENCE_COLOR_DARK = new RGB(85, 87, 83);
@SuppressWarnings("serial")
public static final Map<String, Object> DefaultColorMap = new HashMap<String, Object>() {{
......
......@@ -238,6 +238,9 @@ public final class PreferenceConstants {
public static final String DEBUG_LOAD_SLEEP_BETWEEN_FILES = DEBUG + ".load.sleepBetweenFiles";
public static final String DEBUG_LOAD_YIELD_BETWEEN_CHECKS = DEBUG + ".load.yieldBetweenChecks";
// Annotation
public static final String UIEDITOR = "org.eclipse.ui.editors";
public static final String OCCURRENCE_MARKER_BACKGROUND_COLOR = "occurrenceMarkColor";
/** private constructor to disable instantiation */
private PreferenceConstants() {
......
......@@ -27,7 +27,9 @@ import org.eclipse.swt.graphics.RGB;
* @author Miklos Magyari
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
private enum ColorTheme { Light, Dark };
private ColorTheme colorTheme;
@Override
public final void initializeDefaultPreferences() {
final IPreferenceStore preferenceStore = getPreference();
......@@ -100,6 +102,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
preferenceStore.setDefault(PreferenceConstants.EXCLUDED_RESOURCES, "");
preferenceStore.setDefault(PreferenceConstants.T3DOC_ENABLE, false);
getColorTheme();
markOccurrences(preferenceStore);
onTheFlyChecker(preferenceStore);
titanActions(preferenceStore);
......@@ -204,6 +207,19 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
else if (entry.getValue() instanceof Boolean)
preferenceStore.setDefault(entry.getKey(), (Boolean) entry.getValue());
}
Preferences preferences = InstanceScope.INSTANCE.getNode(PreferenceConstants.UIEDITOR);
String markColor;
switch (colorTheme) {
case Dark:
markColor = StringConverter.asString((RGB)PreferenceConstantValues.MARK_OCCURRENCE_COLOR_DARK);
break;
case Light:
default:
markColor = StringConverter.asString((RGB)PreferenceConstantValues.MARK_OCCURRENCE_COLOR);
}
preferences.put(PreferenceConstants.OCCURRENCE_MARKER_BACKGROUND_COLOR, markColor);
}
private void debug(final IPreferenceStore preferenceStore) {
......@@ -231,12 +247,23 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
}
private Map<String, Object> getColorMap() {
switch (colorTheme) {
case Dark:
return PreferenceConstantValues.DarkColorMap;
case Light:
default:
return PreferenceConstantValues.DefaultColorMap;
}
}
private void getColorTheme() {
Preferences preferences = InstanceScope.INSTANCE.getNode("org.eclipse.e4.ui.css.swt.theme");
String theme = preferences.get("themeid", "default");
if (theme.toLowerCase().contains("dark"))
return PreferenceConstantValues.DarkColorMap;
else
return PreferenceConstantValues.DefaultColorMap;
if (theme.toLowerCase().contains("dark")) {
colorTheme = ColorTheme.Dark;
} else {
colorTheme = ColorTheme.Light;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment