mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
standard colors for Non-Project and Tests scopes
This commit is contained in:
@@ -57,11 +57,11 @@ public class FileColorManagerImpl extends FileColorManager implements Persistent
|
||||
static {
|
||||
ourDefaultColors = new LinkedHashMap<String, Color>();
|
||||
ourDefaultColors.put("Blue", new Color(215, 237, 243));
|
||||
ourDefaultColors.put("Green", new Color(228, 241, 209));
|
||||
ourDefaultColors.put("Green", new Color(231, 250, 219));
|
||||
ourDefaultColors.put("Orange", new Color(246, 224, 202));
|
||||
ourDefaultColors.put("Rose", new Color(242, 206, 202));
|
||||
ourDefaultColors.put("Violet", new Color(222, 213, 241));
|
||||
ourDefaultColors.put("Yellow", new Color(247, 241, 203));
|
||||
ourDefaultColors.put("Yellow", new Color(255, 255, 228));
|
||||
}
|
||||
|
||||
public FileColorManagerImpl(@NotNull final Project project) {
|
||||
@@ -218,6 +218,16 @@ public class FileColorManagerImpl extends FileColorManager implements Persistent
|
||||
return myModel.getSharedConfigurations();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getColorName(Color color) {
|
||||
for (String name : ourDefaultColors.keySet()) {
|
||||
if (color.equals(ourDefaultColors.get(name))) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static FileColorConfiguration findConfigurationByName(String name, List<FileColorConfiguration> configurations) {
|
||||
for (FileColorConfiguration configuration : configurations) {
|
||||
|
||||
@@ -70,7 +70,8 @@ public class FileColorsModel implements Cloneable {
|
||||
assert scope != null : "There is no custom scope with name " + scopeName;
|
||||
final Color color = ColorUtil.getColor(scope.getClass());
|
||||
assert color != null : scope.getClass().getName() + " is not annotated with @Colored";
|
||||
globalScopesColors.put(scopeName, ColorUtil.toHex(color));
|
||||
final String colorName = FileColorManagerImpl.getColorName(color);
|
||||
globalScopesColors.put(scopeName, colorName == null ? ColorUtil.toHex(color) : colorName);
|
||||
}
|
||||
}
|
||||
initGlobalScopes();
|
||||
@@ -89,10 +90,12 @@ public class FileColorsModel implements Cloneable {
|
||||
|
||||
private void initGlobalScopes() {
|
||||
for (String scopeName : globalScopes.keySet()) {
|
||||
if (findConfiguration(scopeName, false) == null) {
|
||||
final String color = PropertiesComponent.getInstance().getOrInit(globalScopes.get(scopeName), globalScopesColors.get(scopeName));
|
||||
if (findConfiguration(scopeName, false) == null) {
|
||||
final String color = PropertiesComponent.getInstance().getOrInit(globalScopes.get(scopeName), globalScopesColors.get(scopeName));
|
||||
if (color.length() != 0) {
|
||||
myConfigurations.add(new FileColorConfiguration(scopeName, color));
|
||||
final Color col = ColorUtil.fromHex(color, null);
|
||||
final String name = col == null ? null : FileColorManagerImpl.getColorName(col);
|
||||
myConfigurations.add(new FileColorConfiguration(scopeName, name == null ? color : name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user