• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CompletionProposalInvocationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testActionTagName

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testActionTagName() throws Exception {
	final String content = "<action name=\"\"></action>";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(StrutsXmlConstants.DEFAULT_METHODS.length,
			proposals.size());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例2: testActionTagMethod

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testActionTagMethod() throws Exception {
	final String content = "<action method=\"\"></action>";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(StrutsXmlConstants.DEFAULT_METHODS.length,
			proposals.size());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例3: testResultTagName

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testResultTagName() throws Exception {
	final String content = "<result name=\"\"></result>";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(StrutsXmlConstants.DEFAULT_RESULT_NAMES.length,
			proposals.size());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例4: testResultTagType

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testResultTagType() throws Exception {
	final String content = "<result type=\"\"></result>";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(StrutsXmlConstants.DEFAULT_RESULT_TYPES.length,
			proposals.size());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例5: testResultTagTypeUpperCase

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testResultTagTypeUpperCase() throws Exception {
	final String content = "<result type=\"REDIRECTA\"></result>";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(1, proposals.size());
	Assert.assertEquals(StrutsXmlConstants.REDIRECT_ACTION_RESULT,
			proposals.get(0).getDisplayString());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:21,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例6: testConstantTagName

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testConstantTagName() throws Exception {
	final String content = "<constant name=\"\" />";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(StrutsXmlConstants.DEFAULT_CONSTANTS.length,
			proposals.size());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例7: testBeanTagScope

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Test
public void testBeanTagScope() throws Exception {
	final String content = "<bean scope=\"\" />";
	IDocument document = new Document(content);

	final int invocationOffset = content.lastIndexOf("\"");

	CompletionProposalInvocationContext context = new CompletionProposalInvocationContext(
			new MockTextViewer(document), invocationOffset);

	List<ICompletionProposal> proposals = computer
			.computeCompletionProposals(context, null);

	Assert.assertNotNull(proposals);
	Assert.assertFalse(proposals.isEmpty());

	Assert.assertEquals(StrutsXmlConstants.DEFAULT_BEAN_SCOPES.length,
			proposals.size());
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:20,代码来源:StrutsXmlCompletionProposalComputerTest.java


示例8: addTagNameProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Override
protected void addTagNameProposals(final ContentAssistRequest request,
                                   int childPosition,
                                   CompletionProposalInvocationContext context)
{
    enumProposals(request, context, new ProposalCallback()
    {
        @Override
        public void newProposal(TapestryContext tapestryContext,
                                String tagName,
                                String displayString)
        {
            addProposal(request, tapestryContext, tagName, displayString);
        }
    });
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:17,代码来源:TapestryCompletionProposalComputer.java


示例9: getCurrentTapestryContextSpecification

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
private TapestryContextScope getCurrentTapestryContextSpecification(
        ContentAssistRequest request,
        CompletionProposalInvocationContext context)
{
    Shell shell = context.getViewer().getTextWidget().getShell();
    
    IWorkbenchWindow window = EclipseUtils.getWorkbenchWindow(shell);
    
    if (window == null)
    {
        return null;
    }
    
    TapestryContext tapestryContext = Activator.getDefault().getTapestryContext(window);
    
    if (tapestryContext == null)
    {
        return null;
    }
    
    TapestryProject tapestryProject = Activator.getDefault().getTapestryProject(window);
    
    TapestryComponentSpecification specification = tapestryContext.getSpecification();
    
    return new TapestryContextScope(window, tapestryProject, tapestryContext, specification);
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:27,代码来源:TapestryCompletionProposalComputer.java


示例10: addEmptyDocumentProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
/**
 * @see org.eclipse.wst.xml.ui.internal.contentassist.DefaultXMLCompletionProposalComputer#addEmptyDocumentProposals(org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest, org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext)
 */
protected void addEmptyDocumentProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context) {
    IProject project=getProject(context.getDocument());
    String ssVersion=SilverStripeVersion.getDefaultVersion();
    
    if(project!=null) {
        ssVersion=CorePreferencesSupport.getInstance().getProjectSpecificPreferencesValue(SilverStripePreferences.SILVERSTRIPE_VERSION, SilverStripeVersion.getDefaultVersion(), project);
    }
    
    
    String templateContext=NewSilverStripeTemplatesWizardPage.NEW_SS_30_TEMPLATE_CONTEXTTYPE;
    IConfigurationElement languageProvider=SilverStripeVersion.getLanguageDefinition(ssVersion);
    if(languageProvider!=null) {
        Object o;
        try {
            o = languageProvider.createExecutableExtension("language_provider");
            if(o instanceof ISilverStripeLanguageModelProvider) {
                templateContext=((ISilverStripeLanguageModelProvider) o).getTemplateContext();
            }
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }
    
    addTemplates(contentAssistRequest, templateContext, context);
}
 
开发者ID:UndefinedOffset,项目名称:eclipse-silverstripedt,代码行数:29,代码来源:SSTemplateCompletionProposalComputer.java


示例11: addTemplates

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
/**
 * Adds templates to the list of proposals
 * 
 * @param contentAssistRequest
 * @param templateContext
 * @param context
 */
private void addTemplates(ContentAssistRequest contentAssistRequest, String templateContext, CompletionProposalInvocationContext context) {
    if (contentAssistRequest != null) {
        boolean useProposalList = !contentAssistRequest.shouldSeparate();
        List proposals = this.getTemplateProposals(templateContext, context);

        for (int i = 0; i < proposals.size(); ++i) {
            if (useProposalList) {
                contentAssistRequest.addProposal((ICompletionProposal)proposals.get(i));
            }
            else {
                contentAssistRequest.addMacro((ICompletionProposal)proposals.get(i));
            }
        }
    }
}
 
开发者ID:UndefinedOffset,项目名称:eclipse-silverstripedt,代码行数:23,代码来源:SSTemplateCompletionProposalComputer.java


示例12: addAttributeNameProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Override
protected void addAttributeNameProposals(final ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context) {
	// Check if project has angular nature
	final IDOMElement element = (IDOMElement) contentAssistRequest.getNode();
	IFile file = DOMUtils.getFile(element);
	if (AngularProject.isAngularProject(file.getProject())) {
		String attrName = contentAssistRequest.getMatchString();
		IDOMAttr attr = DOMUtils.getAttrByRegion(element, contentAssistRequest.getRegion());
		AngularCorePlugin.getBindingManager().collect(element, attrName, file,
				new HTMLAngularCompletionCollector(element, attr, contentAssistRequest, this));
	}
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:14,代码来源:HTMLAngularTagsCompletionProposalComputer.java


示例13: addProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
protected void addProposals(JsonValue json,
		ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context, TargetType target) {
	if (json.isArray()) {
		// Ex :
		// [{"name":"angular-mocks","url":"git://github.com/angular/bower-angular-mocks.git"},
		//  {"name":"angular-moment","url":"git://github.com/urish/angular-moment.git"}]
		String dependency = null;
		String replacementString = null;
		JsonArray values = (JsonArray) json;
		for (JsonValue value : values) {
			if (value.isObject()) {
				dependency = ((JsonObject) value).get("name").asString();
				replacementString = ContentAssistHelper.getRequiredName(
						dependency, JSONSchemaType.String);
				Image icon = BowerEditorPluginImageHelper.getInstance()
						.getImage(BowerEditorPluginImages.IMG_OBJ_BOWER);
				JSONKeyCompletionProposal proposal = new JSONKeyCompletionProposal(
						replacementString,
						contentAssistRequest.getReplacementBeginPosition(),
						contentAssistRequest.getReplacementLength(),
						replacementString.length() - 2, icon, dependency,
						null, null, JSONRelevanceConstants.R_OBJECT_KEY);
				contentAssistRequest.addProposal(proposal);
			}
		}
	}
	//System.err.println(json);
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:30,代码来源:BowerDependencyCompletionProposalCollector.java


示例14: addProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
protected void addProposals(JsonValue json,
		ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context, TargetType target) {
	if (json.isArray()) {
		// Ex :
		// [{"value":"express"},{"value":"lodash"},{"value":"gulp"}]
		String dependency = null;
		String replacementString = null;
		JsonArray values = (JsonArray) json;
		for (JsonValue value : values) {
			if (value.isObject()) {
				dependency = ((JsonObject) value).get("value").asString();
				replacementString = ContentAssistHelper.getRequiredName(
						dependency, JSONSchemaType.String);
				Image icon = NPMEditorPluginImageHelper.getInstance()
						.getImage(NPMEditorPluginImages.IMG_OBJ_NPM);
				JSONKeyCompletionProposal proposal = new JSONKeyCompletionProposal(
						replacementString,
						contentAssistRequest.getReplacementBeginPosition(),
						contentAssistRequest.getReplacementLength(),
						replacementString.length() - 2, icon, dependency,
						null, null, JSONRelevanceConstants.R_OBJECT_KEY);
				contentAssistRequest.addProposal(proposal);
			}
		}
	}
	//System.err.println(json);
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:29,代码来源:NPMDependencyCompletionProposalCollector.java


示例15: computeCompletionProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
/**
 * <p>
 * This does all the magic of figuring out where in the JSON type document
 * the content assist was invoked and then calling the corresponding method
 * to add the correct proposals
 * </p>
 * 
 * <p>
 * <b>NOTE: </b>if overriding be sure to make super call back to this method
 * otherwise you will loose all of the proposals generated by this method
 * </p>
 * 
 * @param matchString
 * @param completionRegion
 * @param treeNode
 * @param xmlnode
 * @param context
 * 
 * @return {@link ContentAssistRequest} that now has all the proposals in it
 */
protected ContentAssistRequest computeCompletionProposals(
		String matchString, ITextRegion completionRegion,
		IJSONNode treeNode, IJSONNode xmlnode,
		CompletionProposalInvocationContext context) {

	int documentPosition = context.getInvocationOffset();

	ContentAssistRequest contentAssistRequest = null;
	String regionType = completionRegion.getType();
	IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);

	// Handle the most common and best supported cases
	if ((xmlnode.getNodeType() == IJSONNode.OBJECT_NODE)) {
		if (regionType == JSONRegionContexts.JSON_OBJECT_OPEN
				|| regionType == JSONRegionContexts.JSON_OBJECT_CLOSE
				|| regionType == JSONRegionContexts.JSON_COMMA) {
			contentAssistRequest = computeObjectKeyProposals(matchString,
					completionRegion, treeNode, xmlnode, context);
		}
	} else if ((xmlnode.getNodeType() == IJSONNode.PAIR_NODE)) {
		if (regionType == JSONRegionContexts.JSON_OBJECT_KEY) {
			contentAssistRequest = computeObjectKeyProposals(matchString,
					completionRegion, treeNode, xmlnode, context);
		}
	}
	return contentAssistRequest;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:48,代码来源:AbstractJSONCompletionProposalComputer.java


示例16: computeObjectKeyProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
private ContentAssistRequest computeObjectKeyProposals(String matchString,
		ITextRegion completionRegion, IJSONNode nodeAtOffset,
		IJSONNode node, CompletionProposalInvocationContext context) {
	int documentPosition = context.getInvocationOffset();
	ContentAssistRequest contentAssistRequest = null;
	IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);

	int replaceLength = 0;
	int begin = documentPosition;
	if (completionRegion.getType() == JSONRegionContexts.JSON_OBJECT_KEY) {
		replaceLength = completionRegion.getTextLength();
		// if container region, be sure replace length is only the attribute
		// value region not the entire container
		if (completionRegion instanceof ITextRegionContainer) {
			ITextRegion openRegion = ((ITextRegionContainer) completionRegion)
					.getFirstRegion();
			ITextRegion closeRegion = ((ITextRegionContainer) completionRegion)
					.getLastRegion();
			if (openRegion.getType() != closeRegion.getType()) {
				replaceLength = openRegion.getTextLength();
			}
		}
		begin = sdRegion.getStartOffset(completionRegion);
	}

	contentAssistRequest = new ContentAssistRequest(nodeAtOffset,
			node.getParentNode(), sdRegion, completionRegion, begin,
			replaceLength, matchString);
	addObjectKeyProposals(contentAssistRequest, context);
	return contentAssistRequest;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:32,代码来源:AbstractJSONCompletionProposalComputer.java


示例17: addProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Override
public void addProposals(ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context, TargetType target) {
	String url = getUrl(contentAssistRequest, target);
	try {
		JsonValue json = HttpHelper.makeRequest(url);
		addProposals(json, contentAssistRequest, context, target);
	} catch (IOException e) {
		Logger.logException(e);
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:12,代码来源:HttpCompletionProposalCollector.java


示例18: addProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
public void addProposals(ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context, TargetType target) {
	IJSONNode node = contentAssistRequest.getNode();
	String contentTypeId = node.getModel().getContentTypeIdentifier();
	Collection<CompletionProposalMatcher> matchersByContentType = matchers
			.get(contentTypeId);
	if (matchersByContentType != null) {
		for (CompletionProposalMatcher matcher : matchersByContentType) {
			matcher.addProposalsIfMatch(contentAssistRequest, context,
					target);
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:14,代码来源:CompletionProposalCollectorsRegistryReader.java


示例19: addProposalsIfMatch

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
public void addProposalsIfMatch(ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context, TargetType target) {
	if (isMatchTarget(target)) {
		// match target
		if (isMatchPaths(contentAssistRequest.getNode())) {
			// match paths
			collector.addProposals(contentAssistRequest, context, target);
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:11,代码来源:CompletionProposalMatcher.java


示例20: addObjectKeyProposals

import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; //导入依赖的package包/类
@Override
protected void addObjectKeyProposals(
		ContentAssistRequest contentAssistRequest,
		CompletionProposalInvocationContext context) {
	collectProposalsFromSchema(contentAssistRequest, context);
	collectProposalsFromExtensionPoint(contentAssistRequest, context);
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:8,代码来源:JSONCompletionProposalComputer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UrlEncodedFormEntity类代码示例发布时间:2022-05-22
下一篇:
Java TaskFinishedEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap