org.eclipse.xtext.XtextPackage Java Examples

The following examples show how to use org.eclipse.xtext.XtextPackage. 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: TerminalsStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #2
Source File: XmlStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #3
Source File: XtextGeneratorLanguage.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected void validateReferencedMetamodel(final ReferencedMetamodel ref) {
  if (((ref.getEPackage() != null) && (!ref.getEPackage().eIsProxy()))) {
    return;
  }
  final EReference eref = XtextPackage.Literals.ABSTRACT_METAMODEL_DECLARATION__EPACKAGE;
  final List<INode> nodes = NodeModelUtils.findNodesForFeature(ref, eref);
  String _xifexpression = null;
  boolean _isEmpty = nodes.isEmpty();
  if (_isEmpty) {
    _xifexpression = "(unknown)";
  } else {
    _xifexpression = NodeModelUtils.getTokenText(nodes.get(0));
  }
  final String refName = _xifexpression;
  final String grammarName = GrammarUtil.getGrammar(ref).getName();
  final String msg = ((((("The EPackage " + refName) + " in grammar ") + grammarName) + " could not be found. ") + "You might want to register that EPackage in your workflow file.");
  throw new IllegalStateException(msg);
}
 
Example #4
Source File: Bug288760TestLanguageStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #5
Source File: CheckResourceUtil.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets all available grammars.
 * <p>
 * The result contains no null entries.
 * </p>
 *
 * @return an iterator over all grammars in the workspace followed by all those in the registry.
 */
private Iterable<Grammar> allGrammars() {
  final ResourceSet resourceSetForResolve = new ResourceSetImpl();
  final Function<IEObjectDescription, Grammar> description2GrammarTransform = new Function<IEObjectDescription, Grammar>() {
    @Override
    public Grammar apply(final IEObjectDescription desc) {
      EObject obj = desc.getEObjectOrProxy();
      if (obj != null && obj.eIsProxy()) {
        obj = EcoreUtil.resolve(obj, resourceSetForResolve);
      }
      if (obj instanceof Grammar && !obj.eIsProxy()) {
        return (Grammar) obj;
      } else {
        return null;
      }

    }
  };

  final Iterable<IEObjectDescription> grammarDescriptorsFromIndex = Access.getIResourceDescriptions().get().getExportedObjectsByType(XtextPackage.Literals.GRAMMAR);
  return Iterables.concat(Iterables.filter(Iterables.transform(grammarDescriptorsFromIndex, description2GrammarTransform), Predicates.notNull()), allGrammarsFromRegistry());
}
 
Example #6
Source File: XtypeStandaloneSetupGenerated.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #7
Source File: HiddenTerminalsTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #8
Source File: XtextValidator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Check
public void checkGeneratedEnumIsValid(EnumLiteralDeclaration decl) {
	EnumRule rule = GrammarUtil.containingEnumRule(decl);
	if (!(rule.getType().getMetamodel() instanceof GeneratedMetamodel))
		return;
	if (!(rule.getType().getClassifier() instanceof EEnum))
		return;
	EEnum eEnum = (EEnum) rule.getType().getClassifier();
	List<EnumLiteralDeclaration> declarations = EcoreUtil2.getAllContentsOfType(rule, EnumLiteralDeclaration.class);
	if (declarations.size() == eEnum.getELiterals().size())
		return;
	for (EnumLiteralDeclaration otherDecl : declarations) {
		if (decl == otherDecl) {
			return;
		}
		if (otherDecl.getEnumLiteral() == decl.getEnumLiteral()) {
			if (!decl.getEnumLiteral().getLiteral().equals(decl.getLiteral().getValue()))
				addIssue("Enum literal '" + decl.getEnumLiteral().getName()
						+ "' has already been defined with literal '" + decl.getEnumLiteral().getLiteral() + "'.",
						decl,
						XtextPackage.Literals.ENUM_LITERAL_DECLARATION__ENUM_LITERAL,
						DUPLICATE_ENUM_LITERAL);
			return;
		}
	}
}
 
Example #9
Source File: ParserRuleImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
	switch (featureID) {
		case XtextPackage.PARSER_RULE__DEFINES_HIDDEN_TOKENS:
			return isDefinesHiddenTokens();
		case XtextPackage.PARSER_RULE__HIDDEN_TOKENS:
			return getHiddenTokens();
		case XtextPackage.PARSER_RULE__PARAMETERS:
			return getParameters();
		case XtextPackage.PARSER_RULE__FRAGMENT:
			return isFragment();
		case XtextPackage.PARSER_RULE__WILDCARD:
			return isWildcard();
	}
	return super.eGet(featureID, resolve, coreType);
}
 
Example #10
Source File: XtextTerminalsTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #11
Source File: XtextValidator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private void doPropagateValidationResult(Diagnostic diagnostic,
		GeneratedMetamodel metamodel, ValidationMessageAcceptor acceptor) {
	boolean foundEObject = false;
	Object firstData = null;
	for(Object data: diagnostic.getData()) {
		if (firstData == null) {
			firstData = diagnostic.getData().get(0);
		}
		if (data instanceof EObject) {
			if (createMessageForSource(diagnostic, (EObject) data, acceptor)) {
				foundEObject = true;
			} 
			if (data instanceof EStructuralFeature && ((EStructuralFeature) data).getEContainingClass() != firstData) {
				EClass containingClass = ((EStructuralFeature) data).getEContainingClass();
				createMessageForSource(diagnostic, containingClass, acceptor);
			}
		}
	}
	if (!foundEObject) {
		doCreateMessage(
				diagnostic, 
				metamodel, 
				XtextPackage.Literals.ABSTRACT_METAMODEL_DECLARATION__EPACKAGE, 
				acceptor);
	}
}
 
Example #12
Source File: AssignmentImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
	switch (featureID) {
		case XtextPackage.ASSIGNMENT__FEATURE:
			setFeature(FEATURE_EDEFAULT);
			return;
		case XtextPackage.ASSIGNMENT__OPERATOR:
			setOperator(OPERATOR_EDEFAULT);
			return;
		case XtextPackage.ASSIGNMENT__TERMINAL:
			setTerminal((AbstractElement)null);
			return;
	}
	super.eUnset(featureID);
}
 
Example #13
Source File: NamedArgumentImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.NAMED_ARGUMENT__PARAMETER:
			setParameter((Parameter)newValue);
			return;
		case XtextPackage.NAMED_ARGUMENT__VALUE:
			setValue((Condition)newValue);
			return;
		case XtextPackage.NAMED_ARGUMENT__CALLED_BY_NAME:
			setCalledByName((Boolean)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #14
Source File: AbstractSelectorFragmentProviderTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean appendFragmentSegment(final EObject object, final StringBuilder builder) {
  EClass eClass = object.eClass();
  EPackage ePackage = eClass.getEPackage();
  if (ePackage == XtextPackage.eINSTANCE) {
    int classifierID = eClass.getClassifierID();
    switch (classifierID) {
    case XtextPackage.GRAMMAR:
      return appendFragmentSegment((Grammar) object, builder);
    case XtextPackage.ENUM_RULE:
    case XtextPackage.PARSER_RULE:
    case XtextPackage.TERMINAL_RULE:
      return appendFragmentSegment((AbstractRule) object, builder);
    case XtextPackage.KEYWORD:
      if (((Keyword) object).getValue().equals("selectCardinality")) {
        return appendFragmentSegment((AbstractElement) object, builder);
      } else {
        return appendFragmentSegment((Keyword) object, builder);
      }
    default:
      return super.appendFragmentSegment(object, builder);
    }
  }
  return super.appendFragmentSegment(object, builder);
}
 
Example #15
Source File: TerminalRulesTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #16
Source File: XtextLinker.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private void processMetamodelDeclarations(Collection<AbstractMetamodelDeclaration> declarations, ResourceSet resourceSet,
		Collection<Resource> resourcesToRemove, Collection<Resource> resourcesToUnload,
		Collection<Resource> referencedResources) {
	for (AbstractMetamodelDeclaration declaration : declarations) {
		EPackage pack = (EPackage) declaration.eGet(XtextPackage.Literals.ABSTRACT_METAMODEL_DECLARATION__EPACKAGE, false);
		if (pack != null && !pack.eIsProxy()) {
			Resource packResource = pack.eResource();
			if (packResource != null) {
				resourcesToRemove.add(packResource);
				if (declaration instanceof ReferencedMetamodel) {
						resourcesToUnload.add(packResource);
				}
				if (isPackageReferenced(resourceSet, pack, declarations)) {
					referencedResources.add(packResource);
				}
			}
		}
	}
}
 
Example #17
Source File: Bug301935TestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #18
Source File: ActionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean eIsSet(int featureID) {
	switch (featureID) {
		case XtextPackage.ACTION__TYPE:
			return type != null;
		case XtextPackage.ACTION__FEATURE:
			return FEATURE_EDEFAULT == null ? feature != null : !FEATURE_EDEFAULT.equals(feature);
		case XtextPackage.ACTION__OPERATOR:
			return OPERATOR_EDEFAULT == null ? operator != null : !OPERATOR_EDEFAULT.equals(operator);
	}
	return super.eIsSet(featureID);
}
 
Example #19
Source File: GeneratedMetamodelImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.GENERATED_METAMODEL__NAME:
			setName((String)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #20
Source File: TerminalRuleImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.TERMINAL_RULE__FRAGMENT:
			setFragment((Boolean)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #21
Source File: XtextLinker.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void beforeEnsureIsLinked(EObject obj, EReference ref, IDiagnosticProducer producer) {
	if (XtextPackage.eINSTANCE.getTypeRef_Classifier() == ref) {
		final TypeRef typeRef = (TypeRef) obj;
		if (typeRef.getMetamodel() == null)
			setDefaultValue(obj, XtextPackage.eINSTANCE.getTypeRef_Metamodel(), producer);
	} else
		super.beforeEnsureIsLinked(obj, ref, producer);
}
 
Example #22
Source File: ParameterReferenceImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean eIsSet(int featureID) {
	switch (featureID) {
		case XtextPackage.PARAMETER_REFERENCE__PARAMETER:
			return parameter != null;
	}
	return super.eIsSet(featureID);
}
 
Example #23
Source File: AbstractElementImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setCardinality(String newCardinality) {
	String oldCardinality = cardinality;
	cardinality = newCardinality;
	if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ABSTRACT_ELEMENT__CARDINALITY, oldCardinality, cardinality));
}
 
Example #24
Source File: CharacterRangeImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
	switch (featureID) {
		case XtextPackage.CHARACTER_RANGE__LEFT:
			setLeft((Keyword)null);
			return;
		case XtextPackage.CHARACTER_RANGE__RIGHT:
			setRight((Keyword)null);
			return;
	}
	super.eUnset(featureID);
}
 
Example #25
Source File: GrammarImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setName(String newName) {
	String oldName = name;
	name = newName;
	if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.GRAMMAR__NAME, oldName, name));
}
 
Example #26
Source File: TypeRefImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean eIsSet(int featureID) {
	switch (featureID) {
		case XtextPackage.TYPE_REF__METAMODEL:
			return metamodel != null;
		case XtextPackage.TYPE_REF__CLASSIFIER:
			return classifier != null;
	}
	return super.eIsSet(featureID);
}
 
Example #27
Source File: CfgAdapter.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public AbstractElement getCall(AbstractElement ele) {
	switch (ele.eClass().getClassifierID()) {
		case XtextPackage.RULE_CALL:
			return ((RuleCall) ele).getRule().getAlternatives();
		default:
			return null;
	}
}
 
Example #28
Source File: AnotherSimpleTestPackageImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
 *
 * <p>This method is used to initialize {@link AnotherSimpleTestPackage#eINSTANCE} when that field is accessed.
 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @see #eNS_URI
 * @see #createPackageContents()
 * @see #initializePackageContents()
 * @generated
 */
public static AnotherSimpleTestPackage init()
{
  if (isInited) return (AnotherSimpleTestPackage)EPackage.Registry.INSTANCE.getEPackage(AnotherSimpleTestPackage.eNS_URI);

  // Obtain or create and register package
  Object registeredAnotherSimpleTestPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
  AnotherSimpleTestPackageImpl theAnotherSimpleTestPackage = registeredAnotherSimpleTestPackage instanceof AnotherSimpleTestPackageImpl ? (AnotherSimpleTestPackageImpl)registeredAnotherSimpleTestPackage : new AnotherSimpleTestPackageImpl();

  isInited = true;

  // Initialize simple dependencies
  EcorePackage.eINSTANCE.eClass();
  XtextPackage.eINSTANCE.eClass();

  // Create package meta-data objects
  theAnotherSimpleTestPackage.createPackageContents();

  // Initialize created meta-data
  theAnotherSimpleTestPackage.initializePackageContents();

  // Mark meta-data to indicate it can't be changed
  theAnotherSimpleTestPackage.freeze();

  // Update the registry and return the package
  EPackage.Registry.INSTANCE.put(AnotherSimpleTestPackage.eNS_URI, theAnotherSimpleTestPackage);
  return theAnotherSimpleTestPackage;
}
 
Example #29
Source File: RuleCallImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * @since 2.9
 * <!-- end-user-doc -->
 * @generated
 */
public EList<NamedArgument> getArguments() {
	if (arguments == null) {
		arguments = new EObjectContainmentEList<NamedArgument>(NamedArgument.class, this, XtextPackage.RULE_CALL__ARGUMENTS);
	}
	return arguments;
}
 
Example #30
Source File: ActionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setOperator(String newOperator) {
	String oldOperator = operator;
	operator = newOperator;
	if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ACTION__OPERATOR, oldOperator, operator));
}