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

Bug 329370

Summary: [nls tooling] Auto-encoding of unsupported characters in .properties files should also work on Find/Replace
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P4 CC: daniel_megert
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Markus Keller CLA 2010-11-03 12:23:09 EDT
N20101102-2000

The auto-encoding of unsupported characters in .properties files should also work on Find/Replace. This happens when the real character is pasted into the Replace field, and it also happens when I enable regex and e.g. replace with \u2603.
Comment 1 Deepak Azad CLA 2010-11-04 01:32:21 EDT
For typing or pasting you get this call stack

Thread [main] (Suspended (breakpoint at line 63 in PropertiesFileAutoEditStrategy))	
	PropertiesFileAutoEditStrategy.customizeDocumentCommand(IDocument, DocumentCommand) line: 63	
	SourceViewer(TextViewer).customizeDocumentCommand(DocumentCommand) line: 3749	
	SourceViewer(TextViewer).handleVerifyEvent(VerifyEvent) line: 3779	
	TextViewer$TextVerifyListener.verifyText(VerifyEvent) line: 434	
	TypedListener.handleEvent(Event) line: 255	
	EventTable.sendEvent(Event) line: 84	
	StyledText(Widget).sendEvent(Event) line: 1053	
	StyledText(Widget).sendEvent(int, Event, boolean) line: 1077	
	
But in case of Find/replace TypedListener does not get an event. Investigating...
Comment 2 Deepak Azad CLA 2010-11-04 02:45:52 EDT
(In reply to comment #1)
> But in case of Find/replace TypedListener does not get an event.
TypedListener needs to get a SWT.Verify event but it does not. (It gets only SWT.Selection and SWT.Paint event)

The Find/Replace dialog modifies the IDocument (see FindReplaceDocumentAdapter.findReplace(...) line 213), which should modify the underlying StyledText and which should result in a call to StyledText.modifyContent(Event, boolean) - but it does not.
Comment 3 Markus Keller CLA 2010-11-17 10:43:59 EST
(In reply to comment #2)
> > But in case of Find/replace TypedListener does not get an event.
> TypedListener needs to get a SWT.Verify event but it does not. (It gets only
> SWT.Selection and SWT.Paint event)

The current policy is that StyledText only sends Verify events when the modification is initiated by the StyledText. We can't extends this and send events in all cases the underlying content changes externally (that would break many clients that don't expect these events and would e.g. not be complete if the modification occurs in a folded area that is not shown in the StyledText).

The problem is even broader than Find/Replace. E.g. File Search is also affected. Lowering severity and priority, since this has not been an issue in practice so far.