Package jsyntaxpane

Examples of jsyntaxpane.Token


  int pos = target.getCaretPosition();
  int start = sDoc.getParagraphElement(pos).getStartOffset();
  String line = ActionUtils.getLine(target);
  String lineToPos = line.substring(0, pos - start);
  String prefix = getIndent(line);
  Token t = sDoc.getTokenAt(pos);
  if (TokenType.isComment(t)) {
    if (line.trim().endsWith("*/")) {
      prefix = prefix.substring(0, prefix.length() - 1);
    } else if (line.trim().startsWith("*")) {
      prefix += "# ";
View Full Code Here


  public void actionPerformed(JTextComponent target, SyntaxDocument sDoc,
      int dot, ActionEvent e) {
  String selected = target.getSelectedText();
  if (selected == null) {
  // Check for abbreviations:
  Token abbrToken = sDoc.getWordAt(dot, wordsPattern);
  //Integer tabStop = ActionUtils.getTabSize(target);
  //int lineStart = sDoc.getParagraphElement(dot).getStartOffset();
  //int column = dot - lineStart;
  //int needed = tabStop - (column % tabStop);
  if (abbrvs == null || abbrToken == null) {
    target.replaceSelection("\t");
  } else {
    String abbr = abbrToken.getString(sDoc);
    target.select(abbrToken.start, abbrToken.end());
  if (abbrvs.containsKey(abbr)) {
    abbr = abbrvs.get(abbr);
  } else {
    abbr += "\t";
  }
View Full Code Here

  public void handle(int pos) {
    SyntaxDocument doc = ActionUtils.getSyntaxDocument(pane);
    if (doc != null) {
      try {
        doc.readLock();
        Token token = doc.getTokenAt(pos);
        if (token == null || !handle(doc, token)) {
          deHighlight();
        }
      }
      finally {
View Full Code Here

TOP

Related Classes of jsyntaxpane.Token

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.