Community
Participate
Working Groups
In the code editor, whenever Eclipse performs automatic insertion like matching parenthesis or method completion, accessibility infrastructure only sees object:text-caret-moved but no object:text-changed:insert which leaves the idea of the on screen text inside an assistive technology like a screen reader out of sync with reality. I observe this on Linux with GTK + AT-SPI. To reproduce, simply invoke Ctrl+SPACE in a situation where only one possible completion is valid. The newly inserted text appears on screen, but eclipse does not fire any object:text-changed:insert events via ATK. Use accerciser for a quick inspection tool.
Felipe, is there a way for the editor/StyledText to fire such events?
Dani, in this case (auto insert text after control-space), you are not calling StyledText#replaceTextRange or StyledText#insert, are you ? I believe you are changing the model directly. Car, I looked at the code and the API calls that notify the accessible object when the text changes are not called when the text changes happen in the model. For example: st.replaceTextRange(offset, length, "new text"); //notifies accessible object st.getContent().replaceTextRange(offset, length, "new text"); // does not notify accessible object I think all platforms have the same problem.
We don't update the model but call org.eclipse.swt.custom.new TextChangeListener() {...}.textChanged(TextChangedEvent).
(In reply to comment #3) > We don't update the model but call org.eclipse.swt.custom.new > TextChangeListener() {...}.textChanged(TextChangedEvent). I don't understand, textChanged is a event sent by the model when after a text change. The class sending this event is not an implementor of StyledTextContent ? For me: StyledTextContent == text model
(In reply to comment #2) The accessible object is notified of the change in sendModifyEvent(Event event) Are changes to the model supposed to invoke modify listeners?
(In reply to comment #5) > (In reply to comment #2) > The accessible object is notified of the change in sendModifyEvent(Event event) > Are changes to the model supposed to invoke modify listeners? no, it doesn't. I think the fix is to move the code in sendModifyEvent to handleTextChanged and handleTextSet. These two method run a bit before sendModifyEvent, I hope that doesn't cause problems.
Modify event can't be cancelled, so I think it's fine to run the accessible notification code a little before the event is sent, as long as it is after the new text is displayed. Go for it. :)
>I don't understand, textChanged is a event sent by the model when after a text >change. The class sending this event is not an implementor of StyledTextContent >? Yes it is but besides the StyleTextContent we have the document. So, the document (and StyledText) can be changed in two ways (: 1) via StyledText > StyledTextContent.repalceTextRange > document > StyledTextContent.fireTextChang* 2) via document > StyledTextContent.fireTextChang* > StyledText >Go for it. :) Moving to SWT.
I can change the code but I don't have the means to test it. Mario, can you help with the testing ?
import org.eclipse.swt.*; import org.eclipse.swt.custom.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class PR253075 { public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final StyledText text = new StyledText(shell, SWT.V_SCROLL | SWT.H_SCROLL); text.setText("start text"); text.addListener(SWT.KeyDown, new Listener() { public void handleEvent(Event event) { if (event.keyCode == SWT.F1) { text.replaceTextRange(0, 0, "text"); } else if (event.keyCode == SWT.F2) { text.getContent().replaceTextRange(0, 0, "content"); } else if (event.keyCode == SWT.F3) { text.setText("setText"); } else if (event.keyCode == SWT.F4) { text.getContent().setText("content.setText"); } } }); text.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { System.out.println("Modify: " + event.text); } }); shell.setSize(300, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } =-=-=-=-=-=-=- Note, when the user uses F2 or F4 the text changes but no modify event is sent. The accessible object is only notified when the modify event is sent.
Fixed in HEAD > 20090226 Please verify
(In reply to comment #11) > Fixed in HEAD > 20090226 > > Please verify > Testing with orca and build I20090313-0100. Now I can type the following: int abCd; abCctrl+space Orca reads abCd This is great!!