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


Java IContentProposalProvider类代码示例

本文整理汇总了Java中org.eclipse.jface.fieldassist.IContentProposalProvider的典型用法代码示例。如果您正苦于以下问题:Java IContentProposalProvider类的具体用法?Java IContentProposalProvider怎么用?Java IContentProposalProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IContentProposalProvider类属于org.eclipse.jface.fieldassist包,在下文中一共展示了IContentProposalProvider类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createProviderForProject

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的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: getProposals

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
	List<IContentProposal> proposals = new ArrayList<IContentProposal>();
	for (IContentProposalProvider provider : proposalProviders) {
		IContentProposal[] icp = provider.getProposals(contents, position);
		if (icp == null) continue;
		for (IContentProposal prop: icp) 
			proposals.add(prop);
	}
	Collections.sort(proposals, new Comparator<IContentProposal>() {
		@Override
		public int compare(IContentProposal arg0, IContentProposal arg1) {
			return arg0.getLabel().compareTo(arg1.getLabel());
		}			
	});
	return proposals.toArray(new IContentProposal[0]);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:MultiContentProposalProvider.java

示例3: getObjectProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
protected IContentProposalProvider getObjectProposalProvider(
		BTSConfigItem configItem) {
	if (thsItemProposalProvider == null) {
		thsItemProposalProvider = new ObjectSelectionProposalProvider(
				generalObjectController, configItem, corpusObject);
	}
	thsItemProposalProvider.setConfigItem(configItem);
	return thsItemProposalProvider;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:PassportEntryItemEditor.java

示例4: getItemProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
protected IContentProposalProvider getItemProposalProvider(String prefix) {
	if (itemProposalProvider == null) {
		try {
			itemProposalProvider = new PassportEntryContentProposalProvider(
					passportEditorController.getProposalsFor(entryPath, ""));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	return itemProposalProvider;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:PassportEntryItemEditor.java

示例5: OpenableContentProposal

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
public OpenableContentProposal(Control control,
		IControlContentAdapter controlContentAdapter,
		IContentProposalProvider proposalProvider, KeyStroke keyStroke,
		char[] autoActivationCharacters) {
	super(control, controlContentAdapter, proposalProvider, keyStroke,
			autoActivationCharacters);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:8,代码来源:ManualyOpenedAutocomplete.java

示例6: getContentProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
private IContentProposalProvider getContentProposalProvider(
		final String[] values )
{
	return new IContentProposalProvider( ) {

		public IContentProposal[] getProposals( String contents,
				int position )
		{
			IContentProposal[] proposals = new IContentProposal[values.length];
			for ( int i = 0; i < values.length; i++ )
			{
				final String user = values[i];
				proposals[i] = new IContentProposal( ) {

					public String getContent( )
					{
						return user;
					}

					public String getLabel( )
					{
						return user;
					}

					public String getDescription( )
					{
						return null;
					}

					public int getCursorPosition( )
					{
						return user.length( );
					}
				};
			}
			return proposals;
		}
	};
}
 
开发者ID:eclipse,项目名称:birt,代码行数:40,代码来源:FieldAssistHelper.java

示例7: MyContentProposalAdapter

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
/**
 * Construct a content proposal adapter that can assist the user with
 * choosing content for the field.
 * 
 * @param control
 *            the control for which the adapter is providing content assist.
 *            May not be <code>null</code>.
 * @param controlContentAdapter
 *            the <code>IControlContentAdapter</code> used to obtain and
 *            update the control's contents as proposals are accepted. May
 *            not be <code>null</code>.
 * @param proposalProvider
 *            the <code>IContentProposalProvider</code> used to obtain
 *            content proposals for this control, or <code>null</code> if
 *            no content proposal is available.
 * @param keyStroke
 *            the keystroke that will invoke the content proposal popup. If
 *            this value is <code>null</code>, then proposals will be
 *            activated automatically when any of the auto activation
 *            characters are typed.
 * @param autoActivationCharacters
 *            An array of characters that trigger auto-activation of content
 *            proposal. If specified, these characters will trigger
 *            auto-activation of the proposal popup, regardless of whether
 *            an explicit invocation keyStroke was specified. If this
 *            parameter is <code>null</code>, then only a specified
 *            keyStroke will invoke content proposal. If this parameter is
 *            <code>null</code> and the keyStroke parameter is
 *            <code>null</code>, then all alphanumeric characters will
 *            auto-activate content proposal.
 */
public MyContentProposalAdapter(Control control,
		IControlContentAdapter controlContentAdapter,
		IContentProposalProvider proposalProvider, KeyStroke keyStroke,
		char[] autoActivationCharacters) {
	super();
	
	// We always assume the control and content adapter are valid.
	Assert.isNotNull(control);
	Assert.isNotNull(controlContentAdapter);
	this.control = control;
	this.controlContentAdapter = controlContentAdapter;

	// The rest of these may be null
	this.proposalProvider = proposalProvider;
	this.triggerKeyStroke = keyStroke;
	if (autoActivationCharacters != null) {
		this.autoActivateString = new String(autoActivationCharacters);
	}
	addControlListener(control);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:52,代码来源:MyContentProposalAdapter.java

示例8: VersionContentProposalAdapter

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
public VersionContentProposalAdapter(Control control, IControlContentAdapter controlContentAdapter,
		IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) {
	super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:5,代码来源:NpmInstallWidget.java

示例9: addProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
public void addProposalProvider(IContentProposalProvider provider) {
	proposalProviders.add(provider);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:4,代码来源:MultiContentProposalProvider.java

示例10: getProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
private IContentProposalProvider getProposalProvider() {
    return new IContentProposalProvider() {
        @Override
        public IContentProposal[] getProposals(String contents, int position) {
            String[] items = getStringItems();
            if (contents.length() == 0 || items.length == 0)
                return new IContentProposal[0];
            Pattern matcher = Pattern.compile(Pattern.quote(contents) + ".*");
            ArrayList<String> matches = new ArrayList<String>();
            for (int i = 0; i < items.length; i++) {
                if (matcher.matcher(items[i]).find()) {
                    matches.add(items[i]);
                }
            }

            // We don't want to autoactivate if the only proposal exactly matches
            // what is in the combo. This prevents the popup from
            // opening when the user is merely scrolling through the combo values or
            // has accepted a combo value.
            if (matches.size() == 1 && matches.get(0).equals(combo.getText()))
                return new IContentProposal[0];

            if (matches.isEmpty())
                return new IContentProposal[0];

            // Make the proposals
            IContentProposal[] proposals = new IContentProposal[matches.size()];
            for (int i = 0; i < matches.size(); i++) {
                final String proposal = matches.get(i);
                proposals[i] = new IContentProposal() {

                    @Override
                    public String getContent() {
                        return proposal;
                    }

                    @Override
                    public int getCursorPosition() {
                        return proposal.length();
                    }

                    @Override
                    public String getDescription() {
                        return null;
                    }

                    @Override
                    public String getLabel() {
                        return null;
                    }
                };
            }
            return proposals;
        }
    };
}
 
开发者ID:codenvy-legacy,项目名称:eclipse-plugin,代码行数:57,代码来源:ComboAutoCompleteField.java

示例11: AutocompleteTextCellEditor

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
public AutocompleteTextCellEditor(Composite parent, IContentProposalProvider contentProposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) {
    super(parent);

    enableContentProposal(contentProposalProvider, keyStroke, autoActivationCharacters);
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:6,代码来源:AutocompleteTextCellEditor.java

示例12: createProviderForPath

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
/**
 * Returns a new module specifier proposal provider, which proposes files and folders in the given working
 * directory.
 *
 * @param root
 *            The working directory path
 * @return The proposal provider
 */
public IContentProposalProvider createProviderForPath(IPath root) {
	return new ModuleSpecifierContentProposalProvider(root);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:ModuleSpecifierContentProposalProviderFactory.java

示例13: getContentProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
/**
 * Return the proposal provider that provides content proposals given the
 * current content of the field. A value of <code>null</code> indicates
 * that there are no content proposals available for the field.
 * 
 * @return the {@link IContentProposalProvider} used to show proposals. May
 *         be <code>null</code>.
 */
public IContentProposalProvider getContentProposalProvider() {
	return proposalProvider;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:12,代码来源:MyContentProposalAdapter.java

示例14: setContentProposalProvider

import org.eclipse.jface.fieldassist.IContentProposalProvider; //导入依赖的package包/类
/**
 * Set the content proposal provider that is used to show proposals.
 * 
 * @param proposalProvider
 *            the {@link IContentProposalProvider} used to show proposals
 */
public void setContentProposalProvider(
		IContentProposalProvider proposalProvider) {
	this.proposalProvider = proposalProvider;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:11,代码来源:MyContentProposalAdapter.java


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