Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325031

Summary: Auto-complete don't work after read-only flag is removed within editor (StructuredTextEditor based editors)
Product: [WebTools] WTP Source Editing Reporter: Andre Albino Pereira <andreptb>
Component: wst.sseAssignee: wst.sse <wst.sse-inbox>
Status: CLOSED DUPLICATE QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: nsand.dev, rakes123, thatnitind
Version: 3.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
StructuredTextEditor patch to make auto-complete work even if read-only flag is removed within editor
none
Patch of StructuredTextEditor to make auto-complete work even if read-only flag is removed within editor none

Description Andre Albino Pereira CLA 2010-09-11 09:26:56 EDT
Build Identifier: 20100617-1415

When managed by a version control system, the files within an eclipse project are usually in a read-only state when not checked-out. If read-only file is opened in a org.eclipse.wst.sse.ui.StructuredTextEditor based editor and you try to edit, a popup shows asking if you want to remove the read-only flag (or do a checkout operation). If confirmed, the auto-complete popup (shown with ctrl+space command) don't work anymore (shows no items). If you close the file and open it again, the auto-complete proposals works. That behavior applies with XML, JSP, HTML and I believe any editors of that nature.

Reproducible: Always

Steps to Reproduce:
1. Open a read-only XML based file (XML, JSP, TAGFILE, HTML, XSD).
2. Edit the file, a popup asking if you want to remove the read-only file appears.
3. Click yes.
4. Press ctrl+space
5. Reopen the file, press ctrl+space again and compare what appeared before the file was reopened.
Comment 1 Andre Albino Pereira CLA 2010-09-11 10:02:18 EDT
Created attachment 178679 [details]
StructuredTextEditor patch to make auto-complete work even if read-only flag is removed within editor

It seems the auto-complete problem is related to a variable managed by org.eclipse.ui.texteditor.AbstractTextEditor that is not updated when the read-only flag removal operation within editor is performed. Forcing AbstractTextEditor.updateState(IEditorInput) to always be executed before AbstractTextEditor.updateStateDependentActions() solves the problem. Note that the proposed approach serves as reference so the problem can be addressed suitably.
Comment 2 Nitin Dahyabhai CLA 2010-09-12 20:10:16 EDT
Comment on attachment 178679 [details]
StructuredTextEditor patch to make auto-complete work even if read-only flag is removed within editor

This "patch" isn't going to work--it's the entire source file!  Additionally, it's had style changes made to the code (always use blocks, refer to fields with 'this.', possibly others) that make it very difficult to find the actual intended change.

Please connect anonymously to our CVS repository on host dev.eclipse.org with repository path /cvsroot/webtools and check out the plug-in folder at sourceediting/plugins/org.eclipse.wst.sse.ui into your workspace.  Making your changes there will allow you to create a patch we can examine and possibly include in a future release.
Comment 3 Andre Albino Pereira CLA 2010-09-13 06:54:40 EDT
Created attachment 178730 [details]
Patch of StructuredTextEditor to make auto-complete work even if read-only flag is removed within editor

My bad for the previous attachment, hope it helps now.
Comment 4 Rakesh CLA 2010-11-04 00:04:26 EDT
This bug is a duplicate of  Bug 281872.
Comment 5 Nick Sandonato CLA 2010-11-08 13:56:21 EST
Thank you very much for your patch, Andre! I think it will address the situation, but I think we have to fix the root of the problem, which is in how the StructuredContentAssistant cleans up its ContentAssistProcessors. We'll be tracking this change through Bug 281872.

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