[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: AbstractTextEditor.isEditable() returns true on read-only files
|
As long as the workbench doesn't allow me to overwrite a file that is read
only, I agree that it should be allowed to edit a readonly file. However, it
should be possible to configure the workbench to warn/ask me if it's OK to
edit the readonly file. I might intend to 'Save As..', I might intend to
check the file out before saving, or, I might not want to start at all.
One danger, particularly with CVS, is that a check out might change the file
on disk, and the workbench has no way of being notified of that. Perhaps on
start of edit, it could check the last write time of the file?
"erich gamma" <erich_gamma@xxxxxxx> wrote in message
news:9nj71j$eq1$1@xxxxxxxxxxxxxxxx
> There were different reasons for this change:
>
> * make the read-only treatment of the eclipse
> more consistent with
> other editors. Most editors allow you to edit a
> file even when it is read-only on disk.
>
> * versioning systems are using the read-only state
> to indicate that a file is not checked out.
> Consider the following scenario:
> 1) the user opens a read-only file in an editor
> 2) decides to check it out the file in the file system
> (file is changed to read-write).
> ->the user has to close and reopen the editor to be
> able to change the file.
>
> --erich
>
> James Bognar wrote:
>
> > 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.
>
>
>
>
>