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.
There is needed to enhance CloneableEditorSupport to reflect read only state, and allow subclasses to alter it. Ideally it would be the CloneableEditorSupport.Env to have isReadOnly method. But that's not possible to do so easy. Thus suggest to enhance the CloneableEditorSupport itself to add: protected isEnvReadOnly() It would be used to determine when save or close operation is tried on the read-only doc (issue #24462) and also to handle the enabling disabling sys actions (Cut, Delete, Paste) -> issue #25737. Yarda, approve(disapprove)&comment and reassign back to me.
I remember a request to have two components open one of them in read-only state, second in read-write. If that is what we want to also solve, I suggest to add new constructor for CloneableEditor, so the creator can initialize the editor in the right state in CES.createCloneableEditor method: new CloneableEditor (this, false); this should cover most of the usecases. If there is a need to switch the state of editor, I would add protected final CloneableEditor.setReadOnly (boolean state) which could be used to change the state of the editor after creation (but only for subclassers).
Acceptable?
I think the diff status of components is an obscure idea. To support one read-only and second read-write component from the same support instance is not so easy possible with our current implementation. What should show the read-only component, while somebody else changes the read-write one? Should also show the changes or not? 1) Yes. I think is obscure then, (why it is read-only?) 2) No. In that case not only read-only status should be distributed to the components, but also modification status, and then also document (???, at least the read-only would have some unchangeable copy of the original one) , that sounds even more obscure now. Moreover I guess there is still needed the property for the env which will say that the object providing document is read-only (doesn't matter whether there are diff statuses of components or not). What do you think?
reassigne to David K., new owner of editor
I have changed version from 4.0 dev to S1S 4.2 (Nevada).
ENHANCEMENT, not DEFECT, I think...
Yes.
*** Issue 35303 has been marked as a duplicate of this issue. ***
See also issue 35303. The Delete, Paste and other modification actions cannot be disabled/enabled when readonly state has changed.
Reassigning to new module owner mslama.
Would still be useful, I think. Currently the most visible indication of r/o status, the special background, is hardcoded in org.netbeans.modules.editor.lib2.highlighting.ReadOnlyFilesHighlighting to check FileObject.canWrite, which prevents it from being used on non-file-backed editors. Would make sense for CES.Env to have an optional subinterface (to be implemented by DataEditorSupport.Env) checking read-only status. ReadOnlyFilesHighlighting would need to somehow get this information from the Document, I suppose via a documented Boolean-type property.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/a031261a055d User: Jesse Glick <jglick@netbeans.org> Log: Removing unused package-private method (#25762 stub).