/** @generated */
  public Node createPersistentTable_2003(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Node node = NotationFactory.eINSTANCE.createNode();
    node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
    node.getStyles().add(NotationFactory.eINSTANCE.createLineStyle());
    node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());

    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(SqlmodelVisualIDRegistry.getType(PersistentTable2EditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    org.eclipse.swt.graphics.RGB fillRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));
    return node;
  }
  /** @generated */
  public Edge createAssociation_4001(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(
        edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
            .NECSIS14_ClassDiagramVisualIDRegistry.getType(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                .AssociationEditPart.VISUAL_ID));
    edge.setElement(domainElement);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        edge,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      edgeFontStyle.setFontName(fontData.getName());
      edgeFontStyle.setFontHeight(fontData.getHeight());
      edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
      ViewUtil.setStructuralFeatureValue(
          edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    Node label6001 =
        createLabel(
            edge,
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                .NECSIS14_ClassDiagramVisualIDRegistry.getType(
                edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                    .AssociationNameEditPart.VISUAL_ID));
    label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6001 = (Location) label6001.getLayoutConstraint();
    location6001.setX(0);
    location6001.setY(40);
    return edge;
  }
  /** @generated */
  public Node createAttribute_3001(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Shape node = NotationFactory.eINSTANCE.createShape();
    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(
        edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
            .NECSIS14_ClassDiagramVisualIDRegistry.getType(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.AttributeEditPart
                .VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (nodeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      nodeFontStyle.setFontName(fontData.getName());
      nodeFontStyle.setFontHeight(fontData.getHeight());
      nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    org.eclipse.swt.graphics.RGB fillRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));
    Node label5001 =
        createLabel(
            node,
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                .NECSIS14_ClassDiagramVisualIDRegistry.getType(
                edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                    .AttributeNameEditPart.VISUAL_ID));
    return node;
  }
Пример #4
0
  private TextAttribute tokenAttribute(
      IPreferenceStore store,
      String colorPrefs,
      String boldPrefs,
      String italicPrefs,
      String underlinePrefs) {

    int style = SWT.NORMAL;

    boolean isBold = store.getBoolean(boldPrefs);
    if (isBold) {
      style = style | SWT.BOLD;
    }

    boolean isItalic = store.getBoolean(italicPrefs);
    if (isItalic) {
      style = style | SWT.ITALIC;
    }

    boolean isUnderline = store.getBoolean(underlinePrefs);
    if (isUnderline) {
      style = style | TextAttribute.UNDERLINE;
    }

    RGB color = PreferenceConverter.getColor(store, colorPrefs);
    TextAttribute attr = new TextAttribute(colorManager.getColor(color), null, style);
    return attr;
  }
  /**
   * Installs the given color in the preference store and optionally the color registry.
   *
   * @param definition the color definition
   * @param theme the theme defining the color
   * @param store the preference store from which to set and obtain color data
   * @param setInRegistry whether the color should be put into the registry
   */
  private static void installColor(
      ColorDefinition definition, ITheme theme, IPreferenceStore store, boolean setInRegistry) {

    // TODO: store shouldn't be null, should assert instead of checking null all over

    ColorRegistry registry = theme.getColorRegistry();

    String id = definition.getId();
    String key = createPreferenceKey(theme, id);
    RGB prefColor = store != null ? PreferenceConverter.getColor(store, key) : null;
    RGB defaultColor =
        (definition.getValue() != null)
            ? definition.getValue()
            : registry.getRGB(definition.getDefaultsTo());

    if (prefColor == null || prefColor == PreferenceConverter.COLOR_DEFAULT_DEFAULT) {
      prefColor = defaultColor;
    }

    // if the preference value isn't the default then retain that pref value
    RGB colorToUse = !store.isDefault(key) ? prefColor : defaultColor;

    if (setInRegistry) {
      registry.put(id, colorToUse);
    }

    if (store != null) {
      PreferenceConverter.setDefault(store, key, defaultColor);
    }
  }
  /**
   * 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();
        }
      }
    }
  }
 /** @generated */
 public Edge createViewTableViewedTables_3002(
     View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
   Edge edge = NotationFactory.eINSTANCE.createEdge();
   edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle());
   edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
   RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
   ArrayList points = new ArrayList(2);
   points.add(new RelativeBendpoint());
   points.add(new RelativeBendpoint());
   bendpoints.setPoints(points);
   edge.setBendpoints(bendpoints);
   ViewUtil.insertChildView(containerView, edge, index, persisted);
   edge.setType(SqlmodelVisualIDRegistry.getType(ViewTableViewedTables2EditPart.VISUAL_ID));
   edge.setElement(null);
   // initializePreferences
   final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
   FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
   if (edgeFontStyle != null) {
     FontData fontData =
         PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
     edgeFontStyle.setFontName(fontData.getName());
     edgeFontStyle.setFontHeight(fontData.getHeight());
     edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
     edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
     org.eclipse.swt.graphics.RGB fontRGB =
         PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
     edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
   }
   Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
   if (routing != null) {
     ViewUtil.setStructuralFeatureValue(
         edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
   }
   return edge;
 }
  /** Initialize semantic highlightings. */
  private void initializeHighlightings() {
    fSemanticHighlightings = SemanticHighlightings.getSemanticHighlightings();
    fHighlightings = new Highlighting[fSemanticHighlightings.length];

    for (int i = 0, n = fSemanticHighlightings.length; i < n; i++) {
      SemanticHighlighting semanticHighlighting = fSemanticHighlightings[i];
      String colorKey = SemanticHighlightings.getColorPreferenceKey(semanticHighlighting);
      addColor(colorKey);

      String boldKey = SemanticHighlightings.getBoldPreferenceKey(semanticHighlighting);
      int style = fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;

      String italicKey = SemanticHighlightings.getItalicPreferenceKey(semanticHighlighting);
      if (fPreferenceStore.getBoolean(italicKey)) style |= SWT.ITALIC;

      String strikethroughKey =
          SemanticHighlightings.getStrikethroughPreferenceKey(semanticHighlighting);
      if (fPreferenceStore.getBoolean(strikethroughKey)) style |= TextAttribute.STRIKETHROUGH;

      String underlineKey = SemanticHighlightings.getUnderlinePreferenceKey(semanticHighlighting);
      if (fPreferenceStore.getBoolean(underlineKey)) style |= TextAttribute.UNDERLINE;

      boolean isEnabled =
          fPreferenceStore.getBoolean(
              SemanticHighlightings.getEnabledPreferenceKey(semanticHighlighting));

      fHighlightings[i] =
          new Highlighting(
              new TextAttribute(
                  fColorManager.getColor(PreferenceConverter.getColor(fPreferenceStore, colorKey)),
                  null,
                  style),
              isEnabled);
    }
  }
Пример #9
0
  protected void initializeFields() {
    Iterator<Object> e = fColorButtons.keySet().iterator();
    while (e.hasNext()) {
      ColorSelector c = (ColorSelector) e.next();
      String key = fColorButtons.get(c);
      RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
      c.setColorValue(rgb);
    }

    e = fCheckBoxes.keySet().iterator();
    while (e.hasNext()) {
      Button b = (Button) e.next();
      String key = fCheckBoxes.get(b);
      b.setSelection(fOverlayStore.getBoolean(key));
    }

    e = fTextFields.keySet().iterator();
    while (e.hasNext()) {
      Text t = (Text) e.next();
      String key = fTextFields.get(t);
      t.setText(fOverlayStore.getString(key));
    }

    e = fComboBoxes.keySet().iterator();
    while (e.hasNext()) {
      Combo c = (Combo) e.next();
      String key = fComboBoxes.get(c);
      String state = fOverlayStore.getString(key);
      // Interpret the state string as a Combo state description
      ProposalFilterPreferencesUtil.restoreComboFromString(c, state);
    }
  }
Пример #10
0
  /**
   * Creates the highlighting manager class.
   *
   * @param textResource the text resource to be provided to other classes
   * @param sourceviewer the source viewer converts offset between master and slave documents
   * @param colorManager the color manager provides highlighting colors
   * @param editor
   */
  public BentoHighlighting(
      bento.language.bentocomp.resource.bento.IBentoTextResource textResource,
      org.eclipse.jface.text.source.projection.ProjectionViewer sourceviewer,
      bento.language.bentocomp.resource.bento.ui.BentoColorManager colorManager,
      bento.language.bentocomp.resource.bento.ui.BentoEditor editor) {
    this.display = org.eclipse.swt.widgets.Display.getCurrent();
    sourceviewer.getSelectionProvider();
    preferenceStore =
        bento.language.bentocomp.resource.bento.ui.BentoUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    textWidget = sourceviewer.getTextWidget();
    projectionViewer = sourceviewer;
    scanner =
        new bento.language.bentocomp.resource.bento.ui.BentoTokenScanner(
            textResource, colorManager);
    occurrence =
        new bento.language.bentocomp.resource.bento.ui.BentoOccurrence(
            textResource, sourceviewer, scanner);
    bracketSet =
        new bento.language.bentocomp.resource.bento.ui.BentoBracketSet(editor, sourceviewer);
    this.colorManager = colorManager;
    isHighlightBrackets =
        preferenceStore.getBoolean(
            bento.language.bentocomp.resource.bento.ui.BentoPreferenceConstants
                .EDITOR_MATCHING_BRACKETS_CHECKBOX);
    bracketColor =
        colorManager.getColor(
            org.eclipse.jface.preference.PreferenceConverter.getColor(
                preferenceStore,
                bento.language.bentocomp.resource.bento.ui.BentoPreferenceConstants
                    .EDITOR_MATCHING_BRACKETS_COLOR));
    black = colorManager.getColor(new org.eclipse.swt.graphics.RGB(0, 0, 0));

    addListeners(editor);
  }
Пример #11
0
  /** @generated */
  public Node createStakeHolder_2011(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Shape node = NotationFactory.eINSTANCE.createShape();
    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(RdalVisualIDRegistry.getType(StakeHolderEditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    stampShortcut(containerView, node);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (nodeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      nodeFontStyle.setFontName(fontData.getName());
      nodeFontStyle.setFontHeight(fontData.getHeight());
      nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    org.eclipse.swt.graphics.RGB fillRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));
    Node label5018 =
        createLabel(node, RdalVisualIDRegistry.getType(StakeHolderNameEditPart.VISUAL_ID));
    label5018.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location5018 = (Location) label5018.getLayoutConstraint();
    location5018.setX(0);
    location5018.setY(5);
    return node;
  }
 private RGB getColorFromStore(IPreferenceStore store, String key) {
   RGB rgb = null;
   if (store.contains(key)) {
     if (store.isDefault(key)) rgb = PreferenceConverter.getDefaultColor(store, key);
     else rgb = PreferenceConverter.getColor(store, key);
   }
   return rgb;
 }
Пример #13
0
  @Override
  protected void initializeFromPreferences(View view) {
    super.initializeFromPreferences(view);
    IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore();
    if (store == null) {
      return;
    }

    // Create region default styles
    ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
    RGB fillRGB =
        PreferenceConverter.getColor(store, StatechartPreferenceConstants.PREF_REGION_BACKGROUND);
    style.setFillColor(FigureUtilities.RGBToInteger(fillRGB));
    RGB lineRGB =
        PreferenceConverter.getColor(store, StatechartPreferenceConstants.PREF_REGION_LINE);
    style.setLineColor(FigureUtilities.RGBToInteger(lineRGB));
  }
Пример #14
0
 /** @generated */
 public Node createRequirementsGroup_2007(
     EObject domainElement,
     View containerView,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   Node node = NotationFactory.eINSTANCE.createNode();
   node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
   node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
   node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
   node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
   node.setType(RdalVisualIDRegistry.getType(RequirementsGroupEditPart.VISUAL_ID));
   ViewUtil.insertChildView(containerView, node, index, persisted);
   node.setElement(domainElement);
   stampShortcut(containerView, node);
   // initializeFromPreferences
   final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
   FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
   if (nodeFontStyle != null) {
     FontData fontData =
         PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
     nodeFontStyle.setFontName(fontData.getName());
     nodeFontStyle.setFontHeight(fontData.getHeight());
     nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
     nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
     org.eclipse.swt.graphics.RGB fontRGB =
         PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
     nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
   }
   org.eclipse.swt.graphics.RGB fillRGB =
       PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
   ViewUtil.setStructuralFeatureValue(
       node,
       NotationPackage.eINSTANCE.getFillStyle_FillColor(),
       FigureUtilities.RGBToInteger(fillRGB));
   Node label5013 =
       createLabel(node, RdalVisualIDRegistry.getType(RequirementsGroupNameEditPart.VISUAL_ID));
   createCompartment(
       node,
       RdalVisualIDRegistry.getType(RequirementsGroupRequirementsCompartmentEditPart.VISUAL_ID),
       true,
       false,
       false,
       false);
   return node;
 }
 private static Color getForegroundColor() {
   IPreferenceStore preference = DartToolsPlugin.getDefault().getPreferenceStore();
   RGB rgb =
       PreferenceConverter.getColor(
           preference, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND);
   DartTextTools textTools = DartToolsPlugin.getDefault().getDartTextTools();
   return textTools.getColorManager().getColor(rgb);
 }
 private void handleAppearanceColorListSelection() {
   int i = fAppearanceColorList.getSelectionIndex();
   if (i == -1) return;
   String key = fAppearanceColorListModel[i][1];
   RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key);
   fAppearanceColorEditor.setColorValue(rgb);
   updateAppearanceColorWidgets(fAppearanceColorListModel[i][2]);
 }
 private void addColor(String colorKey) {
   if (fColorManager != null && colorKey != null && fColorManager.getColor(colorKey) == null) {
     RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey);
     if (fColorManager instanceof IColorManagerExtension) {
       IColorManagerExtension ext = (IColorManagerExtension) fColorManager;
       ext.unbindColor(colorKey);
       ext.bindColor(colorKey, rgb);
     }
   }
 }
  /** @generated */
  public Node createViewTable_1002(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Node node = NotationFactory.eINSTANCE.createNode();
    node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
    node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());

    FillStyle fillStyle = NotationFactory.eINSTANCE.createFillStyle();
    Color color = ViewTableEditPart.getDeclaredBackgroundColor();
    fillStyle.setFillColor(FigureUtilities.colorToInteger(color));
    node.getStyles().add(fillStyle);
    LineStyle lineStyle = NotationFactory.eINSTANCE.createLineStyle();
    lineStyle.setLineColor(FigureUtilities.RGBToInteger(new org.eclipse.swt.graphics.RGB(0, 0, 0)));
    node.getStyles().add(lineStyle);

    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(SqlmodelVisualIDRegistry.getType(ViewTableEditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    stampShortcut(containerView, node);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
    FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (nodeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      nodeFontStyle.setFontName(fontData.getName());
      nodeFontStyle.setFontHeight(fontData.getHeight());
      nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Node label4002 =
        createLabel(node, SqlmodelVisualIDRegistry.getType(ViewTableNameEditPart.VISUAL_ID));
    createCompartment(
        node,
        SqlmodelVisualIDRegistry.getType(ViewTableViewedColumnsEditPart.VISUAL_ID),
        false,
        false,
        true,
        true);
    createCompartment(
        node,
        SqlmodelVisualIDRegistry.getType(ViewTableViewedTablesEditPart.VISUAL_ID),
        false,
        false,
        true,
        true);
    return node;
  }
  protected void updatePreferences() {
    IPreferenceStore store = SimulationActivator.getDefault().getPreferenceStore();
    // read out the new colors
    RGB foregroundColor = PreferenceConverter.getColor(store, STATE_FOREGROUND_HIGHLIGHTING_COLOR);
    RGB backgroundColor = PreferenceConverter.getColor(store, STATE_BACKGROUND_HIGHLIGHTING_COLOR);
    RGB vertexForegroundColor =
        PreferenceConverter.getColor(store, VERTEX_FOREGROUND_TRANSIENT_COLOR);
    RGB vertexBackgroundColor =
        PreferenceConverter.getColor(store, VERTEX_BACKGROUND_TRANSIENT_COLOR);
    RGB transitionColor = PreferenceConverter.getColor(store, TRANSITION_HIGHLIGHTING_COLOR);

    // Set the new colors
    STATE_HIGHLIGHT_PARAMS.foregroundFadingColor = new Color(Display.getDefault(), foregroundColor);
    STATE_HIGHLIGHT_PARAMS.backgroundFadingColor = new Color(Display.getDefault(), backgroundColor);
    VERTEX_TRANSIENT_PARAMS.foregroundFadingColor =
        new Color(Display.getDefault(), vertexForegroundColor);
    VERTEX_TRANSIENT_PARAMS.backgroundFadingColor =
        new Color(Display.getDefault(), vertexBackgroundColor);
    TRANSITION_PARAMS.foregroundFadingColor = new Color(Display.getDefault(), transitionColor);
  }
Пример #20
0
  /** Constructs a well renderer model with default properties. */
  public WellRendererModel() {
    super();

    // Initialize the default renderer settings from the preferences.
    final IPreferenceStore preferences = WellRendererPreferencePage.PREFERENCE_STORE;

    final int boreRadius = preferences.getInt(WELL_BORE_RADIUS);
    final RGB boreColor = PreferenceConverter.getColor(preferences, WELL_BORE_COLOR);

    _size = addIntegerProperty(WELL_BORE_RADIUS, boreRadius);
    _color = addColorProperty(WELL_BORE_COLOR, boreColor);
  }
Пример #21
0
 /** Resets the changed values after setting the preference pages. */
 public void resetValues() {
   isHighlightBrackets =
       preferenceStore.getBoolean(
           bento.language.bentocomp.resource.bento.ui.BentoPreferenceConstants
               .EDITOR_MATCHING_BRACKETS_CHECKBOX);
   bracketColor =
       colorManager.getColor(
           org.eclipse.jface.preference.PreferenceConverter.getColor(
               preferenceStore,
               bento.language.bentocomp.resource.bento.ui.BentoPreferenceConstants
                   .EDITOR_MATCHING_BRACKETS_COLOR));
   bracketSet.resetBrackets();
 }
Пример #22
0
  private void updateBackgroundColor() {
    boolean defaultBackgroundColor =
        preferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);

    if (defaultBackgroundColor) {
      setBackgroundColor(null);
    } else {
      RGB backgroundColor =
          PreferenceConverter.getColor(
              preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
      setBackgroundColor(backgroundColor);
    }
  }
  /**
   * initialize the foreground 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 initForegroundFromPrefs(
      View view, final IPreferenceStore store, String elementName) {
    if (!usePreferenceInitializer(view)) {
      return;
    }

    String lineColorConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_LINE);
    org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
    ViewUtil.setStructuralFeatureValue(
        view,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
  }
Пример #24
0
  /**
   * Creates a color from the information stored in the given preference store. Returns <code>null
   * </code> if there is no such information available.
   *
   * @param store the store to read from
   * @param key the key used for the lookup in the preference store
   * @param display the display used create the color
   * @return the created color according to the specification in the preference store
   * @since 3.0
   */
  private Color createColor(IPreferenceStore store, String key, Display display) {

    RGB rgb = null;

    if (store.contains(key)) {

      if (store.isDefault(key)) rgb = PreferenceConverter.getDefaultColor(store, key);
      else rgb = PreferenceConverter.getColor(store, key);

      if (rgb != null) return new Color(display, rgb);
    }

    return null;
  }
Пример #25
0
 private static Color createColor(IPreferenceStore store, String key, Display display) {
   // TODO(messick) Remove display or use it instead of color manager
   RGB rgb = null;
   if (store.contains(key)) {
     if (store.isDefault(key)) {
       rgb = PreferenceConverter.getDefaultColor(store, key);
     } else {
       rgb = PreferenceConverter.getColor(store, key);
     }
     if (rgb != null) {
       return getColorManager().getColor(rgb);
     }
   }
   return null;
 }
Пример #26
0
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    LogManager.logDebug("Start getPresentationReconciler: sourceViewer-" + sourceViewer, this);
    PresentationReconciler reconciler = new PresentationReconciler();

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    IPreferenceStore store = IDEPlugin.getDefault().getPreferenceStore();
    RGB comment = PreferenceConverter.getColor(store, IDEPreferenceConstants.P_C_COMMENT_COLOR);
    NonRuleBasedDamagerRepairer ndr =
        new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(comment)));
    reconciler.setDamager(ndr, CPartitionScanner.C_COMMENT);
    reconciler.setRepairer(ndr, CPartitionScanner.C_COMMENT);

    LogManager.logDebug("End getPresentationReconciler: returnVal-" + reconciler, this);
    return reconciler;
  }
 private void handleSyntaxColorListSelection() {
   HighlightingColorListItem item = getHighlightingColorListItem();
   if (item == null) {
     fEnableCheckbox.setEnabled(false);
     fSyntaxForegroundColorEditor.getButton().setEnabled(false);
     fColorEditorLabel.setEnabled(false);
     fBoldCheckBox.setEnabled(false);
     fItalicCheckBox.setEnabled(false);
     fStrikethroughCheckBox.setEnabled(false);
     fUnderlineCheckBox.setEnabled(false);
     return;
   }
   RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey());
   fSyntaxForegroundColorEditor.setColorValue(rgb);
   fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey()));
   fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey()));
   fStrikethroughCheckBox.setSelection(
       getPreferenceStore().getBoolean(item.getStrikethroughKey()));
   fUnderlineCheckBox.setSelection(getPreferenceStore().getBoolean(item.getUnderlineKey()));
   if (item instanceof SemanticHighlightingColorListItem) {
     boolean semanticHighlightingEnabled =
         getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED);
     fEnableCheckbox.setEnabled(semanticHighlightingEnabled);
     boolean enable =
         semanticHighlightingEnabled
             && getPreferenceStore()
                 .getBoolean(((SemanticHighlightingColorListItem) item).getEnableKey());
     fEnableCheckbox.setSelection(enable);
     fSyntaxForegroundColorEditor.getButton().setEnabled(enable);
     fColorEditorLabel.setEnabled(enable);
     fBoldCheckBox.setEnabled(enable);
     fItalicCheckBox.setEnabled(enable);
     fStrikethroughCheckBox.setEnabled(enable);
     fUnderlineCheckBox.setEnabled(enable);
   } else {
     fSyntaxForegroundColorEditor.getButton().setEnabled(true);
     fColorEditorLabel.setEnabled(true);
     fBoldCheckBox.setEnabled(true);
     fItalicCheckBox.setEnabled(true);
     fStrikethroughCheckBox.setEnabled(true);
     fUnderlineCheckBox.setEnabled(true);
     fEnableCheckbox.setEnabled(false);
     fEnableCheckbox.setSelection(true);
   }
 }
Пример #28
0
  /** @generated */
  @Override
  public Object getPreferredValue(EStructuralFeature feature) {
    IPreferenceStore preferenceStore =
        (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore();
    Object result = null;

    if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()
        || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()
        || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
      String prefColor = null;
      if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
        prefColor =
            PreferenceConstantHelper.getElementConstant(
                "Metaclass", PreferenceConstantHelper.COLOR_LINE);
      } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
        prefColor =
            PreferenceConstantHelper.getElementConstant(
                "Metaclass", PreferenceConstantHelper.COLOR_FONT);
      } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
        prefColor =
            PreferenceConstantHelper.getElementConstant(
                "Metaclass", PreferenceConstantHelper.COLOR_FILL);
      }
      result =
          FigureUtilities.RGBToInteger(
              PreferenceConverter.getColor((IPreferenceStore) preferenceStore, prefColor));
    } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()
        || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
      String prefGradient =
          PreferenceConstantHelper.getElementConstant(
              "Metaclass", PreferenceConstantHelper.COLOR_GRADIENT);
      GradientPreferenceConverter gradientPreferenceConverter =
          new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
      if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
        result = new Integer(gradientPreferenceConverter.getTransparency());
      } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
        result = gradientPreferenceConverter.getGradientData();
      }
    }

    if (result == null) {
      result = getStructuralFeatureValue(feature);
    }
    return result;
  }
Пример #29
0
    @Override
    protected Object createTextAttribute(String key) {
      if (key != null) {
        key = resolveUsedKey(key);

        if (key.equals(RUIPreferenceConstants.R.TS_DEFAULT_ROOT)) {
          return null;
        }
      } else {
        key = RUIPreferenceConstants.R.TS_DEFAULT_ROOT;
      }

      final StringBuilder sb = new StringBuilder(32);
      final RGB rgb =
          PreferenceConverter.getColor(
              fPreferenceStore, key + ITextPresentationConstants.TEXTSTYLE_COLOR_SUFFIX);
      sb.append("color: "); // $NON-NLS-1$
      RHelpUIServlet.appendCssColor(sb, rgb);
      sb.append("; "); // $NON-NLS-1$
      if (fPreferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_BOLD_SUFFIX)) {
        sb.append("font-weight: bold; "); // $NON-NLS-1$
      }
      if (fPreferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_ITALIC_SUFFIX)) {
        sb.append("font-style: italic; "); // $NON-NLS-1$
      }
      final boolean strikethrough =
          fPreferenceStore.getBoolean(
              key + ITextPresentationConstants.TEXTSTYLE_STRIKETHROUGH_SUFFIX);
      final boolean underline =
          fPreferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_UNDERLINE_SUFFIX);
      if (strikethrough || underline) {
        sb.append("text-decoration:"); // $NON-NLS-1$
        if (strikethrough) {
          sb.append(" line-through"); // $NON-NLS-1$
        }
        if (underline) {
          sb.append(" underline"); // $NON-NLS-1$
        }
        sb.append("; "); // $NON-NLS-1$
      }

      return sb.substring(0, sb.length() - 1);
    }
  /**
   * initialize the font 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 initFontStyleFromPrefs(
      View view, final IPreferenceStore store, String elementName) {
    if (!usePreferenceInitializer(view)) {
      return;
    }

    String fontConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.FONT);
    String fontColorConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_FONT);

    FontStyle viewFontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (viewFontStyle != null) {
      FontData fontData = PreferenceConverter.getFontData(store, fontConstant);
      viewFontStyle.setFontName(fontData.getName());
      viewFontStyle.setFontHeight(fontData.getHeight());
      viewFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      viewFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);

      org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(store, fontColorConstant);
      viewFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
  }