本文整理汇总了Java中org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest类的典型用法代码示例。如果您正苦于以下问题:Java ContentAssistRequest类的具体用法?Java ContentAssistRequest怎么用?Java ContentAssistRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentAssistRequest类属于org.eclipse.wst.xml.ui.internal.contentassist包,在下文中一共展示了ContentAssistRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addProposal
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
private void addProposal(ContentAssistRequest contentAssistRequest, String name, INgBindingType bindingType,
String displayString, Image image, String additionalProposalInfo) {
String alternateMatch = bindingType.formatAttr(name);
StringBuilder replacementString = new StringBuilder(alternateMatch);
if (!hasValue) {
replacementString.append("=\"\"");
}
StringBuilder replacementStringCursor = new StringBuilder(alternateMatch);
replacementStringCursor.append("=\"\"");
int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
int replacementLength = contentAssistRequest.getReplacementLength();
int cursorPosition = getCursorPositionForProposedText(replacementStringCursor.toString());
IContextInformation contextInformation = null;
int relevance = XMLRelevanceConstants.R_XML_ATTRIBUTE_NAME;
ICompletionProposal proposal = new HTMLAngularCompletionProposal(replacementString.toString(),
replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch,
contextInformation, additionalProposalInfo, relevance);
contentAssistRequest.addProposal(proposal);
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:24,代码来源:HTMLAngularCompletionCollector.java
示例2: getAttribute
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Returns the attribute from a content assist request from an attribute
* completion.
*
* @param request the content assist request, in the context of an attribute
* completion
* @return the XML DOM attribute, or null
*/
public static IDOMAttr getAttribute(ContentAssistRequest request) {
int valueRegionStartOffset = request.getStartOffset();
NamedNodeMap attributes = request.getNode().getAttributes();
if (attributes == null) {
return null;
}
for (int i = 0; i < attributes.getLength(); i++) {
IDOMAttr attribute = (IDOMAttr) attributes.item(i);
if (attribute.getValueRegionStartOffset() == valueRegionStartOffset) {
return attribute;
}
}
return null;
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:27,代码来源:XmlContentAssistUtilities.java
示例3: resolveJavaProject
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Resolves the java project for the given {@link ContentAssistRequest}.
*
* @param contentAssistRequest the request whose document will be used to get
* the java project
* @return the java project corresponding to the request, or null if one could
* not be resolved
*/
public static IJavaProject resolveJavaProject(
ContentAssistRequest contentAssistRequest) {
IDocument document = contentAssistRequest.getDocumentRegion().getParentDocument();
IFile file = SseUtilities.resolveFile(document);
if (file == null) {
return null;
}
IJavaProject javaProject = JavaCore.create(file.getProject());
if (!JavaProjectUtilities.isJavaProjectNonNullAndExists(javaProject)) {
return null;
}
return javaProject;
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:JavaContentAssistUtilities.java
示例4: newUsingContentAssistRequest
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
public static ElExpressionProposalComputer newUsingContentAssistRequest(
ContentAssistRequest contentAssistRequest, IJavaProject javaProject) {
String currentAttrValue = XmlContentAssistUtilities.getAttributeValueUsingMatchString(contentAssistRequest);
int currentAttrValueOffset = XmlContentAssistUtilities.getAttributeValueOffset(contentAssistRequest);
int elExpressionOffsetInAttrValue = UiBinderUtilities.getOpenElExpressionContentsOffset(currentAttrValue);
if (elExpressionOffsetInAttrValue == -1) {
// Not in EL expression, this computer is useless
return null;
}
return new ElExpressionProposalComputer(
currentAttrValue.substring(elExpressionOffsetInAttrValue),
currentAttrValueOffset + elExpressionOffsetInAttrValue,
contentAssistRequest.getNode().getOwnerDocument(), javaProject);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:18,代码来源:ElExpressionProposalComputer.java
示例5: newSetterAttributeProposalComputer
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Creates a proposal computer for widget attributes based on existing type
* setter methods.
*/
public static IProposalComputer newSetterAttributeProposalComputer(
ContentAssistRequest contentAssistRequest, IJavaProject javaProject) {
IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
if (node.getNodeType() != IDOMNode.ELEMENT_NODE) {
return null;
}
String widgetTypeName = UiBinderXmlModelUtilities.computeQualifiedWidgetTypeName(node);
if (widgetTypeName == null) {
return null;
}
String matchString = contentAssistRequest.getMatchString();
return new SetterAttributeProposalComputer(node, widgetTypeName,
javaProject, matchString,
contentAssistRequest.getReplacementBeginPosition(),
matchString.length());
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:ProposalComputerFactory.java
示例6: newUiPhAttributeProposalComputer
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
public static IProposalComputer newUiPhAttributeProposalComputer(
ContentAssistRequest contentAssistRequest) {
IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
if (node.getNodeType() != IDOMNode.ELEMENT_NODE) {
return null;
}
if (XmlUtilities.getAttribute(node,
UiBinderConstants.UI_BINDER_PH_ATTRIBUTE_NAME, true,
UiBinderConstants.UI_BINDER_XML_NAMESPACE) != null) {
// This element already has a ui:field attribute
return null;
}
// Only show this on HTML elements, which should be without a namespace
if (node.getNamespaceURI() != null) {
return null;
}
return createStaticTextProposalComputerForUiAttribute(
UiBinderConstants.UI_BINDER_PH_ATTRIBUTE_NAME, node,
contentAssistRequest);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:ProposalComputerFactory.java
示例7: newUrnImportProposalComputer
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Creates a proposal computer for autocompleting the UiBinder root element
* URN import scheme. For example, <ui:UiBinder
* xmlns:g="urn:import:com.google.gwt._" />
*/
public static IProposalComputer newUrnImportProposalComputer(
ContentAssistRequest contentAssistRequest, IJavaProject javaProject) {
IDOMAttr attribute = XmlContentAssistUtilities.getAttribute(contentAssistRequest);
if (attribute == null) {
return null;
}
String attrValue = XmlContentAssistUtilities.getAttributeValueUsingMatchString(contentAssistRequest);
if (!UiBinderXmlModelUtilities.isUrnImportAttribute(attribute)) {
return null;
}
int urnImportLength = UiBinderConstants.URN_IMPORT_NAMESPACE_BEGINNING.length();
if (attrValue.length() < urnImportLength) {
return null;
}
String replaceText = attrValue.substring(urnImportLength);
int replaceOffset = XmlContentAssistUtilities.getAttributeValueOffset(contentAssistRequest)
+ urnImportLength;
return new CodeCompleteProposalComputer(
new int[]{CompletionProposal.PACKAGE_REF}, javaProject, replaceText,
replaceOffset, replaceText.length(), null, false);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:31,代码来源:ProposalComputerFactory.java
示例8: createStaticTextProposalComputerForUiAttribute
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
private static IProposalComputer createStaticTextProposalComputerForUiAttribute(
String unprefixedAttrName, Node node,
ContentAssistRequest contentAssistRequest) {
Node uiBinderElement = XmlUtilities.getRootElement(node);
String fullAttrName = XmlUtilities.getName(uiBinderElement.getPrefix(),
unprefixedAttrName);
String proposalText = fullAttrName + "=\"\"";
// The cursor position will be inside the quotes
int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition();
int cursorPosition = replacementBeginPosition + proposalText.length() - 1;
return new StaticTextProposalComputer(new String[]{proposalText},
contentAssistRequest.getMatchString(), replacementBeginPosition,
contentAssistRequest.getReplacementLength(), cursorPosition,
XmlContentAssistUtilities.getImageForAttribute());
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:18,代码来源:ProposalComputerFactory.java
示例9: addAttributeValueProposals
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
@Override
protected void addAttributeValueProposals(
ContentAssistRequest contentAssistRequest) {
super.addAttributeValueProposals(contentAssistRequest);
if (javaProject != null) {
addProposals(
contentAssistRequest,
ElExpressionProposalComputer.newUsingContentAssistRequest(
contentAssistRequest, javaProject),
ProposalComputerFactory.newUiImportFieldProposalComputer(
contentAssistRequest, javaProject, filePackageName),
ProposalComputerFactory.newWithTypeProposalComputer(
contentAssistRequest, javaProject),
ProposalComputerFactory.newUrnImportProposalComputer(
contentAssistRequest, javaProject),
ProposalComputerFactory.newUrnTypesProposalComputer(contentAssistRequest),
ProposalComputerFactory.newUiFieldProposalComputer(
contentAssistRequest, javaProject));
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:22,代码来源:UiBinderXmlCompletionProcessor.java
示例10: addTagNameProposals
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
@Override
protected void addTagNameProposals(ContentAssistRequest contentAssistRequest,
int childPosition) {
super.addTagNameProposals(contentAssistRequest, childPosition);
if (javaProject != null) {
addProposals(
contentAssistRequest,
ProposalComputerFactory.newUiBinderRootElementProposalComputer(contentAssistRequest));
if (addProposals(contentAssistRequest,
WidgetProposalComputer.newUsingContentAssistRequest(
contentAssistRequest, javaProject))) {
addedDynamicWidgetProposals = true;
}
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:18,代码来源:UiBinderXmlCompletionProcessor.java
示例11: addProposals
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Calls the given proposal computers and adds their proposals to the content
* assist request.
*
* @param contentAssistRequest the recipient of the proposals
* @param proposalComputers the proposal computers, null is permitted
* @return true if proposals were added to the request
*/
private boolean addProposals(ContentAssistRequest contentAssistRequest,
IProposalComputer... proposalComputers) {
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
for (IProposalComputer proposalComputer : proposalComputers) {
if (proposalComputer == null) {
continue;
}
try {
proposalComputer.computeProposals(proposals);
} catch (UiBinderException e) {
GWTPluginLog.logWarning(e, MessageFormat.format(
"Could not compute proposals for {0}.",
proposalComputer.getClass().getSimpleName()));
return false;
}
}
for (ICompletionProposal proposal : proposals) {
contentAssistRequest.addProposal(proposal);
}
return proposals.size() > 0;
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:34,代码来源:UiBinderXmlCompletionProcessor.java
示例12: proposeStatementId
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
private void proposeStatementId(ContentAssistRequest contentAssistRequest,
IJavaProject project, String matchString, int start, int length, IDOMNode node)
throws JavaModelException, XPathExpressionException
{
final List<ICompletionProposal> results = new ArrayList<ICompletionProposal>();
final MethodNameStore methodStore = new MethodNameStore();
String qualifiedName = MybatipseXmlUtil.getNamespace(node.getOwnerDocument());
JavaMapperUtil.findMapperMethod(methodStore, project, qualifiedName,
new RejectStatementAnnotation(matchString, false));
for (String methodName : methodStore.getMethodNames())
{
results.add(new CompletionProposal(methodName, start, length, methodName.length(),
Activator.getIcon(), methodName, null, null));
}
addProposals(contentAssistRequest, results);
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:17,代码来源:XmlCompletionProposalComputer.java
示例13: proposeProperty
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
private void proposeProperty(ContentAssistRequest contentAssistRequest, String matchString,
int start, int length, IDOMNode node) throws JavaModelException
{
String javaType = MybatipseXmlUtil.findEnclosingType(node);
if (javaType != null && !MybatipseXmlUtil.isDefaultTypeAlias(javaType))
{
IJavaProject project = getJavaProject(contentAssistRequest);
IType type = project.findType(javaType);
if (type == null)
{
javaType = TypeAliasCache.getInstance().resolveAlias(project, javaType, null);
if (javaType == null)
return;
}
addProposals(contentAssistRequest, ProposalComputorHelper.proposePropertyFor(project,
start, length, javaType, false, -1, matchString));
}
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:19,代码来源:XmlCompletionProposalComputer.java
示例14: addTagNameProposals
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的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
示例15: addProposal
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
private void addProposal(ContentAssistRequest request,
TapestryContext tapestryContext,
String replacementString,
String displayString)
{
request.addProposal(new MarkupCompletionProposal(
replacementString, // replacementString
request.getReplacementBeginPosition(),
request.getReplacementLength(),
replacementString.length(),
Activator.getTapestryLogoIcon(), // image
displayString, // displayString
null, // contextInfo
tapestryContext.getJavadoc(), // additionalProposalInfo
3000 - (StringUtils.countMatches(replacementString, ".") > 0 ? 1 : 0), // relevance
true // updateReplacementLengthOnValidate
));
}
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:19,代码来源:TapestryCompletionProposalComputer.java
示例16: getCurrentTapestryContextSpecification
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的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
示例17: getExpression
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Returns the expression to use for tern completion.
*
* @param contentAssistRequest
* @param startIndex
* @return
*/
private String getExpression(ContentAssistRequest contentAssistRequest,
Integer startIndex) {
String expression = contentAssistRequest.getMatchString();
if (startIndex != null) {
// start index is not null , this case comes from when completion is
// done in attribute :
// 1) when completion is done inside an attribute <span
// ng-app="MyModu
// in this case the expression to use is 'MyModu' and not
// '"MyModu'
// 2) when completion is done inside an
// attribute which define {{
// ex : <span class="done-{{to
// in this case, the expression to use is 'to' and not
// '"done-{{to'
expression = expression.substring(startIndex, expression.length());
}
return expression;
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:27,代码来源:HTMLAngularTagsCompletionProposalComputer.java
示例18: getReplacementOffset
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
/**
* Returns the replacement offset.
*
* @param contentAssistRequest
* @param angularType
* @param isAttr
* @return
*/
private int getReplacementOffset(ContentAssistRequest contentAssistRequest,
AngularType angularType, boolean isAttr) {
int replacementOffset = contentAssistRequest
.getReplacementBeginPosition();
if (isAttr) {
// the completion is done in an attribute.
if (!isModuleOrController(angularType)) {
// getReplacementBeginPosition returns the position of the
// starts of the attribute value (or quote).
// in the case of attribute different from "module",
// "controller", the replacement offset must
// be the position where completion starts (ex : ng-model="todo.
// => the position should be after todo. and before.
replacementOffset += contentAssistRequest.getMatchString()
.length();
}
}
return replacementOffset;
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:28,代码来源:HTMLAngularTagsCompletionProposalComputer.java
示例19: addDirectiveParameter
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的package包/类
public void addDirectiveParameter(
final ContentAssistRequest contentAssistRequest,
DirectiveParameter parameter, IDOMNode element,
IIDETernProject ternProject) {
// Add the directive parameter in the
// completion.
if (hasParameterAttribute(parameter, element)) {
return;
}
Directive directive = parameter.getDirective();
String displayString = parameter.getName() + " - "
+ directive.getModule().getName() + "#" + directive.getName();
String additionalProposalInfo = HTMLAngularPrinter
.getDirectiveParameterInfo(parameter);
Image image = ImageResource.getImage(ImageResource.IMG_DIRECTIVE_PARAM);
addProposal(contentAssistRequest, parameter.getName(),
DirectiveValue.required, null, displayString, image,
additionalProposalInfo, element, ternProject);
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:21,代码来源:HTMLAngularTagsCompletionProposalComputer.java
示例20: addEmptyDocumentProposals
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest; //导入依赖的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
注:本文中的org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论