Bug 349673

Summary: Provide a way to make external files writable
Product: [Eclipse Project] Platform Reporter: Marko Tomljenovic <marko.tomljenovic>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.kell.r, prakash, pwebster
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Marko Tomljenovic CLA 2011-06-17 07:23:20 EDT
Build Identifier: 3.6.2

When an external files is opened within Eclipse (either through DND or through the File->Open menu) and this file is read only it cannot be changed ( inside the text, xml editor) and there is also no possibility within eclipse to change the read-only state of the file.
What I would expect is that it behaves the same way as with internal files that are opened.

Reproducible: Always
Comment 1 Prakash Rangaraj CLA 2011-06-17 10:14:25 EDT
I guess this goes to Platform Text. Please move back if not.
Comment 2 Marko Tomljenovic CLA 2011-06-17 10:26:10 EDT
The following classes are used when an external file is opened in Eclipse:

1. OpenLocalFileAction.run() (when a file is opened using the File->Open menu)
2. EditorAreaDropAdapter.asyncDrop() (when a file is dnded on the editor area)

Both are calling IDE.openEditorOnFileStore() 

Maybe before opening the file a dialog could be shown where the user can decide to make the files writable before opening them.
Comment 3 Markus Keller CLA 2011-06-20 11:08:42 EDT
> Maybe before opening the file a dialog could be shown where the user can decide
> to make the files writable before opening them.

Better workflow is to only ask when the user actually tries to modify the document (like with read-only internal files).
Comment 4 Marko Tomljenovic CLA 2011-06-21 01:46:32 EDT
(In reply to comment #3)
> > Maybe before opening the file a dialog could be shown where the user can decide
> > to make the files writable before opening them.
> 
> Better workflow is to only ask when the user actually tries to modify the
> document (like with read-only internal files).

You are right. But this has to be implemented by each editor (base class). The first solution is independent of any editor type.

And normally does a user know whether he wants to edit a file before opening it.
Comment 5 Marko Tomljenovic CLA 2011-06-21 02:20:44 EDT
After digging inside the code your proposed solution will become quite complex to realise since the read-only check is done by the DefaultUIFileModificationValidator class. And this class (its super class FileModificationValidator) is used in a lot of places and uses only IFile.
Comment 6 Dani Megert CLA 2011-06-21 02:33:50 EDT
We will not invent a new workflow.
Comment 7 Marko Tomljenovic CLA 2011-06-21 02:38:05 EDT
(In reply to comment #6)
> We will not invent a new workflow.

Ok. I can understand that. For my proposed solution I could provide a patch. Unfortunately my understanding of the eclipse platform is not good enough to provide a patch for the final solution. :)
Comment 8 Dani Megert CLA 2011-11-15 05:46:56 EST
Deepak, in addition to what Markus suggested in comment 3 we could go with bug 66970.