Exemplo n.º 1
0
 private void removeHighlightingCategory(
     org.eclipse.jface.text.IDocument document, String category) {
   org.eclipse.jface.text.Position[] positions = positionHelper.getPositions(document, category);
   if (category.equals(
       bento.language.bentocomp.resource.bento.ui.BentoPositionCategory.BRACKET.toString())) {
     org.eclipse.swt.custom.StyleRange styleRange;
     for (org.eclipse.jface.text.Position position : positions) {
       org.eclipse.jface.text.Position tmpPosition = convertToWidgetPosition(position);
       if (tmpPosition != null) {
         styleRange = getStyleRangeAtPosition(tmpPosition);
         styleRange.borderStyle = org.eclipse.swt.SWT.NONE;
         styleRange.borderColor = null;
         styleRange.background = null;
         textWidget.setStyleRange(styleRange);
       }
     }
   }
   positionHelper.removePositions(document, category);
 }
Exemplo n.º 2
0
  private void setBracketHighlighting(org.eclipse.jface.text.IDocument document) {
    org.eclipse.swt.custom.StyleRange styleRange = null;
    org.eclipse.jface.text.Position[] positions =
        positionHelper.getPositions(
            document,
            bento.language.bentocomp.resource.bento.ui.BentoPositionCategory.BRACKET.toString());

    for (org.eclipse.jface.text.Position position : positions) {
      org.eclipse.jface.text.Position tmpPosition = convertToWidgetPosition(position);
      if (tmpPosition != null) {
        styleRange = getStyleRangeAtPosition(tmpPosition);
        styleRange.borderStyle = org.eclipse.swt.SWT.BORDER_SOLID;
        styleRange.borderColor = bracketColor;
        if (styleRange.foreground == null) {
          styleRange.foreground = black;
        }
        textWidget.setStyleRange(styleRange);
      }
    }
  }