本文整理匯總了Java中org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor類的典型用法代碼示例。如果您正苦於以下問題:Java Acceptor類的具體用法?Java Acceptor怎麽用?Java Acceptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Acceptor類屬於org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic包,在下文中一共展示了Acceptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: serializeCrossRef
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public String serializeCrossRef(EObject semanticObject, CrossReference crossref, EObject target, INode node,
Acceptor errors) {
if (((InternalEObject) target).eProxyURI() != null) {
if (((InternalEObject) target).eProxyURI().toString().startsWith("#")) {
return super.serializeCrossRef(semanticObject, crossref, getEObjectfromEProxy(semanticObject, target),
node, errors);
}
}
return super.serializeCrossRef(semanticObject, crossref, target, node, errors);
}
示例2: isValid
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public boolean isValid(EObject semanticObject, CrossReference crossref, EObject target, INode node, Acceptor errors) {
if ((target == null || target.eIsProxy()) && node != null) {
CrossReference crossrefFromNode = GrammarUtil.containingCrossReference(node.getGrammarElement());
return crossref == crossrefFromNode;
}
final EReference ref = GrammarUtil.getReference(crossref, semanticObject.eClass());
final IScope scope = scopeProvider.getScope(semanticObject, ref);
if (scope == null) {
if (errors != null)
errors.accept(diagnostics.getNoScopeFoundDiagnostic(semanticObject, crossref, target));
return false;
}
if (target != null && target.eIsProxy()) {
target = handleProxy(target, semanticObject, ref);
}
return getCrossReferenceNameFromScope(semanticObject, crossref, target, scope, errors) != null;
}
示例3: serializeAssignedValue
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public String serializeAssignedValue(EObject context, RuleCall ruleCall, Object value, INode node, Acceptor errors) {
AbstractRule rule = ruleCall.getRule();
String ruleName = ruleNames.getQualifiedName(rule);
if (node != null) {
AbstractRule nodeRule = linkingHelper.getRuleFrom(node.getGrammarElement());
// TODO: analyze why grammar element identity is broken here during generation of Xtext languages using MWE2
if (nodeRule != null && ruleNames.getQualifiedName(nodeRule).equals(ruleName)) {
Object converted = converter.toValue(NodeModelUtils.getTokenText(node), ruleName, node);
if (converted != null && converted.equals(value))
return tokenUtil.serializeNode(node);
}
}
try {
String str = converter.toString(value, ruleName);
if (str != null)
return str;
if (errors != null)
errors.accept(diagnostics.getNullNotAllowedDiagnostic(context, ruleCall));
return null;
} catch (Throwable e) {
if (errors != null)
errors.accept(diagnostics.getValueConversionExceptionDiagnostic(context, ruleCall, value, e));
return null;
}
}
示例4: getCrossReferenceNameFromScope
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
protected String getCrossReferenceNameFromScope(EObject semanticObject, CrossReference crossref,
EObject target, IScope scope, Acceptor errors) {
if (target instanceof AbstractRule) {
return ((AbstractRule) target).getName();
}
if (target instanceof ENamedElement) {
return ((ENamedElement) target).getName();
}
return super.getCrossReferenceNameFromScope(semanticObject, crossref, target, scope, errors);
}
示例5: SequenceFeeder
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
protected SequenceFeeder(Provider provider, ISerializationContext context, EObject semanticObject, INodesForEObjectProvider nodes,
ISemanticSequencer masterSequencer, ISemanticSequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
super();
if (semanticObject == null || nodes == null || sequenceAcceptor == null)
throw new NullPointerException();
this.context = context;
this.provider = provider;
this.semanticObject = semanticObject;
this.nodes = nodes;
this.masterSequencer = masterSequencer;
this.sequenceAcceptor = sequenceAcceptor;
this.errorAcceptor = errorAcceptor;
}
示例6: init
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public void init(ISemanticSequencer sequencer, ISemanticSequenceAcceptor sequenceAcceptor,
ISerializationDiagnostic.Acceptor errorAcceptor) {
this.masterSequencer = sequencer;
this.sequenceAcceptor = sequenceAcceptor;
this.errorAcceptor = errorAcceptor;
}
示例7: init
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
@Deprecated
public void init(EObject context, EObject semanticObject, ISyntacticSequenceAcceptor sequenceAcceptor,
Acceptor errorAcceptor) {
ISerializationContext ctx = SerializationContext.fromEObject(context, semanticObject);
init(ctx, semanticObject, sequenceAcceptor, errorAcceptor);
}
示例8: init
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
@Deprecated
public void init(EObject context, EObject semanticObject, ISequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
this.delegate = sequenceAcceptor;
this.lastNode = NodeModelUtils.findActualNodeFor(semanticObject);
this.rootNode = lastNode;
if (rootNode != null) {
this.rootOffset = rootNode.getTotalOffset();
this.rootEndOffset = rootNode.getTotalEndOffset();
}
}
示例9: serializeCrossRef
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public String serializeCrossRef(EObject semanticObject, CrossReference crossref, EObject target, INode node,
Acceptor errors) {
if ((target == null || target.eIsProxy()) && node != null)
return tokenUtil.serializeNode(node);
final EReference ref = GrammarUtil.getReference(crossref, semanticObject.eClass());
final IScope scope = scopeProvider.getScope(semanticObject, ref);
if (scope == null) {
if (errors != null)
errors.accept(diagnostics.getNoScopeFoundDiagnostic(semanticObject, crossref, target));
return null;
}
if (target != null && target.eIsProxy()) {
target = handleProxy(target, semanticObject, ref);
}
if (target != null && node != null) {
String text = linkingHelper.getCrossRefNodeAsString(node, true);
QualifiedName qn = qualifiedNameConverter.toQualifiedName(text);
URI targetURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(target);
for (IEObjectDescription desc : scope.getElements(qn)) {
if (targetURI.equals(desc.getEObjectURI()))
return tokenUtil.serializeNode(node);
}
}
return getCrossReferenceNameFromScope(semanticObject, crossref, target, scope, errors);
}
示例10: getCrossReferenceNameFromScope
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
protected String getCrossReferenceNameFromScope(EObject semanticObject, CrossReference crossref, EObject target,
final IScope scope, Acceptor errors) {
String ruleName = linkingHelper.getRuleNameFrom(crossref);
boolean foundOne = false;
List<ISerializationDiagnostic> recordedErrros = null;
for (IEObjectDescription desc : scope.getElements(target)) {
foundOne = true;
String unconverted = qualifiedNameConverter.toString(desc.getName());
try {
return valueConverter.toString(unconverted, ruleName);
} catch (ValueConverterException e) {
if (errors != null) {
if (recordedErrros == null)
recordedErrros = Lists.newArrayList();
recordedErrros.add(diagnostics.getValueConversionExceptionDiagnostic(semanticObject, crossref,
unconverted, e));
}
}
}
if (errors != null) {
if (recordedErrros != null)
for (ISerializationDiagnostic diag : recordedErrros)
errors.accept(diag);
if (!foundOne)
errors.accept(diagnostics.getNoEObjectDescriptionFoundDiagnostic(semanticObject, crossref, target,
scope));
}
return null;
}
示例11: serializeAssignedEnumLiteral
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public String serializeAssignedEnumLiteral(EObject context, RuleCall ruleCall, Object value, INode node,
Acceptor errorAcceptor) {
Keyword nodeLit = getLiteral(node);
Keyword modelLit = getLiteral(context, ruleCall, value);
if (modelLit == null) {
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.getInvalidEnumValueDiagnostic(context, ruleCall, value));
return null;
} else if (nodeLit != null && nodeLit.equals(modelLit))
return tokenUtil.serializeNode(node);
else
return modelLit.getValue();
}
示例12: isValid
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public boolean isValid(EObject context, RuleCall ruleCall, Object value, Acceptor errors) {
try {
String str = converter.toString(value, ruleNames.getQualifiedName(ruleCall.getRule()));
if (str != null)
return true;
if (errors != null)
errors.accept(diagnostics.getNullNotAllowedDiagnostic(context, ruleCall));
return false;
} catch (Throwable e) {
if (errors != null)
errors.accept(diagnostics.getValueConversionExceptionDiagnostic(context, ruleCall, value, e));
return false;
}
}
示例13: isValid
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public boolean isValid(EObject context, Keyword keyword, Object value, Acceptor errorAcceptor) {
if (value instanceof String) {
return keyword.getValue().equalsIgnoreCase((String) value);
}
return false;
}
示例14: serializeAssignedKeyword
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public String serializeAssignedKeyword(EObject context, Keyword keyword, Object value, INode node,
Acceptor errorAcceptor) {
if (node != null && node.getGrammarElement() == keyword)
return node.getText();
return keyword.getValue();
}
示例15: init
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; //導入依賴的package包/類
@Override
public void init(final EObject context, final EObject semanticObject, final ISequenceAcceptor sequenceAcceptor, final Acceptor errorAcceptor) {
this.delegate = sequenceAcceptor;
this.lastNode = NodeModelUtils.findActualNodeFor(semanticObject);
this.rootNode = lastNode;
if (rootNode != null) {
this.rootOffset = rootNode.getTotalOffset();
this.rootEndOffset = rootNode.getTotalEndOffset();
}
}