コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.wst.sse.ui.style.LineStyleProvider#prepareRegions(org.eclipse.jface.text.ITypedRegion,
  *      int, int, java.util.Collection)
  */
 public boolean prepareRegions(
     ITypedRegion currentRegion, int start, int length, Collection styleRanges) {
   // make everything bold grey
   if (foreground == null) foreground = EditorUtility.getColor(new RGB(127, 127, 127));
   styleRanges.add(new StyleRange(start, length, foreground, null, SWT.BOLD));
   return true;
 }
コード例 #2
0
 /*
  * Creates TextAttribute from the given style description array string
  */
 protected TextAttribute createTextAttribute(String[] stylePrefs) {
   int fontModifier = SWT.NORMAL;
   if (Boolean.valueOf(stylePrefs[2]).booleanValue()) { // bold
     fontModifier |= SWT.BOLD;
   }
   if (Boolean.valueOf(stylePrefs[3]).booleanValue()) { // italic
     fontModifier |= SWT.ITALIC;
   }
   if (Boolean.valueOf(stylePrefs[4]).booleanValue()) { // strikethrough
     fontModifier |= TextAttribute.STRIKETHROUGH;
   }
   if (Boolean.valueOf(stylePrefs[5]).booleanValue()) { // underline
     fontModifier |= TextAttribute.UNDERLINE;
   }
   return new TextAttribute(
       EditorUtility.getColor(ColorHelper.toRGB(stylePrefs[0])),
       EditorUtility.getColor(ColorHelper.toRGB(stylePrefs[1])),
       fontModifier);
 }