mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-225722 Quick doc popup font is either too small or too big
add migration from old setting GitOrigin-RevId: edcf12d2ac230267c554a54178d8d584900b34b5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
90119411f9
commit
a1488967be
+22
-6
@@ -127,7 +127,8 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
private SmartPsiElementPointer<PsiElement> myElement;
|
||||
private long myModificationCount;
|
||||
|
||||
private static final String QUICK_DOC_FONT_SIZE_PROPERTY = "quick.doc.font.size";
|
||||
private static final String QUICK_DOC_FONT_SIZE_OLD_PROPERTY = "quick.doc.font.size";
|
||||
private static final String QUICK_DOC_FONT_SIZE_PROPERTY = "quick.doc.font.size.v2";
|
||||
|
||||
private final Stack<Context> myBackStack = new Stack<>();
|
||||
private final Stack<Context> myForwardStack = new Stack<>();
|
||||
@@ -656,16 +657,31 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
|
||||
@NotNull
|
||||
public static FontSize getQuickDocFontSize() {
|
||||
String strValue = PropertiesComponent.getInstance().getValue(QUICK_DOC_FONT_SIZE_PROPERTY);
|
||||
FontSize fontSize = readFontSizeFromSettings(QUICK_DOC_FONT_SIZE_PROPERTY);
|
||||
if (fontSize != null) return fontSize;
|
||||
FontSize oldFontSize = readFontSizeFromSettings(QUICK_DOC_FONT_SIZE_OLD_PROPERTY);
|
||||
if (oldFontSize != null) {
|
||||
// migrate old-scale setting
|
||||
PropertiesComponent.getInstance().unsetValue(QUICK_DOC_FONT_SIZE_OLD_PROPERTY);
|
||||
FontSize newFontSize = oldFontSize == FontSize.X_LARGE ? FontSize.XX_LARGE
|
||||
: oldFontSize == FontSize.LARGE ? FontSize.X_LARGE
|
||||
: oldFontSize;
|
||||
setQuickDocFontSize(newFontSize);
|
||||
return newFontSize;
|
||||
}
|
||||
return FontSize.SMALL;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static FontSize readFontSizeFromSettings(@NotNull String propertyName) {
|
||||
String strValue = PropertiesComponent.getInstance().getValue(propertyName);
|
||||
if (strValue != null) {
|
||||
try {
|
||||
return FontSize.valueOf(strValue);
|
||||
}
|
||||
catch (IllegalArgumentException iae) {
|
||||
// ignore, fall back to default font.
|
||||
}
|
||||
catch (IllegalArgumentException ignored) {}
|
||||
}
|
||||
return FontSize.SMALL;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void setQuickDocFontSize(@NotNull FontSize fontSize) {
|
||||
|
||||
Reference in New Issue
Block a user