Package org.fife.ui.rsyntaxtextarea

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea


  @Override
  public String getToolTipText(MouseEvent e) {

    String text = null;

    RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
    if (rsta.isCodeFoldingEnabled()) {
      FoldManager fm = rsta.getFoldManager();
      int pos = rsta.viewToModel(new Point(0, e.getY()));
      if (pos>=0) { // Not -1
        int line = 0;
        try {
          line = rsta.getLineOfOffset(pos);
        } catch (BadLocationException ble) {
          ble.printStackTrace(); // Never happens
          return null;
        }
        Fold fold = fm.getFoldForLine(line);
        if (fold!=null && fold.isCollapsed()) {

          int endLine = fold.getEndLine();
          if (fold.getLineCount()>25) { // Not too big
            endLine = fold.getStartLine() + 25;
          }

          StringBuilder sb = new StringBuilder("<html><nobr>");
          while (line<=endLine && line<rsta.getLineCount()) { // Sanity
            Token t = rsta.getTokenListForLine(line);
            while (t!=null && t.isPaintable()) {
              t.appendHTMLRepresentation(sb, rsta, true, true);
              t = t.getNextToken();
            }
            sb.append("<br>");
View Full Code Here


      bg = getGutter().getBackground();
    }
    g.setColor(bg);
    g.fillRect(0,visibleRect.y, getWidth(),visibleRect.height);

    RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
    if (!rsta.isCodeFoldingEnabled()) {
      return; // We should be hidden in this case, but still...
    }

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

    // 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.
    textAreaInsets = textArea.getInsets(textAreaInsets);
    if (visibleRect.y<textAreaInsets.top) {
      visibleRect.height -= (textAreaInsets.top - visibleRect.y);
      visibleRect.y = textAreaInsets.top;
    }
    int cellHeight = textArea.getLineHeight();
    int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight;
    int y = topLine*cellHeight +
      (cellHeight-collapsedFoldIcon.getIconHeight())/2;
    y += textAreaInsets.top;

    // Get the first and last lines to paint.
    FoldManager fm = rsta.getFoldManager();
    topLine += fm.getHiddenLineCountAbove(topLine, true);

    int width = getWidth();
    int x = width - 10;
    int line = topLine;
View Full Code Here

//      }

      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();
View Full Code Here

      public void setDot(FilterBypass fb, int dot, Position.Bias bias) {

        RTextArea textArea = getTextArea();
          if (textArea instanceof RSyntaxTextArea) {

            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();
View Full Code Here

            }
          }

          int offs = moveTo.getMarkedOffset();
          if (textArea instanceof RSyntaxTextArea) {
            RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
            if (rsta.isCodeFoldingEnabled()) {
              rsta.getFoldManager().
                    ensureOffsetNotInClosedFold(offs);
            }
          }
          int line = textArea.getLineOfOffset(offs);
          offs = textArea.getLineStartOffset(line);
View Full Code Here

            mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            mainFrame.setSize(width, height);
            mainFrame.setResizable(false);
            mainFrame.setLocationRelativeTo(null);

            textArea = new RSyntaxTextArea() {

                @Override
                protected void paintComponent(Graphics g) {
                    String text = this.getText();
                    textArea.removeAllLineHighlights();
View Full Code Here

TOP

Related Classes of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

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.