Package org.fife.ui.rsyntaxtextarea.parser

Examples of org.fife.ui.rsyntaxtextarea.parser.ParserNotice


    public Color getColor() {
      // Return the color for the highest-level parser.
      Color c = null;
      int lowestLevel = Integer.MAX_VALUE; // ERROR is 0
      for (Iterator i=notices.iterator(); i.hasNext(); ) {
        ParserNotice notice = (ParserNotice)i.next();
        if (notice.getLevel()<lowestLevel) {
          lowestLevel = notice.getLevel();
          c = notice.getColor();
        }
      }
      return c;
    }
View Full Code Here


      else { // > 1
        StringBuffer sb = new StringBuffer("<html>");
        sb.append(msg.getString("MultipleMarkers"));
        sb.append("<br>");
        for (int i=0; i<notices.size(); i++) {
          ParserNotice pn = (ParserNotice)notices.get(i);
          sb.append("&nbsp;&nbsp;&nbsp;- ");
          sb.append(pn.getMessage());
          sb.append("<br>");
        }
        text = sb.toString();
      }
View Full Code Here

      return text;

    }

    protected void mouseClicked(MouseEvent e) {
      ParserNotice pn = (ParserNotice)notices.get(0);
      int offs = pn.getOffset();
      int len = pn.getLength();
      if (offs>-1 && len>-1) { // These values are optional
        textArea.setSelectionStart(offs);
        textArea.setSelectionEnd(offs+len);
      }
      else {
        int line = pn.getLine();
        try {
          offs = textArea.getLineStartOffset(line);
          textArea.setCaretPosition(offs);
        } catch (BadLocationException ble) { // Never happens
          UIManager.getLookAndFeel().provideErrorFeedback(textArea);
View Full Code Here

    removeAll(); // listener is removed in Marker.removeNotify()
    Map markerMap = new HashMap();

    List notices = textArea.getParserNotices();
    for (Iterator i=notices.iterator(); i.hasNext(); ) {
      ParserNotice notice = (ParserNotice)i.next();
      if (notice.getLevel()<=levelThreshold ||
          (notice instanceof TaskNotice)) {
        // 1.5: Use Integer.valueOf(notice.getLine())
        Integer key = new Integer(notice.getLine());
        Marker m = (Marker)markerMap.get(key);
        if (m==null) {
          m = new Marker(notice);
          m.addMouseListener(listener);
          markerMap.put(key, m);
          add(m);
        }
        else {
          m.addNotice(notice);
        }
      }
    }

    if (getShowMarkedOccurrences() && textArea.getMarkOccurrences()) {
      List occurrences = textArea.getMarkedOccurrences();
      for (Iterator i=occurrences.iterator(); i.hasNext(); ) {
        DocumentRange range = (DocumentRange)i.next();
        int line = 0;
        try {
          line = textArea.getLineOfOffset(range.getStartOffset());
        } catch (BadLocationException ble) { // Never happens
          continue;
        }
        ParserNotice notice = new MarkedOccurrenceNotice(range);
        // 1.5: Use Integer.valueOf(notice.getLine())
        Integer key = new Integer(line);
        Marker m = (Marker)markerMap.get(key);
        if (m==null) {
          m = new Marker(notice);
View Full Code Here

      RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
                          textArea.getHighlighter();

      for (Iterator i=notices.iterator(); i.hasNext(); ) {
        ParserNotice notice = (ParserNotice)i.next();
        try {
          Object highlight = null;
          if (notice.getShowInEditor()) {
            highlight = h.addParserHighlight(notice,
                      parserErrorHighlightPainter);
          }
          noticesToHighlights.put(notice, highlight);
        } catch (BadLocationException ble) { // Never happens
View Full Code Here

  public List getParserNotices() {
    List notices = new ArrayList();
    if (noticesToHighlights!=null) {
      Iterator i = noticesToHighlights.keySet().iterator();
      while (i.hasNext()) {
        ParserNotice notice = (ParserNotice)i.next();
        notices.add(notice);
      }
    }
    return notices;
  }
View Full Code Here

      }
      */
      if (noticesToHighlights!=null) {
        for (Iterator j=noticesToHighlights.keySet().iterator();
            j.hasNext(); ) {
          ParserNotice notice = (ParserNotice)j.next();
          if (notice.containsPosition(pos)) {
            tip = notice.getToolTipText();
            parserForTip = notice.getParser();
            if (notice.getParser() instanceof HyperlinkListener) {
              listener = (HyperlinkListener)notice.getParser();
            }
            break;
          }
        }
      }
View Full Code Here

                        textArea.getHighlighter();

      for (Iterator i=noticesToHighlights.entrySet().iterator();
          i.hasNext(); ) {
        Map.Entry entry = (Map.Entry)i.next();
        ParserNotice notice = (ParserNotice)entry.getKey();
        if (notice.getParser()==parser && entry.getValue()!=null) {
          h.removeParserHighlight(entry.getValue());
          i.remove();
        }
      }
View Full Code Here

                        textArea.getHighlighter();

      for (Iterator i=noticesToHighlights.entrySet().iterator();
          i.hasNext(); ) {
        Map.Entry entry = (Map.Entry)i.next();
        ParserNotice notice = (ParserNotice)entry.getKey();
        if (shouldRemoveNotice(notice, res)) {
          if (entry.getValue()!=null) {
            h.removeParserHighlight(entry.getValue());
          }
          i.remove();
View Full Code Here

    private void doError(SAXParseException e) {
      int line = e.getLineNumber() - 1;
      try {
        int offs = textArea.getLineStartOffset(line);
        int len = textArea.getLineEndOffset(line) - offs + 1;
        ParserNotice pn = new DefaultParserNotice(XMLParser.this,
                      e.getMessage(), line, offs, len);
        result.addNotice(pn);
        System.err.println(">>> " + offs + "-" + len + " -> "+ pn);
      } catch (BadLocationException ble) {
        ble.printStackTrace();
View Full Code Here

TOP

Related Classes of org.fife.ui.rsyntaxtextarea.parser.ParserNotice

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.