Summary: | Quickfix modifies Read-Only files | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Eric Lamontagne <DogbertTheRuler> | ||||
Component: | UI | Assignee: | Dirk Baeumer <dirk_baeumer> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | critical | ||||||
Priority: | P1 | ||||||
Version: | 2.0 | ||||||
Target Milestone: | 2.0 F4 | ||||||
Hardware: | PC | ||||||
OS: | Windows 2000 | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Eric Lamontagne
2002-06-12 23:16:02 EDT
This only happens when clicking on the light bulp. Ctrl+1 is diabled for read only files. We should disable clicking on the light bulp in this case as well. Low risk to fix. Candidate for F4 increased priority consequences if not fixed: a modified read-only file cannot be saved and is a serious problem. Fix is simple. Enclosed the patch that fixes the problem Index: JavaSelectMarkerRulerAction.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor /JavaSelectMarkerRulerAction.java,v retrieving revision 1.1 diff -u -r1.1 JavaSelectMarkerRulerAction.java --- JavaSelectMarkerRulerAction.java 1 Jun 2002 09:58:56 -0000 1.1 +++ JavaSelectMarkerRulerAction.java 17 Jun 2002 09:37:34 -0000 @@ -24,6 +24,7 @@ import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel; import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ITextEditorExtension; import org.eclipse.ui.texteditor.MarkerUtilities; import org.eclipse.ui.texteditor.SelectMarkerRulerAction; @@ -66,6 +67,13 @@ } public void update() { + // Begin Fix for http://dev.eclipse.org/bugs/show_bug.cgi? id=20114 + if (fMyTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fMyTextEditor).isEditorInputReadOnly()) { + fPosition= null; + super.update(); + return; + } + // End Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20114 fPosition= getProblemPosition(); if (fPosition != null) setEnabled(true); Created attachment 1446 [details]
Patch that fixes the problem
Shouldn't it call validateEdit() and rely on that, instead of just not doing anything for read-only? This way a quick fix to a Clearcase controlled file (not checked out, read-only) will do the right thing. That is, it should be behaviourly equivalent to typing the quick-fix inserted text at the keyboard. For 2.0, all text modification actions are disabled on read-only files. Post 2.0, we need to ensure that validateEdit is called. This requires a broader architectural approach than the one we've taken so far. First review by Daniel Megert Final fix is // Begin Fix for http://dev.eclipse.org/bugs/show_bug.cgi? id=20114 if (!(fMyTextEditor instanceof ITextEditorExtension) || ((ITextEditorExtension)fMyTextEditor).isEditorInputReadOnly()) { fPosition= null; super.update(); return; } // End Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20114 Second review by Martin Aeschliemann Third review by Adam Kiezun since code got changed in second review. |