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 25762

Summary: Enhance CloneableEditorSupport to reflect read-only state
Product: platform Reporter: Peter Zavadsky <pzavadsky>
Component: TextAssignee: issues@editor <issues>
Status: NEW ---    
Severity: blocker CC: jglick, jtulach
Priority: P3 Keywords: API
Version: 3.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 21748    

Description Peter Zavadsky 2002-07-18 09:52:16 UTC
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.
Comment 1 Jaroslav Tulach 2002-07-19 15:05:37 UTC
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).







Comment 2 Jaroslav Tulach 2002-07-19 15:06:06 UTC
Acceptable?
Comment 3 Peter Zavadsky 2002-07-22 14:42:57 UTC
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?
Comment 4 Marian Mirilovic 2002-12-06 17:18:00 UTC
reassigne to David K., new owner of editor
Comment 5 Marian Mirilovic 2003-01-06 10:55:29 UTC
I have changed version from 4.0 dev to S1S 4.2 (Nevada).
Comment 6 Jesse Glick 2003-02-28 17:56:06 UTC
ENHANCEMENT, not DEFECT, I think...
Comment 7 David Konecny 2003-03-07 12:46:50 UTC
Yes.
Comment 8 David Konecny 2003-08-11 12:47:13 UTC
*** Issue 35303 has been marked as a duplicate of this issue. ***
Comment 9 David Konecny 2003-08-11 12:48:35 UTC
See also issue 35303. The Delete, Paste and other modification actions
cannot be disabled/enabled when readonly state has changed.
Comment 10 Antonin Nebuzelsky 2008-04-17 15:14:33 UTC
Reassigning to new module owner mslama.
Comment 11 Jesse Glick 2011-12-16 18:33:47 UTC
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.
Comment 12 Quality Engineering 2011-12-17 16:46:57 UTC
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).