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


Java ConfigurableCompletionProposal.setSelectionStart方法代码示例

本文整理汇总了Java中org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.setSelectionStart方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableCompletionProposal.setSelectionStart方法的具体用法?Java ConfigurableCompletionProposal.setSelectionStart怎么用?Java ConfigurableCompletionProposal.setSelectionStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal的用法示例。


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

示例1: createStringProposal

import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; //导入方法依赖的package包/类
private void createStringProposal(ContentAssistContext context, ICompletionProposalAcceptor acceptor,
		String feature, RuleCall ruleCall) {
	String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase());
	proposalText = getValueConverter().toString(proposalText, ruleCall.getRule().getName());
	String displayText = proposalText;
	if (feature != null)
		displayText = displayText + " - " + ruleCall.getRule().getName();
	ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context);
	if (proposal instanceof ConfigurableCompletionProposal) {
		ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
		configurable.setSelectionStart(configurable.getReplacementOffset() + 1);
		configurable.setSelectionLength(proposalText.length() - 2);
		configurable.setAutoInsertable(false);
		configurable.setSimpleLinkedMode(context.getViewer(), proposalText.charAt(0), '\t');
		
	}
	acceptor.accept(proposal);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:TerminalsProposalProvider.java

示例2: createIntProposal

import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; //导入方法依赖的package包/类
private void createIntProposal(ContentAssistContext context, ICompletionProposalAcceptor acceptor,
		RuleCall ruleCall, String feature,	int i) {
	String proposalText = getValueConverter().toString(i, ruleCall.getRule().getName());
	String displayText = proposalText + " - " + ruleCall.getRule().getName();
	if (feature != null)
		displayText = proposalText + " - " + feature;
	ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context);
	if (proposal instanceof ConfigurableCompletionProposal) {
		ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
		configurable.setSelectionStart(configurable.getReplacementOffset());
		configurable.setSelectionLength(proposalText.length());
		configurable.setAutoInsertable(false);
		configurable.setSimpleLinkedMode(context.getViewer(), '\t', ' ');
	}
	acceptor.accept(proposal);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:TerminalsProposalProvider.java

示例3: complete_HEX

import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; //导入方法依赖的package包/类
@Override
public void complete_HEX(EObject model, RuleCall ruleCall, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	ICompletionProposalAcceptor priorityOptimizer = getCustomAcceptor(model, "integer", acceptor);

	String proposalText = "0x1";
	ICompletionProposal proposal = createCompletionProposal(proposalText,
			proposalText + " - " + ruleCall.getRule().getName(), null, context);

	if (proposal instanceof ConfigurableCompletionProposal) {
		ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
		configurable.setSelectionStart(configurable.getReplacementOffset() + 2);
		configurable.setSelectionLength(proposalText.length() - 2);
		configurable.setAutoInsertable(false);
		configurable.setSimpleLinkedMode(context.getViewer(), '\t', ' ');
	}

	priorityOptimizer.accept(proposal);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:20,代码来源:STextProposalProvider.java

示例4: complete_ID

import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; //导入方法依赖的package包/类
public void complete_ID(EObject model, RuleCall ruleCall, final ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	if (doCreateIdProposals()) {
		PrefixMatcher newMatcher = new PrefixMatcher() {
			@Override
			public boolean isCandidateMatchingPrefix(String name, String prefix) {
				String strippedName = name;
				if (name.startsWith("^") && !prefix.startsWith("^")) {
					strippedName = name.substring(1);
				}
				return context.getMatcher().isCandidateMatchingPrefix(strippedName, prefix);
			}
		};
		ContentAssistContext myContext = context.copy().setMatcher(newMatcher).toContext();
		String feature = getAssignedFeature(ruleCall);
		String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase());
		String displayText = proposalText;
		if (feature != null)
			displayText = proposalText + " - " + ruleCall.getRule().getName();
		proposalText = getValueConverter().toString(proposalText, ruleCall.getRule().getName());
		ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, myContext);
		if (proposal instanceof ConfigurableCompletionProposal) {
			ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
			configurable.setSelectionStart(configurable.getReplacementOffset());
			configurable.setSelectionLength(proposalText.length());
			configurable.setAutoInsertable(false);
			configurable.setSimpleLinkedMode(myContext.getViewer(), '\t', ' ');
		}
		acceptor.accept(proposal);
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:32,代码来源:TerminalsProposalProvider.java

示例5: complete_NAME

import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; //导入方法依赖的package包/类
public void complete_NAME(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	String ctx = context.getLastCompleteNode().getText();
	String name = null;
	if (ctx.equals( "alias") || ctx.equals( "as")) {
		if (model instanceof ModelName) {
			name = ((ModelName)model).getBaseUri();
		}
		else if (model instanceof Import) {
			name = ((Import)model).getImportURI();
		}
		if (name != null) {
			int ls = name.lastIndexOf("/");
			if (ls > 0) {
				name = name.substring(ls + 1);
			}
		}
	}
	else {
		name = "NewName ";
	}
	Image image = getImage(model);
	ICompletionProposal proposal = createCompletionProposal(name, name + " - NAME", image, context);
	if (proposal instanceof ConfigurableCompletionProposal) {
		ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
		configurable.setSelectionStart(configurable.getReplacementOffset());
		configurable.setSelectionLength(name.length());
		configurable.setAutoInsertable(false);
		configurable.setSimpleLinkedMode(context.getViewer(), name.charAt(0), '\t');
	}
	acceptor.accept(proposal);
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:32,代码来源:SadlProposalProvider.java


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