From f272b16a03019a51479b3c6fe0d6d5e57165e1e6 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 24 Jan 2020 00:23:59 +0200 Subject: [PATCH] Bug 559514 - Cleanup codebase Move away of deprecated FontMetrics.getAverageCharWidth. The new method is getAverageCharacterWidth returning double. Change-Id: Ic9c60073bb0c1219c4ef422e933de0576556e88c Signed-off-by: Alexander Kurtakov --- .../remote/internal/jsch/ui/wizards/JSchConnectionPage.java | 2 +- .../remote/internal/proxy/ui/wizards/ProxyConnectionPage.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java b/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java index a9874cbd570..594c7de126b 100755 --- a/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java +++ b/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards/JSchConnectionPage.java @@ -497,7 +497,7 @@ public class JSchConnectionPage extends WizardPage { if (data instanceof GridData) { GC gc = new GC(text); FontMetrics fm = gc.getFontMetrics(); - int width = chars * fm.getAverageCharWidth(); + int width = (int) (chars * fm.getAverageCharacterWidth()); gc.dispose(); ((GridData) data).widthHint = width; } diff --git a/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java b/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java index a367993df95..7ad67bc0c42 100755 --- a/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java +++ b/bundles/org.eclipse.remote.proxy.ui/src/org/eclipse/remote/internal/proxy/ui/wizards/ProxyConnectionPage.java @@ -420,7 +420,7 @@ public class ProxyConnectionPage extends WizardPage { if (data instanceof GridData) { GC gc = new GC(text); FontMetrics fm = gc.getFontMetrics(); - int width = chars * fm.getAverageCharWidth(); + int width = (int) (chars * fm.getAverageCharacterWidth()); gc.dispose(); ((GridData) data).widthHint = width; }