当前位置: 首页>>代码示例>>Java>>正文


Java SimpleContentProposalProvider类代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:SourceFolderContentProposalProviderFactory.java

示例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));	
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:17,代码来源:TrpAutoCompleteField.java

示例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();
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:27,代码来源:PromptField.java

示例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;
}
 
开发者ID:anb0s,项目名称:EasyShell,代码行数:25,代码来源:CommandDataDialog.java

示例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);		
}
 
开发者ID:AndersDala,项目名称:eclipse-debug-console-history,代码行数:19,代码来源:GdbCompletionConsolePage.java

示例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();
	}
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:39,代码来源:PromptField.java

示例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;
}
 
开发者ID:LTTPP,项目名称:Eemory,代码行数:14,代码来源:EclipseUtil.java

示例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;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:37,代码来源:AbstractDBSettingsForm.java


注:本文中的org.eclipse.jface.fieldassist.SimpleContentProposalProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。