Quick problem highlighting line scroll-gutter?

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Quick problem highlighting line scroll-gutter?

Postby preditcon » Mon Sep 23, 2013 12:21 pm

I have no idea what the thing I'm looking for is called, so I'm going with "quick problem highlighting line scroll-gutter". This is also the reason why I might have missed a proper answer on this forum (apologies if that's the case).

Most IDEs I use have a special view component which seems to be a part of JScrollPane (in Swing terms). It's usually positioned right next to the vertical scroll bar and it represents a view of the whole document much like the scroll bar itself. When parser/compiler finds problems with code in the document, it marks offending characters of the document and their line in the usual gutter (where line numbers are shown). But it also marks them in the quick problem highlighting line scroll-gutter. When these marks are clicked, you get thrown to the problematic line. Unlike the scroll bar, which maps line offsets to a graphical slider, the quick problem highlighting line scroll-gutter appears "static" and maps line offsets to...well, marks. The only user interaction it allows is clicking them marks.

Both Netbeans and Eclipse have what I tried to describe here. Netbeans uses it to highlight problems, bookmarks, breakpoints, changes with respect to the head revision of the document in a code versioning system, etc.

Does RSTA have anything like that? I browsed through a few screenshots of RText, but couldn't find this functionality. It is an extremely handy tool when representing flat summaries of larger documents that do not fit inside editor's area or it's gutter.

Also, if you happen to know the name of that damned thing, I'd appreciate knowing it. Quick problem highlighting line scroll-gutter sounds a bit...outlandish?
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: Quick problem highlighting line scroll-gutter?

Postby as3boyan » Tue Sep 24, 2013 9:18 pm

That is very useful thing. I wonder if RTextScrollPane it has it already. Anyway, I think we can do this in this way:

get all those bugs/code tips and add colored rectangles to some vertical rectangle(and adjust position using (bug/code tip line number)/total lines count. Something like that.
as3boyan
 
Posts: 19
Joined: Mon Sep 16, 2013 8:21 pm

Re: Quick problem highlighting line scroll-gutter?

Postby preditcon » Wed Sep 25, 2013 9:37 am

Found a name for it. It's called an "Error Stripe" or an "Annotation Ruler". There's even a class in RSTA packages named similarly (ErrorStrip) which handles local marks. I'm looking for a document global equivalent.
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: Quick problem highlighting line scroll-gutter?

Postby robert » Sat Sep 28, 2013 12:31 am

Yes, the ErrorStrip is what you're looking for. I should probably better document the extra bits and pieces like this that are in the library. :)

I blogged a little about it here, and mentioned its integration with language support here, but there's not much else. The Javadoc for the class is pretty good though. It basically just sits there, and listens for updates from any Parsers registered on the RSTA instance. Any warnings or errors (or other important messages, you can set the minimum ParserNotice threshold to display) are automatically displayed and kept in sync with the editor.

You mentioned needing something "document global", and the ErrorStrip isn't sufficient? Can you be a little more specific what you're looking for?
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: Quick problem highlighting line scroll-gutter?

Postby preditcon » Mon Sep 30, 2013 11:38 am

Sorry, I was under the impression that you named the RSTA's row header component (displays line numbers and custom icons) ErrorStrip, when in fact this was the exact component I'd been looking for. The row header displays information about what can currently be seen in the editor, while ErrorStrip displays information found in the entire document, hence document local and document global terms respectively.

I'm going to try it out. Thanks.

Edit: RSTA never ceases to amaze me. Got this working in under a minute. All my errors/warnings are now quickly accessible. BTW, is ErrorStrip component supposed to be instantiated and placed next to a JScrollPane manually, or does your RTextScrollPane provide some sort of integration for it? I'm currently doing the former.
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: Quick problem highlighting line scroll-gutter?

Postby robert » Tue Oct 01, 2013 1:18 pm

Awesome! As for adding an ErrorStrip to a UI, you'd typically just add it next to the scroll pane manually. I do it like this:

java code:

RTextScrollPane scrollPane = new RTextScrollPane(textArea, true);
ErrorStrip es = new ErrorStrip(textArea);
JPanel temp = new JPanel(new BorderLayout());
temp.add(scrollPane);
temp.add(es, BorderLayout.LINE_END);
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 15 guests

cron