上述場景在3.7.0中工作。我不知道3.4.0
樣本測試代碼:
public class ContentProposalTest {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
IContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[]{"Test","Test1","Test2","Test4"});
Control text = new Text(shell, SWT.BORDER);
ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), proposalProvider, null, null);
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
我會試一試並回複評論:) –