<commit_before>package info.limpet.stackedcharts.ui.editor.figures;

import org.eclipse.draw2d.ActionListener;
import org.eclipse.draw2d.Button;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;

import info.limpet.stackedcharts.ui.editor.Activator;
import info.limpet.stackedcharts.ui.editor.StackedchartsImages;

public class ChartsetFigure extends DirectionalShape
{
  private static volatile Font boldFont;
  private DirectionalLabel chartsetHeader;

  public ChartsetFigure(ActionListener addChartHandler)
  {
    add(new Label(StackedchartsImages.getImage(
        StackedchartsImages.DESC_CHARTSET)));
    chartsetHeader = new DirectionalLabel(Activator.FONT_12);
    chartsetHeader.setText("Chart Set");
    chartsetHeader.setTextAlignment(PositionConstants.TOP);
    add(chartsetHeader);

    Button button = new Button(StackedchartsImages.getImage(
        StackedchartsImages.DESC_ADD));
    button.setToolTip(new Label("Add new chart"));
    button.addActionListener(addChartHandler);
    add(button);

  }

  public void setVertical(boolean vertical)
  {
    super.setVertical(vertical);
    chartsetHeader.setVertical(vertical);
  }
  
  @Override
  public void paint(Graphics graphics)
  {

    if (boldFont == null)
    {
      FontData fontData = Display.getDefault().getActiveShell().getFont()
          .getFontData()[0];
      boldFont = new Font(Display.getDefault(), new FontData(fontData.getName(),
          fontData.getHeight(), SWT.BOLD));
      chartsetHeader.setFont(boldFont);
    }

    super.paint(graphics);
  }

}<commit_msg>better initialization of the bold font, issue #395<commit_after>package info.limpet.stackedcharts.ui.editor.figures;

import org.eclipse.draw2d.ActionListener;
import org.eclipse.draw2d.Button;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;

import info.limpet.stackedcharts.ui.editor.Activator;
import info.limpet.stackedcharts.ui.editor.StackedchartsImages;

public class ChartsetFigure extends DirectionalShape
{
  private static volatile Font boldFont;
  private DirectionalLabel chartsetHeader;

  public ChartsetFigure(ActionListener addChartHandler)
  {
    add(new Label(StackedchartsImages.getImage(
        StackedchartsImages.DESC_CHARTSET)));
    chartsetHeader = new DirectionalLabel(Activator.FONT_12);
    chartsetHeader.setText("Chart Set");
    chartsetHeader.setTextAlignment(PositionConstants.TOP);
    add(chartsetHeader);

    Button button = new Button(StackedchartsImages.getImage(
        StackedchartsImages.DESC_ADD));
    button.setToolTip(new Label("Add new chart"));
    button.addActionListener(addChartHandler);
    add(button);

  }

  public void setVertical(boolean vertical)
  {
    super.setVertical(vertical);
    chartsetHeader.setVertical(vertical);
  }
  
  @Override
  public void paint(Graphics graphics)
  {

    if (boldFont == null)
    {
      FontData fontData = Display.getDefault().getActiveShell().getFont()
          .getFontData()[0];
      boldFont = new Font(Display.getDefault(), new FontData(fontData.getName(),
          fontData.getHeight(), SWT.BOLD));
    }
    chartsetHeader.setFont(boldFont);

    super.paint(graphics);
  }

}
{'fraction_non_alphanumeric': 0.10405594405594405, 'fraction_numerical': 0.005314685314685315, 'mean_word_length': 4.535603715170279, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '22801', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1064, 'n_words': 183}