Package org.fife.ui.rsyntaxtextarea.folding

Examples of org.fife.ui.rsyntaxtextarea.folding.FoldManager


      Point p = e.getPoint();
      int line = rowAtPoint(p);

      RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
      FoldManager fm = rsta.getFoldManager();

      Fold fold = fm.getFoldForLine(line);
      if (fold!=null) {
        fold.toggleCollapsedState();
        getGutter().repaint();
        textArea.repaint();
      }
View Full Code Here


            RSyntaxTextArea rsta = (RSyntaxTextArea)getTextArea();
            if (rsta.isCodeFoldingEnabled()) {

              int lastDot = getDot();
              FoldManager fm = rsta.getFoldManager();
              int line = 0;
              try {
                line = textArea.getLineOfOffset(dot);
              } catch (Exception e) {
                e.printStackTrace();
              }

              if (fm.isLineHidden(line)) {

                //System.out.println("filterBypass: avoiding hidden line");
                try {
                  if (dot>lastDot) { // Moving to further line
                    int lineCount = textArea.getLineCount();
                    while (++line<lineCount &&
                        fm.isLineHidden(line));
                      if (line<lineCount) {
                        dot = textArea.getLineStartOffset(line);
                      }
                      else { // No lower lines visible
                        UIManager.getLookAndFeel().
                            provideErrorFeedback(textArea);
                        return;
                      }
                  }
                  else if (dot<lastDot) { // Moving to earlier line
                    while (--line>=0 && fm.isLineHidden(line));
                    if (line>=0) {
                      dot = textArea.getLineEndOffset(line) - 1;
                    }
                  }
            } catch (Exception e) {
View Full Code Here

          if (target.isCodeFoldingEnabled()) {
            int last = pos==endOffs-1 ? target.getLineCount()-1 :
              target.getLineOfOffset(pos+1);
            int current = target.getLineOfOffset(pos);
            if (last!=current) { // If moving up a line...
              FoldManager fm = target.getFoldManager();
              if (fm.isLineHidden(current)) {
                while (--current>0 && fm.isLineHidden(current));
                pos = target.getLineEndOffset(current) - 1;
              }
            }
          }
        }
        break;

      case EAST:
        if(pos == -1) {
          pos = view.getStartOffset();
        }
        else {
          pos = Math.min(pos + 1, view.getDocument().getLength());
          if (target.isCodeFoldingEnabled()) {
            int last = pos==0 ? 0 : target.getLineOfOffset(pos-1);
            int current = target.getLineOfOffset(pos);
            if (last!=current) { // If moving down a line...
              FoldManager fm = target.getFoldManager();
              if (fm.isLineHidden(current)) {
                int lineCount = target.getLineCount();
                while (++current<lineCount && fm.isLineHidden(current));
                pos = current==lineCount ?
                    target.getLineEndOffset(last)-1 : // Was the last visible line
                    target.getLineStartOffset(current);
              }
            }
View Full Code Here

    // A line containing only Token.NULL is an empty line.
    else if (token.getType()==Token.NULL) {
      int line = c.getLineOfOffset(offs)// Sure to be > c.getLineCount()-1 ??
//      return c.getLineStartOffset(line+1);
FoldManager fm = c.getFoldManager();
line = fm.getVisibleLineBelow(line);
return c.getLineStartOffset(line);
    }

    else {
      return token.getListOffset(c, e, 0, x);
View Full Code Here

    int end = range.getEndOffset();

    boolean foldsExpanded = false;
    if (textArea instanceof RSyntaxTextArea) {
      RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
      FoldManager fm = rsta.getFoldManager();
      if (fm.isCodeFoldingSupportedAndEnabled()) {
        foldsExpanded = fm.ensureOffsetNotInClosedFold(start);
        foldsExpanded |= fm.ensureOffsetNotInClosedFold(end);
      }
    }

    if (select) {
      textArea.setSelectionStart(start);
View Full Code Here

    // When line wrap is not enabled, take the faster code path.
    if (textArea==null) {
      return;
    }
    RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
    FoldManager fm = rsta.getFoldManager();
    if (!fm.isCodeFoldingSupportedAndEnabled()) {
      super.paintComponent(g);
      return;
    }

    visibleRect = g.getClipBounds(visibleRect);
    if (visibleRect==null) { // ???
      visibleRect = getVisibleRect();
    }
    //System.out.println("IconRowHeader repainting: " + visibleRect);
    if (visibleRect==null) {
      return;
    }
    paintBackgroundImpl(g, visibleRect);

    if (textArea.getLineWrap()) {
      paintComponentWrapped(g);
      return;
    }

    Document doc = textArea.getDocument();
    Element root = doc.getDefaultRootElement();
    textAreaInsets = textArea.getInsets(textAreaInsets);
    if (visibleRect.y<textAreaInsets.top) {
      visibleRect.height -= (textAreaInsets.top - visibleRect.y);
      visibleRect.y = textAreaInsets.top;
    }

    // Get the first line to paint.
    int cellHeight = textArea.getLineHeight();
    int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight;

    // Get where to start painting (top of the row).
    // We need to be "scrolled up" up just enough for the missing part of
    // the first line.
    int y = topLine*cellHeight + textAreaInsets.top;

    // AFTER calculating visual offset to paint at, account for folding.
    topLine += fm.getHiddenLineCountAbove(topLine, true);

    // Paint the active line range.
    if (activeLineRangeStart>-1 && activeLineRangeEnd>-1) {
      Color activeLineRangeColor = getActiveLineRangeColor();
      g.setColor(activeLineRangeColor);
View Full Code Here

TOP

Related Classes of org.fife.ui.rsyntaxtextarea.folding.FoldManager

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.