Examples of RTextScrollPane


Examples of org.fife.ui.rtextarea.RTextScrollPane

                        }.start();
                        break;
                }
            }
        });
        RTextScrollPane editorTextAreaScrollPane = new RTextScrollPane(editorTextArea);
        JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, editorTextAreaScrollPane, southPanel);
        add(verticalSplitPane, BorderLayout.CENTER);
        verticalSplitPane.setDividerLocation(150);
    }
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

    Gutter gutter = null;
    Container parent = textArea.getParent();
    if (parent instanceof JViewport) {
      parent = parent.getParent();
      if (parent instanceof RTextScrollPane) {
        RTextScrollPane sp = (RTextScrollPane)parent;
        gutter = sp.getGutter(); // Should always be non-null
      }
    }
    return gutter;
  }
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

        displayCode();
      }
    });
    toolBar.add(comboBox);
    // 表示エリア
    RTextScrollPane sp = new RTextScrollPane(this.sourceView);
    sp.setFoldIndicatorEnabled(true);
    contentPane.add(sp);
    return contentPane;
  }
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

    public RSTAEditor(boolean linenumbers, int startLineNumber) {
        super(new RSTADocument(SyntaxConstants.SYNTAX_STYLE_NONE));
        installPreferenceListener();
        readPreferences();
        scrollPane = new RTextScrollPane(this, linenumbers);
        if (!linenumbers)
            scrollPane.setIconRowHeaderEnabled(true);
        Document document = getDocument();
        document.addDocumentListener(this);
        addCaretListener(this);
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

    setPreferredSize(new Dimension(100, 100));
   
    // create the RSyntaxArea as an editor for the REPL
    textArea = SwingFactory.createSyntaxTextArea("repl", welcome);
   
    final RTextScrollPane scrollPane = new RTextScrollPane(textArea);
   
    textArea.addKeyListener(new CodeAssistant(textArea));
   
    // a key listener to process CTRL + Enter (= submit a command)
    textArea.addKeyListener(new KeyAdapter() {

      private int arrow = 0;

      private String lastInserted = "";

      @Override
      public void keyReleased(KeyEvent event) {

        int code = event.getKeyCode();

        if (code == 17) {

          arrow = 0;
          lastInserted = "";
        }
      }
     
      @Override
      public void keyPressed(KeyEvent event) {

        int code = event.getKeyCode();
        int modifiers = event.getModifiers();

        int caret = textArea.getCaretPosition();
        int last = textArea.getText().lastIndexOf(">> ") + 3;

        /**
         * Make old parts non editable
         */
        if ((!(code == KeyEvent.VK_C && modifiers == KeyEvent.CTRL_MASK) && code != KeyEvent.VK_CONTROL) && caret <= last) {

          if (code == KeyEvent.VK_BACK_SPACE) {

            textArea.append(" ");

            textArea.setCaretPosition(last + 1);
          }

          textArea.setCaretPosition(textArea.getText().length());
        }

        /**
         * C + CTRL --> CANCEL
         */
        if (code == KeyEvent.VK_C && modifiers == KeyEvent.CTRL_MASK) {

          if (textArea.getSelectedText() == null)
            textArea.append(" [CANCEL]\n>> ");
        }

        /**
         * ARROW-UP + CTRL --> HISTORY
         */
        if (code == 38 && modifiers == KeyEvent.CTRL_MASK) {

          if (history.size() > arrow) {

            String text = textArea.getText();

            textArea.setText(text.substring(0, text.length() - lastInserted.length()));

            textArea.append(history.get(arrow));

            lastInserted = history.get(arrow);
          }

          if (arrow < history.size())
            arrow++;
        }

        /**
         * ARROW-DOWN + CTRL --> HISTORY
         */
        if (code == 40 && modifiers == KeyEvent.CTRL_MASK) {

          if (history.size() > arrow && arrow <= 0) {

            String text = textArea.getText();

            textArea.setText(text.substring(0, text.length() - lastInserted.length()));

            textArea.append(history.get(arrow));

            lastInserted = history.get(arrow);
          }

          if (arrow > 0)
            arrow--;
        }

        /**
         * ENTER + CTRL --> SUBMIT COMMAND
         */
        if (code == KeyEvent.VK_ENTER && modifiers == KeyEvent.CTRL_MASK) {

          Dimension pref = scrollPane.getPreferredSize();
         
          textArea.setText(textArea.getText() + Literal.NL);

          try {

            int lines = textArea.getLineCount();

            try {

              String commands = "";

              int lineCount = 2;

              while (true) {

                // if we have the first line of the command
                if (commands.startsWith(">>")) {

                  commands = commands.replaceFirst(">>", "").trim();
                  break;
                }
                // if we have another line
                else {

                  Element line = textArea.getDocument().getDefaultRootElement().getElement(lines - lineCount);

                  int lineStart = line.getStartOffset();
                  int lineEnd = line.getEndOffset();

                  commands = textArea.getText(lineStart, lineEnd - lineStart) + commands;
                  lineCount++;
                }
              }

              logger.info("Input: " + commands);

              history.add(0, commands);
   
              Parser parser = interpreter.getParser();

              // + nl, otherwise there will be errors
              commands = parser.format(commands + "\n");

              List<LObject> objects = parser.parseAll(commands);
           
              Executer.instance.evaluate(textArea, objects, interpreter);
            }
            catch (Exception e) {

              textArea.setText(textArea.getText() + "Error" + "\n>> ");
             
              logger.warn("[interpreter exception] - " + e.getMessage(), e);
            }
          }
          catch (ArrayIndexOutOfBoundsException e) {

            // ignore
          }

          scrollPane.setPreferredSize(pref);
        }
      }
    });

    AutoCompletion autoCompletion = new AutoCompletion(provider);
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

    addOrSwitchToTab(open);
  }

  private void addOrSwitchToTab(OpenFile open) {
    String title = open.name;
    RTextScrollPane rTextScrollPane = open.scrollPane;
    if (house.indexOfTab(title) < 0) {
      house.addTab(title, rTextScrollPane);
      house.setSelectedIndex(house.indexOfTab(title));
      int index = house.indexOfTab(title);
      Tab ct = new Tab(title);
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

      house.setSelectedIndex(house.indexOfTab(title));
    }
  }

  private void closeOpenTab(int index) {
    RTextScrollPane co = (RTextScrollPane) house.getComponentAt(index);
    RSyntaxTextArea pane = (RSyntaxTextArea) co.getViewport().getView();
    OpenFile open = null;
    for (OpenFile file : hmap)
      if (pane.equals(file.textArea))
        open = file;
    if (open != null && hmap.contains(open))
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

  public RSyntaxTextArea getCurrentTextArea() {
    RSyntaxTextArea currentTextArea = null;
    try {
      int pos = house.getSelectedIndex();
      if (pos >= 0) {
        RTextScrollPane co = (RTextScrollPane) house.getComponentAt(pos);
        currentTextArea = (RSyntaxTextArea) co.getViewport().getView();
      }
    } catch (Exception e1) {
      e1.printStackTrace();
    }
    if (currentTextArea == null) {
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

      textArea.setSyntaxEditingStyle(SYNTAX_STYLE_MAKEFILE);
    else if (name.toLowerCase().endsWith(".py"))
      textArea.setSyntaxEditingStyle(SYNTAX_STYLE_PYTHON);
    else
      textArea.setSyntaxEditingStyle(SYNTAX_STYLE_PROPERTIES_FILE);
    scrollPane = new RTextScrollPane(textArea, true);
    scrollPane.setIconRowHeaderEnabled(true);
    textArea.setText(contents);
    theme.apply(textArea);
  }
View Full Code Here

Examples of org.fife.ui.rtextarea.RTextScrollPane

                {
                    activeEditors.put ( entry, source );
                }

                // Special code viewer scroll pane
                final RTextScrollPane sourceScroll = new RTextScrollPane ( source );
                sourceScroll.setVerticalScrollBarPolicy ( WebScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
                ( ( WebScrollPaneUI ) sourceScroll.getUI () ).setDrawBorder ( false );

                // Source code viewer theme
                loadTheme ( theme.getSelectedItem ().toString ().toLowerCase (), source );

                return sourceScroll;
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.