X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.model%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fmodel%2Flabeldecorators%2FConstantLabelDecorationRule.java;h=2df8e52ee93ca8e98b1b85e9ba5655e0e6c57197;hp=494c0a8198b88685025e84c7e2abd4829e91d94f;hb=ed9dab5ea6ac1708c65865c7f589a75b7d8e71a4;hpb=378e6081c6ce13fededdbeefbd66c77435e7ff6f diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labeldecorators/ConstantLabelDecorationRule.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labeldecorators/ConstantLabelDecorationRule.java index 494c0a819..2df8e52ee 100644 --- a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labeldecorators/ConstantLabelDecorationRule.java +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labeldecorators/ConstantLabelDecorationRule.java @@ -13,9 +13,8 @@ package org.simantics.browsing.ui.model.labeldecorators; import org.eclipse.jface.resource.ColorDescriptor; import org.eclipse.jface.resource.FontDescriptor; -import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.RGB; import org.simantics.browsing.ui.content.LabelDecorator; import org.simantics.databoard.Bindings; @@ -30,6 +29,11 @@ import org.simantics.viewpoint.ontology.ViewpointResource; */ public class ConstantLabelDecorationRule extends AbstractLabelDecorator implements LabelDecorationRule { + /** + * For headless instances where no Display is available + */ + private static final FontDescriptor DEFAULT_FONT_DESCRIPTOR = FontDescriptor.createFrom(new FontData("Arial", 11, 0)); + String prefix; String postfix; ColorDescriptor foregroundColor; @@ -135,7 +139,8 @@ public class ConstantLabelDecorationRule extends AbstractLabelDecorator implemen return font; else { FontDescriptor desc = (FontDescriptor)font; - if(desc == null) desc = FontDescriptor.createFrom(JFaceResources.getDialogFont().getFontData()); + if(desc == null) + desc = DEFAULT_FONT_DESCRIPTOR; return (Font)desc.withStyle(style); } }