Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 20160 - restore from local history ignore read-only flag [compare]
Summary: restore from local history ignore read-only flag [compare]
Status: RESOLVED DUPLICATE of bug 23808
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-13 09:41 EDT by Adam Kiezun CLA
Modified: 2002-09-19 03:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2002-06-13 09:41:06 EDT
F3
a. create a CU with 2 top-level classes
b. save
c. delete one class
d. save
e. make the file read-only
f. select it and 'restore from resource history'

it does add the other class

marking as major - all our actions try not to modify read-only files
Comment 1 Adam Kiezun CLA 2002-06-13 09:41:42 EDT
definitely major - 'revert' is not there on read only files
Comment 2 Dirk Baeumer CLA 2002-06-13 09:54:45 EDT
Works correctly in the editor's context menu (e.g. is disabled).
Comment 3 Adam Kiezun CLA 2002-06-13 10:09:23 EDT
not for me - i see it enabled

i tried it again and got this:

java.lang.reflect.InvocationTargetException: Java Model Exception: Java Model 
Status [AllTEsts.java is read-only.]
at org.eclipse.jdt.internal.core.Openable.save(Openable.java:448)
at org.eclipse.jdt.internal.core.CommitWorkingCopyOperation.executeOperation
(CommitWorkingCopyOperation.java:116)
at org.eclipse.jdt.internal.core.JavaModelOperation.execute
(JavaModelOperation.java:305)
at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:513)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1361)
at org.eclipse.jdt.internal.core.JavaModelManager.runOperation
(JavaModelManager.java:1212)
at org.eclipse.jdt.internal.core.JavaElement.runOperation(JavaElement.java:574)
at org.eclipse.jdt.internal.core.WorkingCopy.commit(WorkingCopy.java:83)
at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.doSaveDoc
ument(CompilationUnitDocumentProvider.java:914)
at org.eclipse.ui.texteditor.AbstractDocumentProvider.saveDocument
(AbstractDocumentProvider.java:428)
at org.eclipse.jdt.internal.corext.textmanipulation.TextBufferFactory$1.run
(TextBufferFactory.java:115)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1361)
at 
org.eclipse.jdt.internal.corext.textmanipulation.TextBufferFactory.commitChanges
(TextBufferFactory.java:119)
at org.eclipse.jdt.internal.corext.textmanipulation.TextBuffer.commitChanges
(TextBuffer.java:375)
at org.eclipse.jdt.internal.ui.compare.JavaAddElementFromHistory$1.run
(JavaAddElementFromHistory.java:165)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run
(ModalContext.java:98)
Comment 4 Adam Kiezun CLA 2002-06-13 10:10:39 EDT
sorry, forgot
it's the package explorer's context menu
Comment 5 Adam Kiezun CLA 2002-06-13 10:17:35 EDT
hey i know how to make it happen for every action:

1. have a writable cu with a class
2. open it in the editor and reveal in the package explorer
3. go to the outliner and open the context menu
4. go to the package explorer and make the file read only
5. (careful not to change the selection in the outliner!) open  the context 
menu in the outliner - all source actions are there!
Comment 6 Adam Kiezun CLA 2002-06-14 11:37:22 EDT
i opened a separate report for this
see bug 20353
Comment 7 Dirk Baeumer CLA 2002-09-19 03:20:37 EDT

*** This bug has been marked as a duplicate of 23808 ***