本文整理汇总了Java中org.eclipse.jface.fieldassist.SimpleContentProposalProvider类的典型用法代码示例。如果您正苦于以下问题:Java SimpleContentProposalProvider类的具体用法?Java SimpleContentProposalProvider怎么用?Java SimpleContentProposalProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleContentProposalProvider类属于org.eclipse.jface.fieldassist包,在下文中一共展示了SimpleContentProposalProvider类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProviderForProject
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
/**
* Returns a source folder proposal provider for the given project.
*
* @param contextProject
* The project to look for source folders
* @return The provider
*/
public IContentProposalProvider createProviderForProject(IProject contextProject) {
if (null == contextProject) {
return null;
}
IN4JSProject n4Project = StreamSupport.stream(n4jsCore.findAllProjects().spliterator(), false)
.filter(project -> project.getProjectId().equals(contextProject.getName())) // Filter for the context
// project
.findAny().orElse(null);
if (n4Project == null) {
return null;
}
SimpleContentProposalProvider provider = new SimpleContentProposalProvider(
n4Project.getSourceContainers().stream()
.map(src -> src.getRelativeLocation())
.toArray(String[]::new));
provider.setFiltering(true);
return provider;
}
示例2: TrpAutoCompleteField
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
public TrpAutoCompleteField(Control control, IControlContentAdapter controlContentAdapter, String[] proposals,
KeyStroke keyStroke, char[] autoActivationCharacters)
{
assert(proposals != null);
this.proposals = proposals;
proposalProvider = new SimpleContentProposalProvider(proposals);
proposalProvider.setFiltering(true);
adapter = new MyContentProposalAdapter(control, controlContentAdapter,
proposalProvider, keyStroke, autoActivationCharacters);
adapter.setPropagateKeys(false);
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
adapter.setAutoActivateOnLetter(true);
adapter.setAutoCloseOnSpace(true);
adapter.setPopupSize(new Point(300, 150));
}
示例3: delHint
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
/***************************************************************************
* Remove the hint text
**************************************************************************/
public void delHint()
{
if (!m_hintStr.equals(""))
{
m_hintStr = "";
reset();
}
m_promptLabel.setText(PROMPT_SYMBOL);
//Restore command options
ArrayList<String> possibleCommandsList = new ArrayList<String>();
for (GuiExecutorCommand cmd : GuiExecutorCommand.values())
{
possibleCommandsList.add(cmd.label.toLowerCase());
}
//Setup commands again
String[] possibleCommands = possibleCommandsList.toArray(new String[0]);
provider = new SimpleContentProposalProvider(possibleCommands);
adp.setContentProposalProvider(provider);
deco.show();
}
示例4: addContentAssistSimple
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
private ContentProposalAdapter addContentAssistSimple(Text textControl) {
char[] autoActivationCharacters = new char[] { '$', '{' };
KeyStroke keyStroke = null;
try {
keyStroke = KeyStroke.getInstance("Ctrl+Space");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// assume that myTextControl has already been created in some way
List<Variable> variables = Variable.getVisibleVariables();
String[] proposals = new String [variables.size()];
for(int i=0;i<variables.size();i++) {
proposals[i] = variables.get(i).getFullVariableName();
}
ContentProposalAdapter adapter = new ContentProposalAdapter(
textControl , new TextContentAdapter(),
new SimpleContentProposalProvider(proposals),
keyStroke, autoActivationCharacters);
adapter.setPropagateKeys(false);
adapter.setFilterStyle(ContentProposalAdapter.FILTER_NONE);
//adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
return adapter;
}
示例5: init
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
@Override
public void init(IPageBookViewPage viewPage, IConsole console) {
super.init(viewPage, console);
SimpleContentProposalProvider proposalsProvider = new SimpleContentProposalProvider(
proposals);
proposalsProvider.setFiltering(true);
KeyStroke ctrlSpace = null;
try {
ctrlSpace = KeyStroke.getInstance("Ctrl+Space");
} catch (ParseException e) {
e.printStackTrace();
}
ContentProposalAdapter adapter = new ContentProposalAdapter(tc,
new StyledTextContentAdapter(util), proposalsProvider,
ctrlSpace, null);
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
}
示例6: createDecoration
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
/***************************************************************************
* Create decoration for the input field
**************************************************************************/
private void createDecoration()
{
// Field decoration
deco = new ControlDecoration(m_contents, SWT.RIGHT);
deco.setDescriptionText("Use CTRL+Space to see the possible commands");
deco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
.getImage());
deco.setShowOnlyOnFocus(false);
deco.setShowHover(true);
KeyStroke keyStroke;
ArrayList<String> possibleCommandsList = new ArrayList<String>();
for (GuiExecutorCommand cmd : GuiExecutorCommand.values())
{
possibleCommandsList.add(cmd.label.toLowerCase());
}
String[] possibleCommands = possibleCommandsList.toArray(new String[0]);
char[] autoActivationCharacters = new char[0];
provider = new SimpleContentProposalProvider(possibleCommands);
try
{
keyStroke = KeyStroke.getInstance("Ctrl+Space");
adp = new ContentProposalAdapter(m_contents, new TextContentAdapter(), provider, keyStroke,
autoActivationCharacters);
adp.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
adp.addContentProposalListener((IContentProposalListener) m_contents.getParent().getParent());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
示例7: enableFilteringContentAssist
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
public static SimpleContentProposalProvider enableFilteringContentAssist(final Control control, final String[] proposals, final String byOperator) {
Arrays.sort(proposals);
ConfigContentProposalProvider contentProposalProvider = new ConfigContentProposalProvider(proposals);
contentProposalProvider.setFiltering(true);
contentProposalProvider.setByOperator(byOperator);
ConfigTextContentAdapter textContentAdapter = new ConfigTextContentAdapter();
textContentAdapter.setByOperator(byOperator);
new ContentProposalAdapter(control, textContentAdapter, contentProposalProvider, null, null);
return contentProposalProvider;
}
示例8: createHostField
import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; //导入依赖的package包/类
protected DecoratedTextField createHostField(final Composite inParent,
final int inColumns, final int inIndent) {
final Text lHostField = createLabeText(
inParent,
inColumns,
RelationsMessages.getString("FormDBConnection.lbl.host"), SWT.BORDER | SWT.SINGLE); //$NON-NLS-1$
((GridData) lHostField.getLayoutData()).horizontalIndent = inIndent;
dbDirtySettings.register(lHostField);
final DecoratedTextField outDecorated = createDecoratedTextField(
lHostField,
RelationsMessages.getString("FormDBConnection.decoration.host")); //$NON-NLS-1$
lHostField.addFocusListener(new FormFocusListener(hostEmpty,
outDecorated));
lHostField.addModifyListener(new FormModifyListener(outDecorated));
// add content proposal to field proposing "localhost" as possible value
KeyStroke lKeyStroke = null;
try {
lKeyStroke = KeyStroke.getInstance("Ctrl+Space"); //$NON-NLS-1$
}
catch (final ParseException exc) {
//
}
final ContentProposalAdapter lAdapter = new ContentProposalAdapter(
lHostField,
new TextContentAdapter(),
new SimpleContentProposalProvider(
new String[] { RelationsMessages
.getString("FormDBConnection.proposal.localhost") }), //$NON-NLS-1$
lKeyStroke, new char[] { 'l', 'L' });
lAdapter.setPopupSize(new Point(120, 32));
lAdapter.setPropagateKeys(true);
lAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
statusManager.initialize(lHostField);
return outDecorated;
}