-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content Proposal Dialog Reopens if ENTER is used for ContentProposalAdapter's KeyStroke in RWT #54
Labels
bug
Something isn't working
Comments
Snippet to reproduce the issue: package main;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalListener;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.rap.rwt.application.AbstractEntryPoint;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@SuppressWarnings({ "javadoc", "serial" })
public class Snippet extends AbstractEntryPoint
{
@Override
protected void createContents(Composite parent)
{
new Label(parent, SWT.NONE).setText("Content Proposal KeyStroke = ENTER"); //$NON-NLS-1$
Text enterTextField = new Text(parent, SWT.BORDER);
ContentProposalAdapter enterContentProposalAdapter = new ContentProposalAdapter(enterTextField,
new TextContentAdapter(), new SnippetContentProposalProvider(), KeyStroke.getInstance(SWT.CR), null);
enterContentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);
enterContentProposalAdapter.addContentProposalListener(new SnippetContentProposalListener());
new Label(parent, SWT.NONE).setText("Content Proposal KeyStroke = HOME"); //$NON-NLS-1$
Text escTextField = new Text(parent, SWT.BORDER);
ContentProposalAdapter escContentProposalAdapter = new ContentProposalAdapter(escTextField,
new TextContentAdapter(), new SnippetContentProposalProvider(), KeyStroke.getInstance(SWT.HOME), null);
escContentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);
escContentProposalAdapter.addContentProposalListener(new SnippetContentProposalListener());
}
private class SnippetContentProposalProvider implements IContentProposalProvider
{
public IContentProposal[] getProposals(String contents, int position)
{
return new SnippetContentProposal[] { new SnippetContentProposal("Proposal A"), //$NON-NLS-1$
new SnippetContentProposal("Proposal B"), new SnippetContentProposal("Proposal C") }; //$NON-NLS-1$ //$NON-NLS-2$
}
}
private class SnippetContentProposal implements IContentProposal
{
private final String label;
public SnippetContentProposal(String label)
{
this.label = label;
}
public String getContent()
{
return null;
}
public int getCursorPosition()
{
return 0;
}
public String getLabel()
{
return label;
}
public String getDescription()
{
return null;
}
}
private class SnippetContentProposalListener implements IContentProposalListener
{
public void proposalAccepted(IContentProposal proposal)
{
System.out.println("Proposal Accepted: " + ((SnippetContentProposal)proposal).getLabel()); //$NON-NLS-1$
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved from Bug 580712.
Content Proposal Dialog Reopens if
ENTER
is used forContentProposalAdapter
's KeyStroke in RWTSummary
In our solution, we're using a text field paired with a
ContentProposalAdapter
. Then keystroke to activate theContentProposalAdapter
isENTER
. In our SWT application the process of hittingENTER
and selecting a proposal works without any issue. However in RWT, the problem is that onceENTER
is used to select a proposal, the proposal pop-up opens again.Possibly similar issue: Bug 445464 - ContentProposalAdapter proposals popup stays visible if Combo is used as a control
Steps to Recreate Issue
Run the attached snippet as an RWT application
"Content Proposal KeyStroke = ENTER"
, hitENTER
ENTER
Expected: Content Proposal Dialog closes
Actual: Content Proposal Dialog reopens
NOTE: I've also added another field titled "Content Proposal KeyStroke = HOME" to demonstrate that this workflow works fine if the Content Proposal keystroke is set to anything else. This would indicate that the issue is around enter being used both by the
ContentProposalAdapter
and selecting items in the proposal pop-up.The text was updated successfully, but these errors were encountered: