/**
   * initialize the background for a graphical element
   *
   * @param view the element to initialize
   * @param store the preference store
   * @param elementName the name to the element
   */
  public static void initBackgroundFromPrefs(
      View view, final IPreferenceStore store, String elementName) {
    if (!usePreferenceInitializer(view)) {
      return;
    }

    String fillColorConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_FILL);
    String gradientColorConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_GRADIENT);
    String gradientPolicyConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.GRADIENT_POLICY);
    String shadowConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.SHADOW);
    String elementIcon = getpreferenceKey(view, elementName, PreferenceConstantHelper.ELEMENTICON);
    String qualifiedName =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.QUALIFIEDNAME);

    org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant);
    ViewUtil.setStructuralFeatureValue(
        view,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));

    FillStyle fillStyle = (FillStyle) view.getStyle(NotationPackage.Literals.FILL_STYLE);
    fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());

    if (store.getBoolean(gradientPolicyConstant)) {
      GradientPreferenceConverter gradientPreferenceConverter =
          new GradientPreferenceConverter(store.getString(gradientColorConstant));
      fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
      fillStyle.setTransparency(gradientPreferenceConverter.getTransparency());
    }

    EditingDomain domain = EMFHelper.resolveEditingDomain(view);
    if (domain instanceof TransactionalEditingDomain) {
      TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) domain;
      // shadow
      RecordingCommand shadowcommand =
          AnnotationStyleProvider.getSetShadowCommand(
              editingDomain, view, store.getBoolean(shadowConstant));
      if (shadowcommand.canExecute()) {
        shadowcommand.execute();
      }
      // icon label
      RecordingCommand namelabelIconCommand =
          AnnotationStyleProvider.getSetElementIconCommand(
              editingDomain, view, store.getBoolean(elementIcon));
      if (namelabelIconCommand.canExecute()) {
        namelabelIconCommand.execute();
      }
      // qualified name
      if (!store.getBoolean(qualifiedName)) {
        RecordingCommand qualifiedNameCommand =
            AnnotationStyleProvider.getSetQualifiedNameDepthCommand(editingDomain, view, 1000);
        if (qualifiedNameCommand.canExecute()) {
          qualifiedNameCommand.execute();
        }
      }
    }
  }