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 81214

Summary: EditorCookie.Observable.PROP_DOCUMENT listeners have no chance to find out whether the document is loaded or closed
Product: platform Reporter: Peter Zavadsky <pzavadsky>
Component: TextAssignee: Petr Nejedly <pnejedly>
Status: RESOLVED FIXED    
Severity: blocker CC: jtulach, markdey, pjiricka, sandipchitale, wjprakash
Priority: P2    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 78597    
Attachments: Suggested diff of fix (taken from 4.1 but also applicable to 5.5)
Probably better fix to suggest

Description Peter Zavadsky 2006-07-27 01:05:11 UTC
The listeners listening on EditorCookie.Observable.PROP_DOCUMENT property have
no chance to find out whether the document was loaded or closed.

The proeprty change old and new values are both null.

And if they try to find out from EditorCookie.getDocument(), then they alwys get
non-null value, because for the case when document was loaded it is fired after
the variable was assigned, and for the latter case it is fired before the doc
variable is nullified.

See the attachment for suggested fix, so the listeners can find out what is
going on.
Comment 1 Peter Zavadsky 2006-07-27 01:06:12 UTC
Created attachment 32248 [details]
Suggested diff of fix (taken from 4.1 but also applicable to 5.5)
Comment 2 Peter Zavadsky 2006-07-27 01:10:00 UTC
Created attachment 32249 [details]
Probably better fix to suggest
Comment 3 Peter Zavadsky 2006-07-27 21:13:54 UTC
Adjusting version. It is also in 5.5.
Comment 4 Petr Nejedly 2006-07-31 09:54:27 UTC
openide/text/src/org/openide/text/CloneableEditorSupport.java,v1.22
Comment 5 _ sandipchitale 2006-09-01 00:24:20 UTC
Looks like the fix is not there in 5.5 branch. Will it be possible to fix this 
in NB 5.5? This is a blocking issue for 
Creator Pack (Shortfin).
Comment 6 Petr Nejedly 2006-09-01 09:09:30 UTC
Keep this fixed(Dev). I added 5.5_candidate keyword.
While the fix is not really 100% compatible, I believe it is OK to backport it
to 5.5
Comment 7 Winston Prakash 2006-09-01 14:44:28 UTC
I hope this will get fixed in 5.5. Creator source modeler depends on this event
for setting its state. Because of this spurious event, source modeler thinks the
Document is closed (even though it is not) tries to set its internal state
erraneously and on the process corrupts the model and results in project being
getting corrupted. So it is a real blocker for Creator pack.

  
Comment 8 Petr Nejedly 2006-09-05 16:32:07 UTC
Integrated into release55:
openide/text/src/org/openide/text/CloneableEditorSupport.java,v1.6.6.1.2.2