Addition to RScrollPane

General Discussion on RSyntaxTextArea.

Moderator: robert

Addition to RScrollPane

Postby dmeers » Thu Feb 05, 2009 6:58 pm

I find RSyntaxTextArea quite useful. I have a couple of use-cases for RScrollPane to add the ability to place an icon in the margin:

1). I have a javascript debugger page and I want to show 'breakpoints' as well as a pointer to the line about to be executed.

2). In my Javascript Editor, it would be nice to have an indicator as to lines that are in error (after a compile).

BTW, I've used the AutoComplete feature in my Javascript editor and it works great! Keep up the good work.
dmeers
 

Re: Addition to RScrollPane

Postby robert » Thu Feb 05, 2009 8:37 pm

Thanks for the feedback! I'm glad you're finding AutoComplete useful also.

As for your requests, if I added a way to add a custom row header, would that help satisfy both of your requests? You could put error markers and breakpoint icons both in a row header.

I'm also thinking about adding an "error strip" (is that what you call it?) like they have in Eclipse and NetBeans, where on the right-hand side, they have little colored rectangles you can click on to quickly scroll to an error/warning/whatever else is marked. This would be another approach to marking errors.

Finally, I'm working on extending RSTA's "Parser" interface to be more robust. If you went that route, you can actually get squiggle-underlining of errors (and it could be coordinated with an error strip if it were added). Right now though, it's hard-coded to re-parse after a fixed time (maybe 2 seconds) from the last edit. I'd like to make this configurable so that you can make it run only at specified times (such as saving changes, etc.), so you can hook the running of an external compiler into it and get your errors from that.

Which way to you want to go with it? I can set up a feature request either way so I don't forget about it :)
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: Addition to RScrollPane

Postby dmeers » Fri Feb 06, 2009 3:06 pm

The row headers would work just fine, I think. As for the errors, I don't think I have a preference here. Right now all my users get is a Message window with the error in it, so any other way would be a big improvement.
dmeers
 

Re: Addition to RScrollPane

Postby robert » Sat Feb 07, 2009 4:22 pm

Okay, I added a tracker on SourceForge for the row header and another for the error strip. The row header would be higher priority of course, as I think it would be more useful.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: Addition to RScrollPane

Postby robert » Tue Feb 17, 2009 12:15 am

Just an FYI that this functionality has been added in revision 76 in SVN, although it's still preliminary and will be fleshed out (and may change some).

It's a new API for displaying icons next to lines in the line numbering row header in RTextScrollPane. As I said earlier, this probably isn't robust enough for most real-world use cases yet, but feel free to play with it and provide suggestions:

java code:

// Puts an icon beside the specified line number.  Throws BadLocationException if line is invalid.
// Object returned is a tag used to reference this icon later, similar to Swing's Highlighter class.
Object RTextScrollPane.addLineTrackingIcon(int line, Icon icon)

// Same as addLineTrackingIcon, but allows you to specify an offset into the document instead of
// a line number. This is handy if your icon is actually tracking some text in the document, such as
// a compiler error, and not just a line. The icon is added to the line containing the offset.
Object RTextScrollPane.addOffsetTrackingIcon(int offset, Icon icon)

// Removes an icon added earlier. tag is the Object returned by addLineTrackingIcon
void removeTrackingIcon(Object tag)

// Clears all previously added tracking icons
void removeAllTrackingIcons()

// Toggles whether any icons added to the row header are visible.
void setIconRowHeaderEnabled(boolean enabled)
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: Addition to RScrollPane

Postby dmeers » Mon Feb 23, 2009 10:24 pm

I did start to work with the latest download of RSyntaxTextArea. I did find an issue with NetBeans, though. The new Gutter class got an NPE. I think it is because when NetBeans creates the RScrollPane, it uses the default constructor and RScrollPane then constructs itself with the intial TextArea being NULL. I don't think the Gutter class likes having 'NULL' passed in for the TextArea.

Dennis Meers
dmeers
 

Re: Addition to RScrollPane

Postby dmeers » Mon Feb 23, 2009 10:57 pm

I did start to work with the latest download of RSyntaxTextArea. I did find an issue with NetBeans, though. The new Gutter class got an NPE. I think it is because when NetBeans creates the RScrollPane, it uses the default constructor and RScrollPane then constructs itself with the intial TextArea being NULL. I don't think the Gutter class likes having 'NULL' passed in for the TextArea.

Dennis Meers
dmeers
 

Re: Addition to RScrollPane

Postby robert » Tue Feb 24, 2009 4:35 am

You're right. Even though I don't use NetBeans, I really should try changes out in Matisse before releasing them. :D

Try grabbing revision 87 from SVN. I could get an RTextScrollPane with an RSTA in it going with the changes. Let me know if you have any issues.

I'm planning on a 1.3.1 release that "officially" fixes issues like this one as they trickle in.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: Addition to RScrollPane

Postby phaniram » Wed Apr 11, 2012 12:31 pm

I'm using rsyntaxtextarea , i've added it to Netbeans palette, here it has two components,

An RSyntaxTextArea is the main text editor class. It extends JTextArea, so it has all the standard methods you'd expect from a Swing text component, plus more specific to handling syntax highlighting.

An RTextScrollPane is an extension of JScrollPane that supports line numbers. You can use a standard JScrollPane if you want, but when editing source code, it is often nice to have line numbering enabled.

I can actually add RSyntaxTextArea by dragging and dropping it from palette, but i cannot do that for RTextScrollPane (it is necessary for RSyntaxTextArea to feel better than existing scroll panel). The error message says that the component cannot be instantiated and that you should make sure it is a JavaBean

How can i add these two components in netbeans through drag & drop ?

i've added it through tools->palette->Swing/AWT Components

even if i've added it to palette, i can't add it through drag & drop, i've added RSyntaxTextArea though, even i've added RTextScrollPane through custom code in it, but i couldn't see that in Inspector or in Application ....i donno what to do

In previous post as u said it's fixed, i donno if i'm doing anything wrong in here...........


thanks in advance
phaniram
 
Posts: 3
Joined: Wed Apr 11, 2012 12:02 pm

Re: Addition to RScrollPane

Postby robert » Fri Apr 13, 2012 1:18 pm

Hi phaniram,

I personally don't use NetBeans, and the last time I tried this out it seemed a little cranky (though maybe i just didn't know what I was doing), but I do want RSTA to work in Matisse. I'll try to take a look soon and if it's unusable in the GUI builder, get it fixed for the next release.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Next

Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron