diff options
author | Alexander Kurtakov | 2018-07-18 16:25:09 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-07-18 16:25:09 +0000 |
commit | 8ea2279da6b3c2dfdb97da2d4f4000a9d091704b (patch) | |
tree | 52ab53dd17d53a20c8741da535b34db0a1bae86d /org.eclipse.jface.text | |
parent | 8f5e34a7b9e0b614db5554cdc0d42a24e4cd9912 (diff) | |
download | eclipse.platform.text-8ea2279da6b3c2dfdb97da2d4f4000a9d091704b.tar.gz eclipse.platform.text-8ea2279da6b3c2dfdb97da2d4f4000a9d091704b.tar.xz eclipse.platform.text-8ea2279da6b3c2dfdb97da2d4f4000a9d091704b.zip |
More deprecated getAverageCharWidth fixes.
Change-Id: I5a696c6973a78339afaf0323fd081e2b370d0a52
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text')
7 files changed, 18 insertions, 18 deletions
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java index 09b1be4f9c8..c03add398b6 100644 --- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java +++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -111,12 +111,12 @@ public class ProjectionSupport { // height: height of the box int height= ascent + descent; - int width= metrics.getAverageCharWidth(); - gc.drawRectangle(p.x, p.y + leading, width, height); - int third= width/3; + double width= metrics.getAverageCharacterWidth(); + gc.drawRectangle(p.x, p.y + leading, (int) width, height); + int third= (int) (width / 3); int dotsVertical= p.y + baseline - 1; gc.drawPoint(p.x + third, dotsVertical); - gc.drawPoint(p.x + width - third, dotsVertical); + gc.drawPoint((int) (p.x + width - third), dotsVertical); gc.setForeground(c); diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java index 16a68b5f2da..e5d0d43dc4e 100644 --- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java +++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -409,10 +409,10 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio public Point computeSizeConstraints(int widthInChars, int heightInChars) { GC gc= new GC(fText); gc.setFont(fTextFont); - int width= gc.getFontMetrics().getAverageCharWidth(); + double width= gc.getFontMetrics().getAverageCharacterWidth(); int height= fText.getLineHeight(); gc.dispose(); - return new Point (widthInChars * width, heightInChars * height); + return new Point((int) (widthInChars * width), heightInChars * height); } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java index c4f1fa8d04d..3424601928d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java @@ -580,11 +580,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem GC gc= new GC(fBrowser); Font font= JFaceResources.getFont(fSymbolicFontName); gc.setFont(font); - int width= gc.getFontMetrics().getAverageCharWidth(); + double width= gc.getFontMetrics().getAverageCharacterWidth(); int height= gc.getFontMetrics().getHeight(); gc.dispose(); - return new Point(widthInChars * width, heightInChars * height); + return new Point((int) (widthInChars * width), heightInChars * height); } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java index da8180c7bf6..ae6fd65f18d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java @@ -761,11 +761,11 @@ public abstract class AbstractInformationControl implements IInformationControl, public Point computeSizeConstraints(int widthInChars, int heightInChars) { GC gc= new GC(fContentComposite); gc.setFont(JFaceResources.getDialogFont()); - int width= gc.getFontMetrics().getAverageCharWidth(); + double width= gc.getFontMetrics().getAverageCharacterWidth(); int height= gc.getFontMetrics().getHeight(); gc.dispose(); - return new Point(widthInChars * width, heightInChars * height); + return new Point((int) (widthInChars * width), heightInChars * height); } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java index 1cd8b988957..84d2788fa5d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java @@ -741,11 +741,11 @@ abstract public class AbstractInformationControlManager { GC gc= new GC(subjectControl); gc.setFont(subjectControl.getFont()); - int width= gc.getFontMetrics().getAverageCharWidth(); + double width= gc.getFontMetrics().getAverageCharacterWidth(); int height = gc.getFontMetrics().getHeight(); gc.dispose(); - fSizeConstraints= new Point (fWidthConstraint * width, fHeightConstraint * height); + fSizeConstraints= new Point((int) (fWidthConstraint * width), fHeightConstraint * height); } return new Point(fSizeConstraints.x, fSizeConstraints.y); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java index 32a65142980..ba13d54317a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java @@ -378,9 +378,9 @@ public final class JFaceTextUtil { public static int getAverageCharWidth(Control control) { GC gc= new GC(control); gc.setFont(control.getFont()); - int increment= gc.getFontMetrics().getAverageCharWidth(); + double increment= gc.getFontMetrics().getAverageCharacterWidth(); gc.dispose(); - return increment; + return (int) increment; } /** diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java index 5042dc883ed..46745bdeec9 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java @@ -1,5 +1,5 @@ /**
- * Copyright (c) 2017 Angelo ZERR.
+ * Copyright (c) 2017, 2018 Angelo ZERR.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -78,7 +78,7 @@ public class LineContentAnnotation extends AbstractInlinedAnnotation { protected int drawAndComputeWidth(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) {
// Draw the text annotation and returns the width
super.draw(gc, textWidget, offset, length, color, x, y);
- return gc.stringExtent(getText()).x + 2 * gc.getFontMetrics().getAverageCharWidth();
+ return (int) (gc.stringExtent(getText()).x + 2 * gc.getFontMetrics().getAverageCharacterWidth());
}
int getRedrawnCharacterWidth() {
|