[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] AbstractTextEditor.isEditable() returns true on read-only files
|
- From: jbognar@xxxxxxxxxx (James Bognar)
- Date: 10 Sep 2001 17:31:59 GMT
- Newsgroups: eclipse.tools
- Organization: http://www.eclipse.org
- User-agent: NewsPortal 0.23
I've noticed a change in behavior between the 129 and 135 drops in
AbstractTextEditor. I have java source files in my workspace which are
supposed to be read-only and uneditable. In the 129 drop, when I set the
IFile object to read-only, the Java Editor would not allow the user to
modify the contents of the file, and this was the behavior I wanted. Now
in 135, the user DOES have the ability to change the contents, even if the
file is read-only (although the user still isn't allowed to save the
modified contents).
Here are the relevant lines that were changed in
AbstractTextEditor.isEditable():
WAS:
IStorage storage= storageInput.getStorage();
return (storage != null && !storage.isReadOnly());
IS:
IStorage storage= storageInput.getStorage();
return (storage != null && (storageInput instanceof IFileEditorInput ||
!storage.isReadOnly()));
Why the change? And is there any way to make the file uneditable again?
Also, why do we prompt a user with a 'Save Resource' dialog box when
closing an editor on a read-only file?
And the error dialog box that is displayed when a user tries to save a
read-only file could probably look a little better. Right now the dialog
box makes it look like there is a bug in Eclipse (contains the words 'Core
Exception'), instead of looking like a user error.
Thanx.