mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -137,6 +137,9 @@
|
||||
<val name="flags" val="{java.awt.Font.PLAIN, java.awt.Font.BOLD, java.awt.Font.ITALIC}" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.awt.Font java.awt.Font deriveFont(float)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name="java.awt.Font java.awt.Font deriveFont(int) 0">
|
||||
<annotation name="org.intellij.lang.annotations.MagicConstant">
|
||||
<val name="flags" val="{java.awt.Font.PLAIN, java.awt.Font.BOLD, java.awt.Font.ITALIC}" />
|
||||
@@ -152,6 +155,12 @@
|
||||
<val name="flags" val="{java.awt.Font.PLAIN, java.awt.Font.BOLD, java.awt.Font.ITALIC}" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.awt.FontMetrics int stringWidth(java.lang.String) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.awt.Graphics void drawString(java.lang.String, int, int) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name="java.awt.KeyboardFocusManager void addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) 0">
|
||||
<annotation name="org.jetbrains.annotations.NonNls" />
|
||||
</item>
|
||||
@@ -248,6 +257,9 @@
|
||||
<val name="flagsFromClass" val="java.awt.event.InputEvent.class" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.awt.Toolkit java.awt.Cursor createCustomCursor(java.awt.Image, java.awt.Point, java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.awt.Window void setLocation(java.awt.Point) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
<val name="flagsFromClass" val="java.lang.reflect.Modifier.class" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.lang.Class java.io.InputStream getResourceAsStream(java.lang.String) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name="java.lang.Class java.lang.Class<?> forName(java.lang.String) 0">
|
||||
<annotation name="org.jetbrains.annotations.NonNls" />
|
||||
</item>
|
||||
|
||||
@@ -491,6 +491,12 @@
|
||||
<item name="javax.swing.UIManager java.lang.Object get(java.lang.Object) 0">
|
||||
<annotation name="org.jetbrains.annotations.NonNls" />
|
||||
</item>
|
||||
<item name='javax.swing.UIManager java.lang.String getCrossPlatformLookAndFeelClassName()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='javax.swing.UIManager java.lang.String getSystemLookAndFeelClassName()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name="javax.swing.UIManager javax.swing.Icon getIcon(java.lang.Object) 0">
|
||||
<annotation name="org.jetbrains.annotations.NonNls" />
|
||||
</item>
|
||||
|
||||
@@ -321,7 +321,7 @@ public enum EffectPainter2D implements RegionPainter2D<Font> {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
BufferedImage getImage(Graphics2D g, Color color, double height) {
|
||||
BufferedImage getImage(@NotNull Graphics2D g, Color color, double height) {
|
||||
ConcurrentHashMap<Integer, BufferedImage> cache = UIUtil.isJreHiDPI(g) ? myHiDPICache : myNormalCache;
|
||||
int key = Objects.hash(color.getRGB(), JBUI.sysScale(g), height);
|
||||
BufferedImage image = cache.get(key);
|
||||
@@ -333,7 +333,7 @@ public enum EffectPainter2D implements RegionPainter2D<Font> {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
BufferedImage createImage(Graphics2D g, Paint paint, double height) {
|
||||
BufferedImage createImage(@NotNull Graphics2D g, Paint paint, double height) {
|
||||
double period = getPeriod(height);
|
||||
int width = (int)period << (paint instanceof Color ? 8 : 1);
|
||||
if (width <= 0 || height <= 0) return null;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -28,7 +30,7 @@ public class GraphicsConfig {
|
||||
private final Composite myComposite;
|
||||
private final Stroke myStroke;
|
||||
|
||||
public GraphicsConfig(Graphics g) {
|
||||
public GraphicsConfig(@NotNull Graphics g) {
|
||||
myG = (Graphics2D)g;
|
||||
myHints = (Map)myG.getRenderingHints().clone();
|
||||
myComposite = myG.getComposite();
|
||||
|
||||
@@ -22,7 +22,7 @@ import static com.intellij.util.ObjectUtils.notNull;
|
||||
*/
|
||||
@SuppressWarnings("UseJBColor")
|
||||
public class JBColor extends Color {
|
||||
public final static Color PanelBackground = namedColor("Panel.background", 0xffffff);
|
||||
public static final Color PanelBackground = namedColor("Panel.background", 0xffffff);
|
||||
|
||||
private static class Lazy {
|
||||
private static volatile boolean DARK = UIUtil.isUnderDarcula();
|
||||
@@ -47,11 +47,13 @@ public class JBColor extends Color {
|
||||
func = function;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JBColor namedColor(@NotNull String propertyName, int defaultValueRGB) {
|
||||
return namedColor(propertyName, new Color(defaultValueRGB));
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public static JBColor namedColor(@NotNull final String propertyName, @NotNull final Color defaultColor) {
|
||||
return new JBColor(new NotNullProducer<Color>() {
|
||||
@NotNull
|
||||
|
||||
@@ -110,7 +110,6 @@ public class JBHiDPIScaledImage extends BufferedImage {
|
||||
* @param height the height in user coordinate space
|
||||
* @param rm the rounding mode to apply when converting width/height to the device space
|
||||
* @param type the type
|
||||
* @param rm the rounding mode
|
||||
*/
|
||||
public JBHiDPIScaledImage(@Nullable GraphicsConfiguration gc, double width, double height, int type, @NotNull RoundingMode rm) {
|
||||
this(JBUI.sysScale(gc), width, height, type, rm);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class RetinaImage { // [tav] todo: create HiDPIImage class
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static BufferedImage create(Graphics2D g, double width, double height, int type, RoundingMode rm) {
|
||||
public static BufferedImage create(Graphics2D g, double width, double height, int type, @NotNull RoundingMode rm) {
|
||||
return new JBHiDPIScaledImage(g, width, height, type, rm);
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ public class RetinaImage { // [tav] todo: create HiDPIImage class
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static BufferedImage create(GraphicsConfiguration gc, double width, double height, int type, RoundingMode rm) {
|
||||
public static BufferedImage create(GraphicsConfiguration gc, double width, double height, int type, @NotNull RoundingMode rm) {
|
||||
return new JBHiDPIScaledImage(gc, width, height, type, rm);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static BufferedImage create(ScaleContext ctx, double width, double height, int type, RoundingMode rm) {
|
||||
public static BufferedImage create(ScaleContext ctx, double width, double height, int type, @NotNull RoundingMode rm) {
|
||||
return new JBHiDPIScaledImage(ctx, width, height, type, rm);
|
||||
}
|
||||
|
||||
|
||||
@@ -425,8 +425,9 @@ public class JBUI {
|
||||
* @return the result
|
||||
*/
|
||||
public static float setUserScaleFactor(float scale) {
|
||||
if (DEBUG_USER_SCALE_FACTOR.isNotNull()) {
|
||||
float debugScale = ObjectUtils.notNull(DEBUG_USER_SCALE_FACTOR.get());
|
||||
Float factor = DEBUG_USER_SCALE_FACTOR.get();
|
||||
if (factor != null) {
|
||||
float debugScale = factor;
|
||||
if (scale == debugScale) {
|
||||
setUserScaleFactorProperty(debugScale); // set the debug value as is, or otherwise ignore
|
||||
}
|
||||
@@ -494,6 +495,7 @@ public class JBUI {
|
||||
return new JBValue.UIInteger(key, defValue);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JBDimension size(int width, int height) {
|
||||
return new JBDimension(width, height);
|
||||
}
|
||||
@@ -662,6 +664,7 @@ public class JBUI {
|
||||
|
||||
@SuppressWarnings("UseDPIAwareBorders")
|
||||
public static class Borders {
|
||||
@NotNull
|
||||
public static JBEmptyBorder empty(int top, int left, int bottom, int right) {
|
||||
if (top == 0 && left == 0 && bottom == 0 && right == 0) {
|
||||
return SHARED_EMPTY_INSTANCE;
|
||||
@@ -811,6 +814,7 @@ public class JBUI {
|
||||
/**
|
||||
* Creates a context with all scale factors set to 1.
|
||||
*/
|
||||
@NotNull
|
||||
public static BaseScaleContext createIdentity() {
|
||||
return create(USR_SCALE.of(1));
|
||||
}
|
||||
@@ -937,8 +941,13 @@ public class JBUI {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Double.valueOf(usrScale.value).hashCode() * 10 +
|
||||
Double.valueOf(objScale.value).hashCode();
|
||||
return hash(usrScale.value) * 31 + hash(objScale.value);
|
||||
}
|
||||
|
||||
private static int hash(double value) {
|
||||
// todo replace with Double.hashCode(double) when language level goes up to 8
|
||||
long bits = Double.doubleToLongBits(value);
|
||||
return (int)(bits ^ (bits >>> 32));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1009,7 +1018,7 @@ public class JBUI {
|
||||
* @param dataProvider provides a data object matching the passed scale context
|
||||
*/
|
||||
public Cache(@NotNull Function<? super S, ? extends D> dataProvider) {
|
||||
this.myDataProvider = dataProvider;
|
||||
myDataProvider = dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1733,20 +1742,24 @@ public class JBUI {
|
||||
public static class Focus {
|
||||
private static final Color GRAPHITE_COLOR = new JBColor(new Color(0x8099979d, true), new Color(0x676869));
|
||||
|
||||
@NotNull
|
||||
public static Color focusColor() {
|
||||
return UIUtil.isGraphite() ? GRAPHITE_COLOR : JBColor.namedColor("Component.focusColor", JBColor.namedColor("Focus.borderColor", 0x8ab2eb));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color defaultButtonColor() {
|
||||
return UIUtil.isUnderDarcula() ? JBColor.namedColor("Button.default.focusColor",
|
||||
JBColor.namedColor("Focus.defaultButtonBorderColor", 0x97c3f3)) : focusColor();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color errorColor(boolean active) {
|
||||
return active ? JBColor.namedColor("Component.errorFocusColor", JBColor.namedColor("Focus.activeErrorBorderColor", 0xe53e4d)) :
|
||||
JBColor.namedColor("Component.inactiveErrorFocusColor", JBColor.namedColor("Focus.inactiveErrorBorderColor", 0xebbcbc));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color warningColor(boolean active) {
|
||||
return active ? JBColor.namedColor("Component.warningFocusColor", JBColor.namedColor("Focus.activeWarningBorderColor", 0xe2a53a)) :
|
||||
JBColor.namedColor("Component.inactiveWarningFocusColor", JBColor.namedColor("Focus.inactiveWarningBorderColor", 0xffd385));
|
||||
@@ -1764,30 +1777,37 @@ public class JBUI {
|
||||
}
|
||||
|
||||
public static class BigPopup {
|
||||
@NotNull
|
||||
public static Color headerBackground() {
|
||||
return JBColor.namedColor("SearchEverywhere.Header.background", 0xf2f2f2);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Insets tabInsets() {
|
||||
return insets(0, 12);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color selectedTabColor() {
|
||||
return JBColor.namedColor("SearchEverywhere.Tab.selectedBackground", 0xdedede);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color selectedTabTextColor() {
|
||||
return JBColor.namedColor("SearchEverywhere.Tab.selectedForeground", 0x000000);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color searchFieldBackground() {
|
||||
return JBColor.namedColor("SearchEverywhere.SearchField.background", 0xffffff);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color searchFieldBorderColor() {
|
||||
return JBColor.namedColor("SearchEverywhere.SearchField.borderColor", 0xbdbdbd);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Insets searchFieldInsets() {
|
||||
return insets(0, 6, 0, 5);
|
||||
}
|
||||
@@ -1796,26 +1816,32 @@ public class JBUI {
|
||||
return scale(600);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color listSeparatorColor() {
|
||||
return JBColor.namedColor("SearchEverywhere.List.separatorColor", Gray.xDC);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color listTitleLabelForeground() {
|
||||
return JBColor.namedColor("SearchEverywhere.List.separatorForeground", UIUtil.getLabelDisabledForeground());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color searchFieldGrayForeground() {
|
||||
return JBColor.namedColor("SearchEverywhere.SearchField.infoForeground", JBColor.GRAY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color advertiserForeground() {
|
||||
return JBColor.namedColor("SearchEverywhere.Advertiser.foreground", JBColor.GRAY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Border advertiserBorder() {
|
||||
return new JBEmptyBorder(insets("SearchEverywhere.Advertiser.foreground", insetsLeft(8)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color advertiserBackground() {
|
||||
return JBColor.namedColor("SearchEverywhere.Advertiser.background", 0xf2f2f2);
|
||||
}
|
||||
@@ -1824,55 +1850,66 @@ public class JBUI {
|
||||
public static class Advertiser {
|
||||
private static final JBInsets DEFAULT_AD_INSETS = insets(1, 5);
|
||||
|
||||
@NotNull
|
||||
public static Color foreground() {
|
||||
return JBColor.namedColor("Popup.Advertiser.foreground", UIUtil.getLabelForeground());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color background() {
|
||||
return JBColor.namedColor("Popup.Advertiser.background", UIUtil.getLabelBackground());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Border border() {
|
||||
return new JBEmptyBorder(insets("Popup.Advertiser.borderInsets", DEFAULT_AD_INSETS));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color borderColor() {
|
||||
return JBColor.namedColor("Popup.Advertiser.borderColor", Gray._135);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Validator {
|
||||
@NotNull
|
||||
public static Color errorBorderColor() {
|
||||
return JBColor.namedColor("ValidationTooltip.errorBorderColor", 0xE0A8A9);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color errorBackgroundColor() {
|
||||
return JBColor.namedColor("ValidationTooltip.errorBackground", JBColor.namedColor("ValidationTooltip.errorBackgroundColor", 0xF5E6E7));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color warningBorderColor() {
|
||||
return JBColor.namedColor("ValidationTooltip.warningBorderColor", 0xE0CEA8);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color warningBackgroundColor() {
|
||||
return JBColor.namedColor("ValidationTooltip.warningBackground", JBColor.namedColor("ValidationTooltip.warningBackgroundColor", 0xF5F0E6));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnregisteredNamedColor")
|
||||
public static class Link {
|
||||
@NotNull
|
||||
public static Color linkColor() {
|
||||
return JBColor.namedColor("Link.activeForeground", JBColor.namedColor("link.foreground", 0x589df6));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color linkHoverColor() {
|
||||
return JBColor.namedColor("Link.hoverForeground", JBColor.namedColor("link.hover.foreground", linkColor()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color linkPressedColor() {
|
||||
return JBColor.namedColor("Link.pressedForeground", JBColor.namedColor("link.pressed.foreground", new JBColor(0xf00000, 0xba6f25)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Color linkVisitedColor() {
|
||||
return JBColor.namedColor("Link.visitedForeground", JBColor.namedColor("link.visited.foreground", new JBColor(0x800080, 0x9776a9)));
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class MacUIUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Cursor getInvertedTextCursor() {
|
||||
if (INVERTED_TEXT_CURSOR == null) {
|
||||
final Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user