From cac2cf2996065f9da80f8a2271f89d4cca061b48 Mon Sep 17 00:00:00 2001 From: Boaz Berman Date: Tue, 29 Dec 2020 15:41:52 +0200 Subject: [PATCH 1/2] Fix user reported error --- .../tabnine/lifecycle/BinaryPromotionStatusBarLifecycle.kt | 5 +++-- .../java/com/tabnine/statusBar/StatusBarPromotionWidget.java | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/tabnine/lifecycle/BinaryPromotionStatusBarLifecycle.kt b/src/main/java/com/tabnine/lifecycle/BinaryPromotionStatusBarLifecycle.kt index 6eb5c989d..c0433bb87 100644 --- a/src/main/java/com/tabnine/lifecycle/BinaryPromotionStatusBarLifecycle.kt +++ b/src/main/java/com/tabnine/lifecycle/BinaryPromotionStatusBarLifecycle.kt @@ -40,8 +40,9 @@ class BinaryPromotionStatusBarLifecycle(private val binaryRequestFacade: BinaryR return null } - val statusBar = WindowManager.getInstance().getStatusBar(openProjects[0]) - val promotionWidget = statusBar.getWidget(StatusBarPromotionWidget::class.java.name) as StatusBarPromotionWidget + val statusBar = WindowManager.getInstance()?.getStatusBar(openProjects[0]) + val widget = statusBar?.getWidget(StatusBarPromotionWidget::class.java.name) ?: return null + val promotionWidget = widget as StatusBarPromotionWidget return promotionWidget.component as StatusBarPromotionWidget.StatusBarPromotionComponent } diff --git a/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java b/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java index 119ed9ac6..bbac15fb3 100644 --- a/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java +++ b/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java @@ -41,6 +41,7 @@ public String ID() { } // Compatability implementation. DO NOT ADD @Override. + @NotNull public JComponent getComponent() { if (component != null) { return component; From ff878e9ff0728a111bc1ede54d348dc2258536b9 Mon Sep 17 00:00:00 2001 From: Boaz Berman Date: Tue, 29 Dec 2020 15:45:04 +0200 Subject: [PATCH 2/2] Update StatusBarPromotionWidget.java --- .../java/com/tabnine/statusBar/StatusBarPromotionWidget.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java b/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java index bbac15fb3..5e5d353f8 100644 --- a/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java +++ b/src/main/java/com/tabnine/statusBar/StatusBarPromotionWidget.java @@ -20,8 +20,8 @@ import java.util.Objects; import java.util.List; -import static com.tabnine.general.StaticConfig.*; -import static java.awt.Color.decode; +import static com.tabnine.general.StaticConfig.PROMOTION_LIGHT_TEXT_COLOR; +import static com.tabnine.general.StaticConfig.PROMOTION_TEXT_COLOR; public class StatusBarPromotionWidget extends EditorBasedWidget implements CustomStatusBarWidget, StatusBarWidget.WidgetPresentation { private final BinaryRequestFacade binaryRequestFacade;