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.
Having a possibility to detect to which FoldOperation an instance of Fold belongs to, resp. which FoldManager created the Fold would easy usecases when there are more FoldManager implementations bound to one mimetype. Currently the problem can be partially solved by using Fold.getFoldType() which however returns an instance of final class so no class instance resolution can be used. The problem gets worser in case of a generic FoldManager implementation like Schlieman has which creates the FoldType-s based on some external metadata. The only generic way I found is: Fold f = fold.getFold (i); try { operation.getExtraInfo(f); //no ISE thrown - my fold l.add (f.getType()); } catch (IllegalStateException e) { //not my fold } If for example getExtraInfo() is called on fold which wasn't created by this FoldManager, the ISE it thrown, so I know that this is not my fold. This solution is IMHO no elegant enought, I would expect something like: Fold.isCreatedBy(FoldOperation) or somethin similar.
Marku, how important is fixing this issue? Does it block other issues? It's likely to require a small API change. Using exceptions for flow control is an antipattern we should avoid of course. Feel free to make it P2 if it's important to fix it soon.
It would be nice if resolved to the upcoming beta, or at least to final release. Not critical.
I've implemented FoldOperation.owns(Fold). Diff attached. Marku if you need it into 6.1 please raise the priority. Thanks.
Created attachment 57677 [details] Patch adding FoldOperation.owns(Fold)
So far it looks like I do not really need it. So if it takes too much of your time now we can put it off to 6.next. The patch look fine to me.
No, I have it prepared on disk so I just commit it. http://hg.netbeans.org/main?cmd=changeset;node=3fc9a480f2f3