Java Code Examples for org.eclipse.xtext.xtype.XtypePackage#eINSTANCE()

The following examples show how to use org.eclipse.xtext.xtype.XtypePackage#eINSTANCE() . 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: XbasePackageImpl.java    From xtext-extras 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 XbasePackage#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 XbasePackage init()
{
	if (isInited) return (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI);

	// Obtain or create and register package
	Object registeredXbasePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
	XbasePackageImpl theXbasePackage = registeredXbasePackage instanceof XbasePackageImpl ? (XbasePackageImpl)registeredXbasePackage : new XbasePackageImpl();

	isInited = true;

	// Initialize simple dependencies
	TypesPackage.eINSTANCE.eClass();

	// Obtain or create and register interdependencies
	Object registeredPackage = EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI);
	XAnnotationsPackageImpl theXAnnotationsPackage = (XAnnotationsPackageImpl)(registeredPackage instanceof XAnnotationsPackageImpl ? registeredPackage : XAnnotationsPackage.eINSTANCE);
	registeredPackage = EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI);
	XtypePackageImpl theXtypePackage = (XtypePackageImpl)(registeredPackage instanceof XtypePackageImpl ? registeredPackage : XtypePackage.eINSTANCE);

	// Create package meta-data objects
	theXbasePackage.createPackageContents();
	theXAnnotationsPackage.createPackageContents();
	theXtypePackage.createPackageContents();

	// Initialize created meta-data
	theXbasePackage.initializePackageContents();
	theXAnnotationsPackage.initializePackageContents();
	theXtypePackage.initializePackageContents();

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

	// Update the registry and return the package
	EPackage.Registry.INSTANCE.put(XbasePackage.eNS_URI, theXbasePackage);
	return theXbasePackage;
}
 
Example 2
Source File: XAnnotationsPackageImpl.java    From xtext-extras 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 XAnnotationsPackage#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 XAnnotationsPackage init()
{
	if (isInited) return (XAnnotationsPackage)EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI);

	// Obtain or create and register package
	Object registeredXAnnotationsPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
	XAnnotationsPackageImpl theXAnnotationsPackage = registeredXAnnotationsPackage instanceof XAnnotationsPackageImpl ? (XAnnotationsPackageImpl)registeredXAnnotationsPackage : new XAnnotationsPackageImpl();

	isInited = true;

	// Initialize simple dependencies
	TypesPackage.eINSTANCE.eClass();

	// Obtain or create and register interdependencies
	Object registeredPackage = EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI);
	XtypePackageImpl theXtypePackage = (XtypePackageImpl)(registeredPackage instanceof XtypePackageImpl ? registeredPackage : XtypePackage.eINSTANCE);
	registeredPackage = EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI);
	XbasePackageImpl theXbasePackage = (XbasePackageImpl)(registeredPackage instanceof XbasePackageImpl ? registeredPackage : XbasePackage.eINSTANCE);

	// Create package meta-data objects
	theXAnnotationsPackage.createPackageContents();
	theXtypePackage.createPackageContents();
	theXbasePackage.createPackageContents();

	// Initialize created meta-data
	theXAnnotationsPackage.initializePackageContents();
	theXtypePackage.initializePackageContents();
	theXbasePackage.initializePackageContents();

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

	// Update the registry and return the package
	EPackage.Registry.INSTANCE.put(XAnnotationsPackage.eNS_URI, theXAnnotationsPackage);
	return theXAnnotationsPackage;
}
 
Example 3
Source File: AbstractXtypeSemanticSequencer.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
	EPackage epackage = semanticObject.eClass().getEPackage();
	ParserRule rule = context.getParserRule();
	Action action = context.getAssignedAction();
	Set<Parameter> parameters = context.getEnabledBooleanParameters();
	if (epackage == TypesPackage.eINSTANCE)
		switch (semanticObject.eClass().getClassifierID()) {
		case TypesPackage.JVM_GENERIC_ARRAY_TYPE_REFERENCE:
			sequence_JvmTypeReference(context, (JvmGenericArrayTypeReference) semanticObject); 
			return; 
		case TypesPackage.JVM_INNER_TYPE_REFERENCE:
			sequence_JvmParameterizedTypeReference(context, (JvmInnerTypeReference) semanticObject); 
			return; 
		case TypesPackage.JVM_LOWER_BOUND:
			if (rule == grammarAccess.getJvmLowerBoundAndedRule()) {
				sequence_JvmLowerBoundAnded(context, (JvmLowerBound) semanticObject); 
				return; 
			}
			else if (rule == grammarAccess.getJvmLowerBoundRule()) {
				sequence_JvmLowerBound(context, (JvmLowerBound) semanticObject); 
				return; 
			}
			else break;
		case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE:
			if (action == grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0()) {
				sequence_JvmParameterizedTypeReference_JvmInnerTypeReference_1_4_0_0_0(context, (JvmParameterizedTypeReference) semanticObject); 
				return; 
			}
			else if (rule == grammarAccess.getJvmTypeReferenceRule()
					|| action == grammarAccess.getJvmTypeReferenceAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0()
					|| rule == grammarAccess.getJvmParameterizedTypeReferenceRule()
					|| rule == grammarAccess.getJvmArgumentTypeReferenceRule()) {
				sequence_JvmParameterizedTypeReference(context, (JvmParameterizedTypeReference) semanticObject); 
				return; 
			}
			else break;
		case TypesPackage.JVM_TYPE_PARAMETER:
			sequence_JvmTypeParameter(context, (JvmTypeParameter) semanticObject); 
			return; 
		case TypesPackage.JVM_UPPER_BOUND:
			if (rule == grammarAccess.getJvmUpperBoundAndedRule()) {
				sequence_JvmUpperBoundAnded(context, (JvmUpperBound) semanticObject); 
				return; 
			}
			else if (rule == grammarAccess.getJvmUpperBoundRule()) {
				sequence_JvmUpperBound(context, (JvmUpperBound) semanticObject); 
				return; 
			}
			else break;
		case TypesPackage.JVM_WILDCARD_TYPE_REFERENCE:
			sequence_JvmWildcardTypeReference(context, (JvmWildcardTypeReference) semanticObject); 
			return; 
		}
	else if (epackage == XtypePackage.eINSTANCE)
		switch (semanticObject.eClass().getClassifierID()) {
		case XtypePackage.XFUNCTION_TYPE_REF:
			sequence_XFunctionTypeRef(context, (XFunctionTypeRef) semanticObject); 
			return; 
		case XtypePackage.XIMPORT_DECLARATION:
			sequence_XImportDeclaration(context, (XImportDeclaration) semanticObject); 
			return; 
		case XtypePackage.XIMPORT_SECTION:
			sequence_XImportSection(context, (XImportSection) semanticObject); 
			return; 
		}
	if (errorAcceptor != null)
		errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}