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 - EditorCookie.Observable.PROP_DOCUMENT listeners have no chance to find out whether the document is loaded or closed
Summary: EditorCookie.Observable.PROP_DOCUMENT listeners have no chance to find out wh...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords:
Depends on:
Blocks: 78597
  Show dependency tree
 
Reported: 2006-07-27 01:05 UTC by Peter Zavadsky
Modified: 2008-12-22 19:44 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Suggested diff of fix (taken from 4.1 but also applicable to 5.5) (867 bytes, patch)
2006-07-27 01:06 UTC, Peter Zavadsky
Details | Diff
Probably better fix to suggest (923 bytes, patch)
2006-07-27 01:10 UTC, Peter Zavadsky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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