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


Java CrossReference.getTerminal方法代码示例

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


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

示例1: hasIdRule

import org.eclipse.xtext.CrossReference; //导入方法依赖的package包/类
protected boolean hasIdRule(final CrossReference crossRef) {
  AbstractElement _terminal = crossRef.getTerminal();
  if ((_terminal instanceof RuleCall)) {
    AbstractElement _terminal_1 = crossRef.getTerminal();
    final String ruleName = ((RuleCall) _terminal_1).getRule().getName();
    return ((Objects.equal(ruleName, "IdOrSuper") || Objects.equal(ruleName, "ValidID")) || Objects.equal(ruleName, "FeatureCallID"));
  }
  return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:10,代码来源:XbaseIdeCrossrefProposalProvider.java

示例2: _getConcreteSyntaxRuleName

import org.eclipse.xtext.CrossReference; //导入方法依赖的package包/类
protected String _getConcreteSyntaxRuleName(final CrossReference crossReference) {
  String _xifexpression = null;
  AbstractElement _terminal = crossReference.getTerminal();
  if ((_terminal instanceof RuleCall)) {
    _xifexpression = this.getConcreteSyntaxRuleName(crossReference.getTerminal());
  }
  return _xifexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:9,代码来源:XbaseIdeContentProposalProvider.java

示例3: checkCrossReferenceTerminal

import org.eclipse.xtext.CrossReference; //导入方法依赖的package包/类
@Check
public void checkCrossReferenceTerminal(CrossReference reference) {
	if (reference.getTerminal() != null) {
		if (reference.getTerminal() instanceof RuleCall) {
			RuleCall call = (RuleCall) reference.getTerminal();
			checkCrossReferenceTerminal(call);
		} 
	}
	
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:XtextValidator.java

示例4: caseCrossReference

import org.eclipse.xtext.CrossReference; //导入方法依赖的package包/类
@Override
public Boolean caseCrossReference(CrossReference object) {
	// Do not create duplicate errors
	if (shouldTraverse(object)) {
		pushChecked(object);
		if (object.getTerminal() != null)
			doSwitch(object.getTerminal());
		popChecked(object);
	}
	return Boolean.FALSE;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:12,代码来源:PredicateUsesUnorderedGroupInspector.java

示例5: createProxy

import org.eclipse.xtext.CrossReference; //导入方法依赖的package包/类
/**
 * Creates the proxy with a custom encoded URI format (starting with "|"). The object used to produce the encoded
 * URI are collected as tuple inside {@link N4JSResource}. Then the node text is checked if it is convertible to a
 * valid value. If there is a {@link BadEscapementException} is thrown then there is either a warning or an error
 * produced via the diagnosticProducer.
 *
 *
 * @param resource
 *            the N4JSResource
 * @param obj
 *            the EObject containing the cross reference
 * @param node
 *            the node representing the EObject
 * @param eRef
 *            the cross reference in the domain model
 * @param xref
 *            the cross reference in the node model
 * @param diagnosticProducer
 *            to produce errors or warnings
 * @return the created proxy
 */
private EObject createProxy(N4JSResource resource, EObject obj, INode node, EReference eRef, CrossReference xref,
		IDiagnosticProducer diagnosticProducer) {
	final URI uri = resource.getURI();
	/*
	 * as otherwise with 0 the EObjectDescription created for Script would be fetched
	 */
	final int fragmentNumber = resource.addLazyProxyInformation(obj, eRef, node);
	final URI encodedLink = uri.appendFragment("|" + fragmentNumber);
	EClass referenceType = findInstantiableCompatible(eRef.getEReferenceType());
	final EObject proxy = EcoreUtil.create(referenceType);
	((InternalEObject) proxy).eSetProxyURI(encodedLink);
	AbstractElement terminal = xref.getTerminal();
	if (!(terminal instanceof RuleCall)) {
		throw new IllegalArgumentException(String.valueOf(xref));
	}
	AbstractRule rule = ((RuleCall) terminal).getRule();
	try {
		String tokenText = NodeModelUtils.getTokenText(node);
		Object value = valueConverterService.toValue(tokenText, rule.getName(), node);
		if (obj instanceof IdentifierRef && value instanceof String) {
			((IdentifierRef) obj).setIdAsText((String) value);
		} else if (obj instanceof LabelRef && value instanceof String) {
			((LabelRef) obj).setLabelAsText((String) value);
		} else if (obj instanceof ParameterizedPropertyAccessExpression && value instanceof String) {
			((ParameterizedPropertyAccessExpression) obj).setPropertyAsText((String) value);
		} else if (obj instanceof NamedImportSpecifier && value instanceof String) {
			((NamedImportSpecifier) obj).setImportedElementAsText((String) value);
		} else if ((obj instanceof JSXPropertyAttribute) && (value instanceof String)) {
			((JSXPropertyAttribute) obj).setPropertyAsText((String) value);
		} else {
			setOtherElementAsText(tokenText, obj, value);
		}
	} catch (BadEscapementException e) {
		diagnosticProducer.addDiagnostic(new DiagnosticMessage(e.getMessage(), e.getSeverity(), e.getIssueCode(),
				Strings.EMPTY_ARRAY));
	} catch (N4JSValueConverterException vce) {
		diagnosticProducer.addDiagnostic(new DiagnosticMessage(vce.getMessage(), vce.getSeverity(),
				vce.getIssueCode(), Strings.EMPTY_ARRAY));
	} catch (N4JSValueConverterWithValueException vcwve) {
		diagnosticProducer.addDiagnostic(new DiagnosticMessage(vcwve.getMessage(), vcwve.getSeverity(),
				vcwve.getIssueCode(), Strings.EMPTY_ARRAY));
	}
	return proxy;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:66,代码来源:N4JSLinker.java

示例6: caseCrossReference

import org.eclipse.xtext.CrossReference; //导入方法依赖的package包/类
@Override
public Void caseCrossReference(CrossReference object) {
	if (object.getTerminal() != null)
		return doSwitch(object.getTerminal());
	return null;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:UsedRulesFinder.java


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