Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-05-17 11:30:50 +0000
committeratikhomirov2006-05-17 11:30:50 +0000
commit3f3066d599546ae2e7decc049b2bf38d176136f2 (patch)
tree03c0d1ab8cf21152e012197328a38330a86c6a27 /plugins/org.eclipse.gmf.graphdef.codegen/src
parent109e180532439ede4025a8db43843b2538e3a579 (diff)
downloadorg.eclipse.gmf-tooling-3f3066d599546ae2e7decc049b2bf38d176136f2.tar.gz
org.eclipse.gmf-tooling-3f3066d599546ae2e7decc049b2bf38d176136f2.tar.xz
org.eclipse.gmf-tooling-3f3066d599546ae2e7decc049b2bf38d176136f2.zip
[mgolubev] #140899 gmfgraph.BasicFont should have reasonable default values for faceName, style and height properties
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/src')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java
index c4d8140b6..45d63e1be 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java
@@ -167,6 +167,14 @@ if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())
} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Font())) {
// XXX possible CCE when fonts other than Basic added to model
BasicFont font = (BasicFont) figureInstance.getFont();
+ String fontName = font.getFaceName();
+ if (fontName == null || fontName.trim().length() == 0){
+ org.eclipse.swt.graphics.Font system = org.eclipse.swt.widgets.Display.getDefault().getSystemFont();
+ if (system != null && system.getFontData().length > 0){
+ fontName = system.getFontData()[0].getName();
+ }
+ }
+
stringBuffer.append(TEXT_37);
stringBuffer.append(figureVarName);
stringBuffer.append(TEXT_38);
@@ -174,7 +182,7 @@ if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())
stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Display"));
stringBuffer.append(TEXT_40);
- stringBuffer.append(font.getFaceName());
+ stringBuffer.append(fontName);
stringBuffer.append(TEXT_41);
stringBuffer.append(font.getHeight());
stringBuffer.append(TEXT_42);

Back to the top