Creating Error Annotations in NetBeans IDE (Part 2)

In yesterday's annotation, the entire line where the error occurred was highlighted. I spent a lot of time and frustration working out how to, instead of the whole line, highlight just the erroneous word itself. In the end, this saved me. I knew I had to use Line.Part somehow, but I didn't know how exactly. And it turns out you can get the part from the line itself, by passing the column and length of the word. Here's the result:

However, what confuses me is that in the XML file that defines the annotation, the type seems irrelevant. Whether I set line or linepart, the linepart annotation above works fine. This seems very strange. To give an idea of what such an XML file looks like, have a look at the verification package in the Wicket module. There editor hints are also provided. It all seems pretty tricky and I'm glad Petr Pisl contributed all that code, because I certainly would not have been able to do it. (I will blog about the annotation DTD soon, in the coming blogs in this series about error annotations.)

Last night Roumen and I had an excellent time with Paris, Marco, Panos, and Panos's wife. We started at a very traditional Greek restaurant, with food and ouzo (for me) and a traditional Greek band singing about love and pain (according to Panos). For me, the highlight of the evening was, definitely, the part where we were all doing the traditional Greek circle dance, with Paris shouting "left!" in my right ear and Roumen attached to my left shoulder as we swept around and around in front of everyone in the restaurant. Another highlight was Marco doing a traditional Greek dance, very passionate and moving. There may have been many more highlights last night, but I discovered that two bottles of ouzo causes a memory leak of several hours, which have been wiped from my hard disk completely. But, anyway, it was really a fantastic evening that I will remember for a long time, apart from the last several deleted hours...

Comments:

Any way by which we could have multi line annotation?

Posted by Rohan on December 03, 2006 at 01:59 AM PST #

You mean that you want every error in a document to be annotated at the same time? That should be possible because that's how it works in the IDE. If you have multiple errors in your code, all the lines where the errors occur are highlighted simultaneously. Or do you mean something different?

Posted by Geertjan on December 03, 2006 at 03:29 AM PST #

No. Let me explain. I hope you remember this tool that I had blogged about The Review Tool. The user selects a line and an annotation is added. But sometimes reviewers need to pass comments on a bunch of lines. I wanted to highlight all the selected lines with a single annotation. But though Netbeans provides an annotation for a single line, as well as part of a line, I did not find anything for a multi line annotation (an annotation that spans across multiple lines) Thanks and Regards, Rohan

Posted by Rohan Ranade on December 04, 2006 at 12:00 AM PST #

I don't think that's possible. The Line class is for a line and the Line.Part is for part of a line. I think you should create an RFE for this in issuezilla.

Posted by Geertjan on December 04, 2006 at 04:33 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today