Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbblajer2007-09-18 10:18:29 +0000
committerbblajer2007-09-18 10:18:29 +0000
commit2ede3c26513791dc63f0334f4327d6d576b1ff25 (patch)
tree115977bf62240e4e3ac6c02f0556d7634daea3cf /plugins/org.eclipse.gmf.runtime.lite/src/org
parentf57ca98b67c56259e20107f67114bb8235eef50f (diff)
downloadorg.eclipse.gmf-tooling-2ede3c26513791dc63f0334f4327d6d576b1ff25.tar.gz
org.eclipse.gmf-tooling-2ede3c26513791dc63f0334f4327d6d576b1ff25.tar.xz
org.eclipse.gmf-tooling-2ede3c26513791dc63f0334f4327d6d576b1ff25.zip
Font for inplace-edit should be reused from label font if zoom level is 100%
Diffstat (limited to 'plugins/org.eclipse.gmf.runtime.lite/src/org')
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/services/LabelCellEditorLocator.java30
1 files changed, 17 insertions, 13 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/services/LabelCellEditorLocator.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/services/LabelCellEditorLocator.java
index c89163a4a..9ec4ba79a 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/services/LabelCellEditorLocator.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/services/LabelCellEditorLocator.java
@@ -40,20 +40,24 @@ public class LabelCellEditorLocator implements CellEditorLocator {
public void relocate(CellEditor celleditor) {
Rectangle rect = getLabel().getTextBounds();
getLabel().translateToAbsolute(rect);
- ZoomManager zoomManager = getZoomManager();
- double zoomLevel = zoomManager == null ? 1.0 : zoomManager.getZoom();
- if (zoomLevel > 1.0 && getLabel().getFont() != null) {
- FontData[] datas = getLabel().getFont().getFontData();
- for(int i = 0; i < datas.length; i++) {
- datas[i].height *= zoomLevel;
- }
- final Font font = new Font(getLabel().getFont().getDevice(), datas);
- celleditor.getControl().setFont(font);
- celleditor.getControl().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- font.dispose();
+ if (getLabel().getFont() != null) {
+ ZoomManager zoomManager = getZoomManager();
+ double zoomLevel = zoomManager == null ? 1.0 : zoomManager.getZoom();
+ if (zoomLevel > 1.0) {
+ FontData[] datas = getLabel().getFont().getFontData();
+ for(int i = 0; i < datas.length; i++) {
+ datas[i].height *= zoomLevel;
}
- });
+ final Font font = new Font(getLabel().getFont().getDevice(), datas);
+ celleditor.getControl().setFont(font);
+ celleditor.getControl().addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ font.dispose();
+ }
+ });
+ } else {
+ celleditor.getControl().setFont(getLabel().getFont());
+ }
}
int avr = FigureUtilities.getFontMetrics(celleditor.getControl().getFont()).getAverageCharWidth();
rect.setSize(new Dimension(celleditor.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));

Back to the top