This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 15920 - Shared "error" annotation
Summary: Shared "error" annotation
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords: API, UI
Depends on:
Blocks: 21748 24403
  Show dependency tree
 
Reported: 2001-09-26 11:53 UTC by David Konecny
Modified: 2010-01-12 05:20 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Konecny 2001-09-26 11:53:47 UTC
Excerpt from email from jglick:
----------------------------------------------------------------------
In an issue relating to documentation of annotations:

http://www.netbeans.org/issues/show_bug.cgi?id=14424

I balked for a while before understanding that every module was, in fact,
supposed to define its own annotations, and that the API defines none. In
the
case of error annotations this seems somewhat odd, since the old and now
deprecated API provides this functionality.

After a while I did implement special annotations for the Ant module, but
it
was not trivial and I would hate to do it again. "Current" and "breakpoint"
are clearly debugger notions, but "error" is pretty general. Most of the
time
you want things to behave like this:

- a line with a hyperlink is displayed in the Output Window

- the source, if open, gets an annotation (red X perhaps?) at a
corresponding
place, with some tool tip listing the error message

- the OW line if selected, moves an open display to that line; if
double-clicked, forcibly opens and fronts it, also displaying the error in
the
status bar

- the line in the editor, if edited by the user, is cleared of its
annotation
(i.e. the error was possibly corrected)

- if the OW tab is closed, the annotation goes away

All of this functionality is cumbersome to reimplement every time, since it
is
pretty standard stuff. I would suggest some standard implementation (in
org.openidex.text maybe?) that would:

- define the annotation type in a layer, with a known name, and a
reasonable
glyph and color selection (red)

- provide a Java API something like this:

public abstract class ErrorAnnotation extends Annotation implements
OutputListener {
    public ErrorAnnotation();
    /** the error message to show in tooltip and status bar */
    protected abstract String error();
    /** could be a Line or Line.Part */
    protected abstract Annotatable line() throws IOException;
    // now impl all abstract methods of Annotation and OutputListener,
    // all final
}

Maybe it also needs to ask subclasses for a Document, or maybe you should
give
only a Document and a line number (assuming it will use
Line.getOriginal()),
or something like this.

You could use it by printing a line to the Output Window with it as a
listener. Then when clicked it would attach itself.

Does it sound useful? Please take a look at
org.apache.tools.ant.module.run.OutputWriterOutputStream.Hyperlink by way
of
comparison.
----------------------------------------------------------------------
Right now the error annotation, its handling, etc. is done in three different places.
Some generic solution should be created to prevent duplication of code.
Comment 1 Jesse Glick 2002-05-31 15:30:42 UTC
LayerDataNode in apisupport could use this too.
Comment 2 Marian Mirilovic 2002-12-06 17:17:52 UTC
reassigne to David K., new owner of editor
Comment 3 David Konecny 2003-04-30 11:13:55 UTC
Changing TM to FUTURE. This issue is not planned for next version.
Feel free to disagree.
Comment 4 Antonin Nebuzelsky 2008-04-17 15:14:20 UTC
Reassigning to new module owner mslama.