diff --git a/org.eclipse.wb.swing.FormLayout/META-INF/MANIFEST.MF b/org.eclipse.wb.swing.FormLayout/META-INF/MANIFEST.MF
index 378d49e6f..aaba4a399 100644
--- a/org.eclipse.wb.swing.FormLayout/META-INF/MANIFEST.MF
+++ b/org.eclipse.wb.swing.FormLayout/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wb.swing.FormLayout;singleton:=true
-Bundle-Version: 1.13.0.qualifier
+Bundle-Version: 1.13.100.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.wb.internal.swing.FormLayout.Activator
Bundle-Vendor: %providerName
diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/DimensionSelectionEditPolicy.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/DimensionSelectionEditPolicy.java
index d6c1cea09..48de8341d 100644
--- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/DimensionSelectionEditPolicy.java
+++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/DimensionSelectionEditPolicy.java
@@ -185,9 +185,9 @@ public void showSourceFeedback(Request request) {
}
// set feedback bounds
{
- Point mouseLocation = changeBoundsRequest.getLocation().getCopy();
+ Point mouseLocation = changeBoundsRequest.getRelativeLocation().getCopy();
Point feedbackLocation = getTextFeedbackLocation(mouseLocation);
- FigureUtils.translateAbsoluteToFigure(feedbackLayer, feedbackLocation);
+ feedbackLayer.translateToRelative(feedbackLocation);
m_feedback.setLocation(feedbackLocation);
}
// set text
diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ResizeHintFigure.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ResizeHintFigure.java
index fcde0d8da..ff96892b1 100644
--- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ResizeHintFigure.java
+++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ResizeHintFigure.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2025 Google, Inc. and others.
+ * Copyright (c) 2011, 2026 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
@@ -12,18 +12,18 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.FormLayout.gef.header.selection;
-import org.eclipse.wb.draw2d.Figure;
-import org.eclipse.wb.draw2d.FigureUtils;
-import org.eclipse.wb.draw2d.border.CompoundBorder;
-import org.eclipse.wb.draw2d.border.LineBorder;
-import org.eclipse.wb.draw2d.border.MarginBorder;
import org.eclipse.wb.internal.core.utils.ui.DrawUtils;
import org.eclipse.wb.internal.swing.FormLayout.gef.GefMessages;
import org.eclipse.wb.internal.swing.FormLayout.model.FormLayoutInfo;
import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.CompoundBorder;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureUtilities;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.swt.graphics.Font;
@@ -50,8 +50,7 @@ public ResizeHintFigure() {
setOpaque(true);
setBackgroundColor(ColorConstants.tooltipBackground);
setForegroundColor(ColorConstants.tooltipForeground);
- setBorder(new CompoundBorder(new LineBorder(ColorConstants.tooltipForeground),
- new MarginBorder(2)));
+ setBorder(new CompoundBorder(new LineBorder(ColorConstants.tooltipForeground), new MarginBorder(2)));
}
////////////////////////////////////////////////////////////////////////////
@@ -93,28 +92,23 @@ public void setShowSizeHint(boolean showSizeHint) {
*/
@Override
public Dimension getPreferredSize(int wHint, int hHint) {
- Font font = getFont();
int width = 0;
int height = 0;
// text
{
- Dimension size = FigureUtils.calculateTextSize(m_text, font);
+ Dimension size = FigureUtilities.getTextExtents(m_text, getFont());
width = Math.max(width, size.width);
height += size.height;
}
// hint
if (m_showSizeHint) {
int hintWidth = 0;
- Font boldFont = DrawUtils.getBoldFont(font);
+ Font boldFont = DrawUtils.getBoldFont(getFont());
try {
- hintWidth +=
- FigureUtils.calculateTextSize(GefMessages.ResizeHintFigure_hint, boldFont).width;
- hintWidth += FigureUtils.calculateTextSize(GefMessages.ResizeHintFigure_press, font).width;
- hintWidth += FigureUtils.calculateTextSize("Ctrl", boldFont).width;
- hintWidth +=
- FigureUtils.calculateTextSize(
- MessageFormat.format(GefMessages.ResizeHintFigure_toSetSize, m_sizeHint),
- font).width;
+ hintWidth += FigureUtilities.getTextExtents(GefMessages.ResizeHintFigure_hint, boldFont).width;
+ hintWidth += FigureUtilities.getTextExtents(GefMessages.ResizeHintFigure_press, getFont()).width;
+ hintWidth += FigureUtilities.getTextExtents("Ctrl", boldFont).width;
+ hintWidth += FigureUtilities.getTextExtents(MessageFormat.format(GefMessages.ResizeHintFigure_toSetSize, m_sizeHint), getFont()).width;
} finally {
boldFont.dispose();
}
@@ -141,31 +135,25 @@ private void update() {
//
////////////////////////////////////////////////////////////////////////////
@Override
- protected void paintClientArea(Graphics graphics) {
+ protected void paintFigure(Graphics graphics) {
+ super.paintFigure(graphics);
+ graphics.translate(getLocation().x + getInsets().left, getLocation().y + getInsets().top);
graphics.drawText(m_text, 0, 0);
// draw hint
if (m_showSizeHint) {
int y = getClientArea().height / 2;
- //
- Font font = getFont();
- Font boldFont = DrawUtils.getBoldFont(font);
+ Font boldFont = DrawUtils.getBoldFont(getFont());
try {
int x = 0;
x = drawText(graphics, x, y + 1, GefMessages.ResizeHintFigure_hint, boldFont);
- x = drawText(graphics, x, y, GefMessages.ResizeHintFigure_press, font);
+ x = drawText(graphics, x, y, GefMessages.ResizeHintFigure_press, getFont());
//
graphics.pushState();
graphics.setForegroundColor(ColorConstants.lightBlue);
x = drawText(graphics, x, y + 1, "Ctrl", boldFont);
graphics.popState();
//
- x =
- drawText(
- graphics,
- x,
- y,
- MessageFormat.format(GefMessages.ResizeHintFigure_toSetSize, m_sizeHint),
- font);
+ x = drawText(graphics, x, y, MessageFormat.format(GefMessages.ResizeHintFigure_toSetSize, m_sizeHint), getFont());
} finally {
boldFont.dispose();
}
@@ -177,9 +165,9 @@ protected void paintClientArea(Graphics graphics) {
*
* @return the new x.
*/
- private int drawText(Graphics graphics, int x, int y, String text, Font font) {
+ private static int drawText(Graphics graphics, int x, int y, String text, Font font) {
graphics.setFont(font);
graphics.drawText(text, x, y);
- return x + FigureUtils.calculateTextSize(text, font).width;
+ return x + FigureUtilities.getTextExtents(text, font).width;
}
}
diff --git a/org.eclipse.wb.swing.MigLayout/META-INF/MANIFEST.MF b/org.eclipse.wb.swing.MigLayout/META-INF/MANIFEST.MF
index 32dd4d1d5..a69feb3aa 100644
--- a/org.eclipse.wb.swing.MigLayout/META-INF/MANIFEST.MF
+++ b/org.eclipse.wb.swing.MigLayout/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wb.swing.MigLayout;singleton:=true
-Bundle-Version: 1.12.0.qualifier
+Bundle-Version: 1.12.100.qualifier
Bundle-Activator: org.eclipse.wb.internal.swing.MigLayout.Activator
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-21
diff --git a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/DimensionSelectionEditPolicy.java b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/DimensionSelectionEditPolicy.java
index d873de014..8f6c95009 100644
--- a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/DimensionSelectionEditPolicy.java
+++ b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/DimensionSelectionEditPolicy.java
@@ -192,9 +192,9 @@ public void showSourceFeedback(Request request) {
}
// set feedback bounds
{
- Point mouseLocation = changeBoundsRequest.getLocation().getCopy();
+ Point mouseLocation = changeBoundsRequest.getRelativeLocation().getCopy();
Point feedbackLocation = getTextFeedbackLocation(mouseLocation);
- FigureUtils.translateAbsoluteToFigure(feedbackLayer, feedbackLocation);
+ feedbackLayer.translateToRelative(feedbackLocation);
m_feedback.setLocation(feedbackLocation);
}
// set text
diff --git a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ResizeHintFigure.java b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ResizeHintFigure.java
index 006bac74f..ea9f84a53 100644
--- a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ResizeHintFigure.java
+++ b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ResizeHintFigure.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2025 Google, Inc. and others.
+ * Copyright (c) 2011, 2026 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
@@ -12,21 +12,22 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.MigLayout.gef.header.selection;
-import org.eclipse.wb.draw2d.Figure;
-import org.eclipse.wb.draw2d.FigureUtils;
-import org.eclipse.wb.draw2d.border.CompoundBorder;
-import org.eclipse.wb.draw2d.border.LineBorder;
-import org.eclipse.wb.draw2d.border.MarginBorder;
import org.eclipse.wb.internal.core.utils.ui.DrawUtils;
import org.eclipse.wb.internal.swing.MigLayout.gef.GefMessages;
import org.eclipse.wb.internal.swing.MigLayout.model.MigLayoutInfo;
import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.CompoundBorder;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureUtilities;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.SWTGraphics;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Shell;
@@ -49,8 +50,7 @@ public ResizeHintFigure() {
setOpaque(true);
setBackgroundColor(ColorConstants.tooltipBackground);
setForegroundColor(ColorConstants.tooltipForeground);
- setBorder(new CompoundBorder(new LineBorder(ColorConstants.tooltipForeground),
- new MarginBorder(5)));
+ setBorder(new CompoundBorder(new LineBorder(ColorConstants.tooltipForeground), new MarginBorder(5)));
}
////////////////////////////////////////////////////////////////////////////
@@ -108,49 +108,39 @@ enum SizeElement {
}
/**
- * @return the new {@link SizeElement} to change, if given char if size element selection. May be
- * null, if given character does not correspond any size element.
+ * @return the new {@link SizeElement} to change, if given char if size element
+ * selection. May be null, if given character does not
+ * correspond any size element.
*/
static SizeElement getNewSizeElement(char c) {
- c = Character.toUpperCase(c);
- if (c == 'N') {
- return SizeElement.MIN;
- } else if (c == 'P') {
- return SizeElement.PREF;
- } else if (c == 'X') {
- return SizeElement.MAX;
- }
+ return switch (Character.toUpperCase(c)) {
+ case 'N' -> SizeElement.MIN;
+ case 'P' -> SizeElement.PREF;
+ case 'X' -> SizeElement.MAX;
// no change
- return null;
+ default -> null;
+ };
}
/**
- * @return the new size unit, if given char if size unit selection. May be null, if
- * given character does not correspond any size unit.
+ * @return the new size unit, if given char if size unit selection. May be
+ * null, if given character does not correspond any size
+ * unit.
*/
static String getNewSizeUnit(char c) {
- c = Character.toUpperCase(c);
- if (c == '0') {
- return "";
- } else if (c == '1') {
- return "px";
- } else if (c == '2') {
- return "%";
- } else if (c == '3') {
- return "lp";
- } else if (c == '4') {
- return "pt";
- } else if (c == '5') {
- return "mm";
- } else if (c == '6') {
- return "cm";
- } else if (c == '7') {
- return "in";
- } else if (c == '8') {
- return "sp";
- }
+ return switch (Character.toUpperCase(c)) {
+ case '0' -> "";
+ case '1' -> "px";
+ case '2' -> "%";
+ case '3' -> "lp";
+ case '4' -> "pt";
+ case '5' -> "mm";
+ case '6' -> "cm";
+ case '7' -> "in";
+ case '8' -> "sp";
// no change
- return null;
+ default -> null;
+ };
}
////////////////////////////////////////////////////////////////////////////
@@ -159,16 +149,22 @@ static String getNewSizeUnit(char c) {
//
////////////////////////////////////////////////////////////////////////////
@Override
- protected void paintClientArea(Graphics graphics) {
+ protected void paintFigure(Graphics graphics) {
+ super.paintFigure(graphics);
+ graphics.translate(getLocation().x + getInsets().left, getLocation().y + getInsets().top);
doPaint(graphics);
}
+ @Override
+ public void setLocation(Point p) {
+ super.setLocation(p);
+ }
+
private Dimension doPaint(Graphics graphics) {
- Font font = getFont();
- Font boldFont = DrawUtils.getBoldFont(font);
+ Font boldFont = DrawUtils.getBoldFont(getFont());
// use fonts
try {
- int y = drawText(graphics, m_text, 0, 0, font).height;
+ int y = drawText(graphics, m_text, 0, 0, getFont()).height;
// Note
{
int x = 0;
@@ -177,7 +173,7 @@ private Dimension doPaint(Graphics graphics) {
size = drawText(graphics, GefMessages.ResizeHintFigure_note, x, y + 1, boldFont);
x += size.width;
//
- size = drawText(graphics, GefMessages.ResizeHintFigure_keyHint, x, y, font);
+ size = drawText(graphics, GefMessages.ResizeHintFigure_keyHint, x, y, getFont());
x += size.width;
y += size.height;
}
@@ -185,39 +181,22 @@ private Dimension doPaint(Graphics graphics) {
{
int x = 10;
Dimension size;
- size =
- drawHintColumn(
- graphics,
- x,
- y,
- boldFont,
- font,
- new String[]{"N", "P", "X"},
- new String[]{
- GefMessages.ResizeHintFigure_minimumSize,
- GefMessages.ResizeHintFigure_preferredSize,
- GefMessages.ResizeHintFigure_maximumSize});
+ size = drawHintColumn(graphics, x, y, boldFont, getFont(), new String[] { "N", "P", "X" },
+ new String[] { GefMessages.ResizeHintFigure_minimumSize, //
+ GefMessages.ResizeHintFigure_preferredSize, //
+ GefMessages.ResizeHintFigure_maximumSize });
x += size.width + 10;
- size =
- drawHintColumn(graphics, x, y, boldFont, font, new String[]{
- "0",
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",}, new String[]{
- GefMessages.ResizeHintFigure_unit_default,
- GefMessages.ResizeHintFigure_unit_pixels,
- GefMessages.ResizeHintFigure_unit_percents,
- GefMessages.ResizeHintFigure_unit_logicalPixels,
- GefMessages.ResizeHintFigure_unit_points,
- GefMessages.ResizeHintFigure_unit_millimeters,
- GefMessages.ResizeHintFigure_unit_centimeters,
- GefMessages.ResizeHintFigure_unit_inches,
- GefMessages.ResizeHintFigure_unit_screenPercents});
+ size = drawHintColumn(graphics, x, y, boldFont, getFont(),
+ new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", },
+ new String[] { GefMessages.ResizeHintFigure_unit_default, //
+ GefMessages.ResizeHintFigure_unit_pixels, //
+ GefMessages.ResizeHintFigure_unit_percents, //
+ GefMessages.ResizeHintFigure_unit_logicalPixels, //
+ GefMessages.ResizeHintFigure_unit_points, //
+ GefMessages.ResizeHintFigure_unit_millimeters, //
+ GefMessages.ResizeHintFigure_unit_centimeters, //
+ GefMessages.ResizeHintFigure_unit_inches, //
+ GefMessages.ResizeHintFigure_unit_screenPercents });
return new Dimension(x + size.width, y + size.height);
}
} finally {
@@ -233,16 +212,10 @@ private Dimension doPaint(Graphics graphics) {
private static Dimension drawText(Graphics graphics, String text, int x, int y, Font font) {
graphics.setFont(font);
graphics.drawText(text, x, y);
- return FigureUtils.calculateTextSize(text, font);
+ return FigureUtilities.getTextExtents(text, font);
}
- private static Dimension drawHintColumn(Graphics graphics,
- int x_,
- int y_,
- Font keyFont,
- Font textFont,
- String[] keyArray,
- String[] textArray) {
+ private static Dimension drawHintColumn(Graphics graphics, int x_, int y_, Font keyFont, Font textFont, String[] keyArray, String[] textArray) {
int lineWidth = 0;
int lineHeight = 0;
//
@@ -252,7 +225,7 @@ private static Dimension drawHintColumn(Graphics graphics,
int keyWidth = 0;
{
for (String key : keyArray) {
- Dimension size = FigureUtils.calculateTextSize(key, keyFont);
+ Dimension size = FigureUtilities.getTextExtents(key, keyFont);
keyWidth = Math.max(keyWidth, size.width);
lineHeight = size.height;
}