Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextAttribute


    if (value instanceof Boolean)
      eventValue = ((Boolean) value).booleanValue();
    else if (IPreferenceStore.TRUE.equals(value))
      eventValue = true;

    TextAttribute oldAttr = highlighting.getTextAttribute();
    boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;

    if (activeValue != eventValue)
      highlighting.setTextAttribute(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(), eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute));
  }
View Full Code Here


   * @param event the event that triggered the change
   */
  private void adaptToStyleChange(HighlightingStyle highlighting, PropertyChangeEvent event) {
    Object value = event.getNewValue();
    if (value instanceof String) {
      TextAttribute attr = createTextAttribute((String) value);
      if (attr != null)
        highlighting.setTextAttribute(attr);
    }
  }
View Full Code Here

    public StyleRange createStyleRange() {
      int len= 0;
      if (fStyle.isEnabled())
        len= getLength();

      TextAttribute textAttribute = fStyle.getTextAttribute();
      int style = textAttribute.getStyle();
      int fontStyle = style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
      StyleRange styleRange = new StyleRange(getOffset(), len, textAttribute.getForeground(), textAttribute.getBackground(), fontStyle);
      styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
      styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;

      return styleRange;
    }
View Full Code Here

  }
 

  public BaseCodeScanner(DestecsColorProvider provider)
  {
    IToken type = new Token(new TextAttribute(provider.getColor(new RGB(0, 0, 192)), null, SWT.BOLD));
    IToken keyword = new Token(new TextAttribute(provider.getColor(DestecsColorProvider.KEYWORD), null, SWT.BOLD));
    IToken string = new Token(new TextAttribute(provider.getColor(DestecsColorProvider.STRING)));
    IToken comment = new Token(new TextAttribute(provider.getColor(DestecsColorProvider.SINGLE_LINE_COMMENT)));
    IToken other = new Token(new TextAttribute(provider.getColor(DestecsColorProvider.DEFAULT)));

    List<IRule> rules = new ArrayList<IRule>();
    // Add rule for single line comments.
    rules.add(new EndOfLineRule("--", comment));
    rules.add(new EndOfLineRule("//", comment));
View Full Code Here

                ext.unbindColor(property);
                ext.bindColor(property, rgb);
                color = _colorManager.getColor(property);
            }

            TextAttribute oldAttr = highlighting.getTextAttribute();
            highlighting.setTextAttribute(new TextAttribute(color, oldAttr
                    .getBackground(), oldAttr.getStyle()));
        }
    }
View Full Code Here

            eventValue = ((Boolean) value).booleanValue();
        } else if (IPreferenceStore.TRUE.equals(value)) {
            eventValue = true;
        }

        TextAttribute oldAttr = highlighting.getTextAttribute();
        boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;

        if (activeValue != eventValue) {
            highlighting.setTextAttribute(new TextAttribute(oldAttr
                    .getForeground(), oldAttr.getBackground(),
                    eventValue ? (oldAttr.getStyle() | styleAttribute)
                            : (oldAttr.getStyle() & ~styleAttribute)));
        }
    }
View Full Code Here

            }

            boolean isEnabled = _preferenceStore
                    .getBoolean(semanticHighlighting.getEnabledPreferenceKey());

            _highlightings[i] = new HighlightingStyle(new TextAttribute(
                    _colorManager.getColor(PreferenceConverter.getColor(
                            _preferenceStore, colorKey)), null, style),
                    isEnabled);
        }
    }
View Full Code Here

     * Creates a new instance of SchemaTextAttributeProvider.
     *
     */
    public SchemaTextAttributeProvider()
    {
        attributes.put( DEFAULT_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 0, 0 ) ) ) );

        attributes.put( KEYWORD_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 127, 0, 85 ) ),
            null, SWT.BOLD ) );

        attributes.put( STRING_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 0, 255 ) ) ) );

        attributes.put( ATTRIBUTETYPE_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 89, 71,
            158 ) ), null, SWT.BOLD ) );

        attributes.put( OBJECTCLASS_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(),
            new RGB( 45, 124, 68 ) ), null, SWT.BOLD ) );

        attributes.put( OID_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 255, 0, 0 ) ) ) );
    }
View Full Code Here

     * @return
     *      the correct TextAttribute for the given type
     */
    public TextAttribute getAttribute( String type )
    {
        TextAttribute attr = ( TextAttribute ) attributes.get( type );
        if ( attr == null )
        {
            attr = ( TextAttribute ) attributes.get( DEFAULT_ATTRIBUTE );
        }
        return attr;
View Full Code Here

    /**
     * Creates a new instance of AciTextAttributeProvider.
     */
    public ACITextAttributeProvider()
    {
        attributes.put( DEFAULT_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 0, 0 ) ) ) );

        attributes.put( KEYWORD_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 127, 0, 85 ) ),
            null, SWT.BOLD ) );

        attributes.put( STRING_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 0, 255 ) ) ) );

        attributes.put( GRANT_DENY_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 125, 125,
            125 ) ) ) );

        attributes.put( GRANT_VALUE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 150, 0 ) ) ) );
        attributes.put( DENY_VALUE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 150, 0, 0 ) ) ) );

        attributes.put( IDENTIFICATION_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 125, 0,
            0 ) ), null, SWT.BOLD ) );

        attributes.put( PRECEDENCE_ATTRIBUTE, new TextAttribute(
            new Color( Display.getCurrent(), new RGB( 0, 0, 125 ) ), null, SWT.BOLD ) );

        attributes.put( AUTHENTICATIONLEVEL_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0,
            125, 0 ) ), null, SWT.BOLD ) );

        attributes.put( ITEMORUSERFIRST_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 125, 0,
            125 ) ), null, SWT.BOLD ) );

        attributes.put( USER_ATTRIBUTE, new TextAttribute( new Color( Display.getCurrent(), new RGB( 0, 122, 255 ) ),
            null, SWT.BOLD ) );

    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.TextAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.