Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 265466 - [FieldAssist] Paste into text control does not trigger activation
Summary: [FieldAssist] Paste into text control does not trigger activation
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 275393
Blocks:
  Show dependency tree
 
Reported: 2009-02-19 09:36 EST by Ben Vitale CLA
Modified: 2019-11-14 02:12 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Vitale CLA 2009-02-19 09:36:20 EST
Build ID: M20080911-1700

Steps To Reproduce:
1. Setup a Text widget with a ContentProposalAdapter. Constructor used: (text, adapter, null, null, null);
2. Paste text into the widget using Ctrl-V or right-click and paste.


More information:
Pasting text does not trigger the auto-activation that I would get by typing the same text into the widget. It appears that the "watchModify" flag in the implementation is not getting set, so the Modify event being triggered by the paste is being ignored.

If this is by design, feel free to close the bug. Or any workaround would be welcomed.
Comment 1 Remy Suen CLA 2009-02-19 10:45:13 EST
Ben, the code below works fine for me on M20080911-1700 and I20090217-2200. Can you modify the snippet so that it fails?

------------------

Display display= new Display();
Shell shell= new Shell(display);
shell.setLayout(new FillLayout());

Text text = new Text(shell, SWT.SINGLE);

ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), null, null, null);
adapter.setContentProposalProvider(new IContentProposalProvider(){

	public IContentProposal[] getProposals(String contents, int position) {
		return new IContentProposal[] {
			new IContentProposal(){
			
				public String getLabel() {
					return "label"; //$NON-NLS-1$
				}
			
				public String getDescription() {
					return "description"; //$NON-NLS-1$
				}
			
				public int getCursorPosition() {
					// TODO Auto-generated method stub
					return 0;
				}
			
				public String getContent() {
					// TODO Auto-generated method stub
					return null;
				}
			}	
		};
	}
});

shell.pack();
shell.open();
while (!shell.isDisposed()) {
	if (!display.readAndDispatch())
		display.sleep();
}
display.dispose();
Comment 2 Ben Vitale CLA 2009-02-19 12:55:43 EST
With your snippet, right click and paste using the popup menu does not trigger activation. Is that expected?

Ctrl+V works for your snippet, but still broken on my code. Going to continue trying to figure the difference. I must be eating an event that the basic example isn't eating.

Thanks
Comment 3 Remy Suen CLA 2009-02-19 12:59:08 EST
(In reply to comment #2)
> With your snippet, right click and paste using the popup menu does not trigger
> activation. Is that expected?

Sorry Ben, I forgot to test that case. It is not working on my computer also and I am running Linux. This may not be a Windows specific issue then.
Comment 4 Remy Suen CLA 2009-02-19 13:02:08 EST
(In reply to comment #2)
> With your snippet, right click and paste using the popup menu does not trigger
> activation. Is that expected?

As to whether it's "expected" or not, someone else may have to comment on this since I'm not familiar with this code.
Comment 5 Remy Suen CLA 2009-02-19 13:38:09 EST
(In reply to comment #0)
> Pasting text does not trigger the auto-activation that I would get by typing
> the same text into the widget. It appears that the "watchModify" flag in the
> implementation is not getting set, so the Modify event being triggered by the
> paste is being ignored.

From debugging and looking at the code's comments, it seems 'watchModify' was introduced to rectify 183650. When code is pasted from the context menu, only an SWT.Modify event is sent so the field stays 'false'.
Comment 6 Ben Vitale CLA 2009-02-19 14:56:43 EST
Looks like my lack of auto-activation from Ctrl+V is because WorkbenchKeyboard is intercepting it. It ultimately causes Text#paste() to get called. What this means is that the 'v' KeyDown never reaches the adapter, so the "watchModify" flag is not set.
Comment 7 Susan McCourt CLA 2009-10-21 20:08:21 EDT
Moving to M4.  We really need to resolve bug 275393 (getting the automated tests working on all platforms) before we would attempt this.  The basic issue is that we want to ignore programmatic changes and honor user changes, and this is a case where a "programmatic" change to the text was initiated by a user event.  However, fooling around with the event flow is tricky and we need to feel confidence in the test suite.
Comment 8 Susan McCourt CLA 2009-11-24 21:26:04 EST
other work taking priority over this...marking 3.6 to keep on radar.
Comment 9 Susan McCourt CLA 2010-04-15 14:53:51 EDT
Removing milestone.
We really need to nail down the automated test suites in order to tackle bugs like this.  Any thoughts in bug 275393 are welcome.
Comment 10 Susan McCourt CLA 2011-04-19 16:51:47 EDT
unassigning bugs without milestones
Comment 11 Lars Vogel CLA 2019-11-14 02:12:58 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.