Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextAttribute


     * @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


                    + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_STYLE_SUFFIX ) ).intValue();
            }
        }

        Color color = LdifEditorActivator.getDefault().getColor( rgb );
        TextAttribute textAttribute = new TextAttribute( color, null, style );
        return textAttribute;
    }
View Full Code Here

        // TextAttribute DEFAULT_TEXT_ATTRIBUTE = new
        // TextAttribute(Activator.getDefault().getColor(new RGB(0, 0,
        // 0)));

        TextAttribute COMMENT_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_COMMENT );
        TextAttribute KEYWORD_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_KEYWORD );
        TextAttribute DN_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_DN );
        TextAttribute ATTRIBUTE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_ATTRIBUTE );
        TextAttribute VALUETYPE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_VALUETYPE );
        TextAttribute VALUE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_VALUE );
        TextAttribute ADD_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEADD );
        TextAttribute MODIFY_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEMODIFY );
        TextAttribute DELETE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEDELETE );
        TextAttribute MODDN_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEMODDN );

        for ( int z = 0; z < containers.length; z++ )
        {

            LdifContainer container = containers[z];
View Full Code Here

      fItalic.setSelection(false);
      fStrike.setSelection(false);
      fUnderline.setSelection(false);
    }
    else {
      TextAttribute attribute = getAttributeFor(namedStyle);
      fClearStyle.setEnabled(true);
      fBold.setEnabled(true);
      fItalic.setEnabled(true);
      fStrike.setEnabled(true);
      fUnderline.setEnabled(true);
      fForegroundLabel.setEnabled(true);
      fBackgroundLabel.setEnabled(true);
      fForegroundColorEditor.setEnabled(true);
      fBackgroundColorEditor.setEnabled(true);
      fBold.setSelection((attribute.getStyle() & SWT.BOLD) != 0);
      fItalic.setSelection((attribute.getStyle() & SWT.ITALIC) != 0);
      fStrike.setSelection((attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0);
      fUnderline.setSelection((attribute.getStyle() & TextAttribute.UNDERLINE) != 0);
      if (attribute.getForeground() != null) {
        foreground = attribute.getForeground();
      }
      if (attribute.getBackground() != null) {
        background = attribute.getBackground();
      }
    }

    fForegroundColorEditor.setColorValue(foreground.getRGB());
    fBackgroundColorEditor.setColorValue(background.getRGB());
View Full Code Here

        ITextRegion currentRegion = regions.get(i);
        // lookup the local coloring type and apply it
        String namedStyle = (String) fContextToStyleMap.get(currentRegion.getType());
        if (namedStyle == null)
          continue;
        TextAttribute attribute = getAttributeFor(namedStyle);
        if (attribute == null)
          continue;
        StyleRange style = new StyleRange(documentRegion.getStartOffset(currentRegion), currentRegion.getTextLength(), attribute.getForeground(), attribute.getBackground(), attribute.getStyle());
        style.strikeout = (attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0;
        style.underline = (attribute.getStyle() & TextAttribute.UNDERLINE) != 0;
        fText.setStyleRange(style);
      }
      documentRegion = documentRegion.getNext();
    }
  }
View Full Code Here

  protected IPreferenceStore doGetPreferenceStore() {
    return XMLUIPlugin.getDefault().getPreferenceStore();
  }

  private TextAttribute getAttributeFor(String namedStyle) {
    TextAttribute ta = new TextAttribute(fDefaultForeground, fDefaultBackground, SWT.NORMAL);

    if (namedStyle != null && fOverlayStore != null) {
      // note: "namedStyle" *is* the preference key
      String prefString = getOverlayStore().getString(namedStyle);
      String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
      if (stylePrefs != null) {
        RGB foreground = ColorHelper.toRGB(stylePrefs[0]);
        RGB background = ColorHelper.toRGB(stylePrefs[1]);

        int fontModifier = SWT.NORMAL;

        if (stylePrefs.length > 2) {
          boolean on = Boolean.valueOf(stylePrefs[2]).booleanValue();
          if (on)
            fontModifier = fontModifier | SWT.BOLD;
        }
        if (stylePrefs.length > 3) {
          boolean on = Boolean.valueOf(stylePrefs[3]).booleanValue();
          if (on)
            fontModifier = fontModifier | SWT.ITALIC;
        }
        if (stylePrefs.length > 4) {
          boolean on = Boolean.valueOf(stylePrefs[4]).booleanValue();
          if (on)
            fontModifier = fontModifier | TextAttribute.STRIKETHROUGH;
        }
        if (stylePrefs.length > 5) {
          boolean on = Boolean.valueOf(stylePrefs[5]).booleanValue();
          if (on)
            fontModifier = fontModifier | TextAttribute.UNDERLINE;
        }

        ta = new TextAttribute((foreground != null) ? EditorUtility.getColor(foreground) : null, (background != null) ? EditorUtility.getColor(background) : null, fontModifier);
      }
    }
    return ta;
  }
View Full Code Here

  protected FitScanner getFitScanner() {
    if (fitScanner == null) {
      fitScanner = new FitScanner(colorManager);
      fitScanner.setDefaultReturnToken(
        new Token(
          new TextAttribute(
            colorManager.getColor(IFitColorConstants.DEFAULT))));
    }
    return fitScanner;
  }
View Full Code Here

    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    NonRuleBasedDamagerRepairer ndr =
      new NonRuleBasedDamagerRepairer(
        new TextAttribute(
          colorManager.getColor(IFitColorConstants.COMMENT)));
    reconciler.setDamager(ndr, FitSourcePartitionScanner.FIT_COMMENT);
    reconciler.setRepairer(ndr, FitSourcePartitionScanner.FIT_COMMENT);

    return reconciler;
View Full Code Here

                    + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_STYLE_SUFFIX ) ).intValue();
            }
        }

        Color color = LdifEditorActivator.getDefault().getColor( rgb );
        TextAttribute textAttribute = new TextAttribute( color, null, style );
        return textAttribute;
    }
View Full Code Here

        // TextAttribute DEFAULT_TEXT_ATTRIBUTE = new
        // TextAttribute(Activator.getDefault().getColor(new RGB(0, 0,
        // 0)));

        TextAttribute COMMENT_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_COMMENT );
        TextAttribute KEYWORD_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_KEYWORD );
        TextAttribute DN_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_DN );
        TextAttribute ATTRIBUTE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_ATTRIBUTE );
        TextAttribute VALUETYPE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_VALUETYPE );
        TextAttribute VALUE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_VALUE );
        TextAttribute ADD_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEADD );
        TextAttribute MODIFY_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEMODIFY );
        TextAttribute DELETE_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEDELETE );
        TextAttribute MODDN_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEMODDN );

        for ( int z = 0; z < containers.length; z++ )
        {

            LdifContainer container = containers[z];
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.