Java Code Examples for org.eclipse.xtext.Action#getFeature()
The following examples show how to use
org.eclipse.xtext.Action#getFeature() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GrammarElementTitleSwitch.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override public String caseAction(Action object) { String f = object.getFeature(); String o = object.getOperator(); o = (o == null) ? "" : o; String result; if (showActionAsRuleCall && f != null) { result = f + o + new Context2NameFunction().toFunction(null).apply(object) + card(object); } else { String t = object.getType() != null && object.getType().getClassifier() != null ? object.getType() .getClassifier().getName() : "null"; t = (t == null) ? "" : t; f = (f == null) ? "" : "." + f; result = "{" + t + f + o + "}" + card(object); } return addQualified(result, object); }
Example 2
Source File: GrammarAccessUtil.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
private static List<String> getSingleElementDescription(AbstractElement ele) { if (ele instanceof Keyword) return Collections.singletonList(((Keyword) ele).getValue()); else if (ele instanceof Assignment) return Collections.singletonList(((Assignment) ele).getFeature()); else if (ele instanceof RuleCall) return Collections.singletonList(((RuleCall) ele).getRule() .getName()); else if (ele instanceof Action) { Action a = (Action) ele; ArrayList<String> r = new ArrayList<String>(); if (a.getType() != null && a.getType().getClassifier() != null) r.add(a.getType().getClassifier().getName()); if (a.getFeature() != null && !"".equals(a.getFeature())) r.add(a.getFeature()); return r; } else if (ele instanceof CrossReference) { CrossReference cr = (CrossReference) ele; if (cr.getType() != null && cr.getType().getClassifier() != null) return Collections.singletonList(cr.getType().getClassifier() .getName()); } else if (ele instanceof EnumLiteralDeclaration) { EnumLiteralDeclaration decl = (EnumLiteralDeclaration) ele; return Collections.singletonList(decl.getEnumLiteral().getName()); } return Collections.emptyList(); }
Example 3
Source File: OverriddenValueInspector.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public Boolean caseAction(Action object) { if (!fragmentStack.isEmpty()) { return Boolean.TRUE; } assignedFeatures = newMultimap(); if (GrammarUtil.isMultipleAssignment(object)) return null; if (object.getFeature() == null) return Boolean.FALSE; checkAssignment(object, object.getFeature()); return Boolean.FALSE; }
Example 4
Source File: XtextLabelProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
String text(Action object) { String classifierName = getClassifierName(object.getType()); return "{" + classifierName + (object.getFeature() != null ? ("." + object.getFeature()) : "") + "}"; }
Example 5
Source File: XtextValidator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Check public void checkUnassignedActionAfterAssignment(final Action action) { if (action.getFeature() == null) { checkCurrentMustBeUnassigned(action); } }
Example 6
Source File: SequenceFeeder.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected void assertAction(Action action) { if (action.getFeature() == null) throw new RuntimeException("Only assigned actions are allowed."); }
Example 7
Source File: AntlrGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override protected String _ebnf2(final Action it, final AntlrOptions options, final boolean supportActions) { String _xifexpression = null; if (supportActions) { StringConcatenation _builder = new StringConcatenation(); { boolean _isBacktrack = options.isBacktrack(); if (_isBacktrack) { _builder.append("{"); _builder.newLine(); _builder.append("\t"); _builder.append("/* */"); _builder.newLine(); _builder.append("}"); _builder.newLine(); } } _builder.append("{"); _builder.newLine(); _builder.append("\t"); _builder.append("$current = forceCreateModelElement"); { String _feature = it.getFeature(); boolean _tripleNotEquals = (_feature != null); if (_tripleNotEquals) { _builder.append("And"); String _firstUpper = StringExtensions.toFirstUpper(this._grammarAccessExtensions.setOrAdd(it)); _builder.append(_firstUpper, "\t"); } } _builder.append("("); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("grammarAccess."); String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<Action>getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t\t"); _builder.append(","); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("$current);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); _xifexpression = _builder.toString(); } else { _xifexpression = super._ebnf2(it, options, supportActions); } return _xifexpression; }