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 9666 - regression: can't find column and line numbers
Summary: regression: can't find column and line numbers
Status: CLOSED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-02-17 00:43 UTC by Rochelle Raccah
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rochelle Raccah 2001-02-17 00:43:10 UTC
Before the java re-factoring, I was able to create ErrorEvents with line and
column info for my post-compile step:

Assuming I had an org.openide.src.Element element and JavaEditor, editor:
javax.swing.text.Element textElement = 
	editor.sourceToText((Element)element);

if (textElement != null)
{
	StyledDocument document = findDocument(editor);

	if (document != null)
	{
		int offset = textElement.getStartOffset();

		line = NbDocument.findLineNumber(document, offset) + 1;
		column = NbDocument.findLineColumn(document, offset) + 1;
	}
}

After the refactoring, textElement is always null.
Comment 1 Svata Dedic 2001-02-19 09:18:34 UTC
You are using undocumented implementation detail of the java module. You should use org.openide.cookies.SourceCookie.Editor.sourceToText() for the purposes you describe. That cookie was previously implemented directly on JavaEditor class, but in the current implementation it is provided from other source.
Just ask the DataObject, or whatever Element for SourceCookie.Editor cookie and use the result instead of calling JavaEditor directly.
I'll deprecate the obsolete methods.
Comment 2 Quality Engineering 2003-07-01 13:12:51 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 3 Quality Engineering 2003-07-01 13:18:12 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.