[tasklist] Re: Line.getDataObject()

Jaroslav Tulach <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.tasklist.devel
Message-ID <[email protected]>
Hi Tor.
I guess the problem 32210 shall be fixable by my changes, but on the 
other hand, it is hard to expect that every EditorCookie will be 
attached to a DataObject.

Right now the Line has constructor taking Lookup. If the creator of the 
line passed Lookup containing DataObject into its line, then 
DataEditorSupport.findDataObject(line) would work. Obvisously it does 
not do that and very likely there is no way to do it now (it is package 
private, sorry).

Here are the steps to solve 32210:

1. we need a way how CloneableEditorSupport subclass will pass a Lookup 
to all its lines. I suggest new constructor taking the Lookup. Then all 
lines will return this lookup. I have created 
http://openide.netbeans.org/issues/show_bug.cgi?id=32937

2. PropertiesEditorSupports have to be modified to add the DataObject 
into their Lookup. I do not know if they want to do that.

yarda



Tor Norbye wrote:
> Hi there,
> somebody (Yarda or Jesse, I can't remember) recently committed
> a change to the tasklist module where they substituted
>    line.getDataObject()
> with
>    DataEditorSupport.findDataObject(line)
> 
> I thought "great!". That will fix the big problem that's been
> bothering me for a while, so I don't have to write to dev@tasklist
> about it!
> 
> Tonight I replaced all the remaining line.getDataObject() calls
> in tasklist with the new form.
> 
> But - turns out the problem is still there.
> 
> The problem I'm referring to is 
>   http://www.netbeans.org/issues/show_bug.cgi?id=32210
>   Line.getDataObject sometimes returns null
> 
> Here's the problem. I have a data object. I know the line
> number. I look up the Line object for it. And I store
> that Line object with each suggestion.
> 
> Then, in the tree table, I want to display the original
> file name and line number. So I just ask for the
> data object (to get the filename via primaryfile),
> and I ask line to provide its line number.
> 
> The problem is that, for Bundle.properties files in 
> particular, Line.getDataObject returns null.
> 
> Sooooo.... unless you can think of a better solution,
> we need to not only keep a Line reference with
> each Suggestion object, but a DataObject reference
> as well.
> 
> Or will this situation be fixed now with the data system
> rewrite?
> 
> -- Tor
> 
> 
> --  
> Tor Norbye <[email protected]>
> Sun Microsystems, Inc
> 

-- 
/**
* @author Jaroslav Tulach
* @see http://www.netbeans.org
*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.