Examples of RSyntaxTextArea


Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

      }
      textArea.addComponentListener(this);
      textArea.getDocument().addDocumentListener(this);
      textArea.addPropertyChangeListener(this);
      if (textArea instanceof RSyntaxTextArea) {
        RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
        rsta.addActiveLineRangeListener(this);
        rsta.getFoldManager().addPropertyChangeListener(this);
      }
      installed = true;
    }
View Full Code Here

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

    public void uninstall() {
      if (installed) {
        textArea.removeComponentListener(this);
        textArea.getDocument().removeDocumentListener(this);
        if (textArea instanceof RSyntaxTextArea) {
          RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
          rsta.removeActiveLineRangeListener(this);
          rsta.getFoldManager().removePropertyChangeListener(this);
        }
        installed = false;
      }
    }
View Full Code Here

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

  private Fold findOpenFoldClosestTo(Point p) {

    Fold fold = null;

    RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
    if (rsta.isCodeFoldingEnabled()) { // Should always be true
      int offs = rsta.viewToModel(p); // TODO: Optimize me
      if (offs>-1) {
        try {
          int line = rsta.getLineOfOffset(offs);
          FoldManager fm = rsta.getFoldManager();
          fold = fm.getFoldForLine(line);
          if (fold==null) {
            fold = fm.getDeepestOpenFoldContaining(offs);
          }
        } catch (BadLocationException ble) {
View Full Code Here

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

   */
  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;
          }

          StringBuffer sb = new StringBuffer("<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

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

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

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

//      }

      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

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

            }
          }

          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

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

      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

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

  private static void selectAndPossiblyCenter(JTextArea textArea, int start,
                        int end) {

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

Examples of org.fife.ui.rsyntaxtextarea.RSyntaxTextArea

    return button;
  }
 
  public static RSyntaxTextArea createSyntaxTextArea(String name, String text) {

    final RSyntaxTextArea area = new RSyntaxTextArea();

    area.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_LISP);
   
    area.setText(text);
    area.setName(name);
    area.setToolTipText(name);
   
    for(int i = 0; i < area.getPopupMenu().getComponentCount(); i++) {
     
      Object object = area.getPopupMenu().getComponent(i);
     
      if(object instanceof JMenuItem) {
       
        JMenuItem item = (JMenuItem) object;

        if(item.getText().equals("Copy"))
          SwingFactory.setIcon(item, "icons/Copy.png");
       
        if(item.getText().equals("Paste"))
          SwingFactory.setIcon(item, "icons/Paste.png");
       
        if(item.getText().equals("Cut"))
          SwingFactory.setIcon(item, "icons/Cut.png");
       
        if(item.getText().contains("Delete"))
          SwingFactory.setIcon(item, "icons/delete.png");
       
        if(item.getText().contains("Select All"))
          SwingFactory.setIcon(item, "icons/edit_select_all.png");
       
        if(item.getText().contains("Undo"))
          SwingFactory.setIcon(item, "icons/undo.png");
       
        if(item.getText().contains("Redo"))
          SwingFactory.setIcon(item, "icons/redo.png");
      }
    }
   
    // mouse listener to resize font
    area.addMouseWheelListener(new MouseWheelListener() {
     
      @Override
      public void mouseWheelMoved(MouseWheelEvent e) {
       
        Font font = area.getFont();
        float size = font.getSize();
       
        if(e.getWheelRotation() < 0) {
         
          size = font.getSize() + 1f;
        }
        else if (e.getWheelRotation() > 0){

          size = font.getSize() - 1f;
        }
       
        area.setFont(font.deriveFont(size));
      }
    });
   
    return area;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.