本文整理汇总了Java中org.eclipse.xtext.xtype.XtypePackage类的典型用法代码示例。如果您正苦于以下问题:Java XtypePackage类的具体用法?Java XtypePackage怎么用?Java XtypePackage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XtypePackage类属于org.eclipse.xtext.xtype包,在下文中一共展示了XtypePackage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLegacyImportSyntax
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
@Override
public String getLegacyImportSyntax(XImportDeclaration importDeclaration) {
List<INode> list = NodeModelUtils.findNodesForFeature(importDeclaration, XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE);
if (list.isEmpty()) {
return null;
}
INode singleNode = list.get(0);
if (singleNode.getText().indexOf('$') < 0) {
return null;
}
StringBuilder sb = new StringBuilder();
for(ILeafNode node: singleNode.getLeafNodes()) {
if (!node.isHidden()) {
sb.append(node.getText().replace("^", ""));
}
}
return sb.toString();
}
示例2: internalFindPathToImportSection
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
protected boolean internalFindPathToImportSection(LinkedList<EObject> pathToImportSection,
Set<ParserRule> seenRules, EObject ruleOrRuleCall) {
ParserRule rule = null;
EClassifier returnType = null;
if(ruleOrRuleCall instanceof ParserRule)
rule = (ParserRule) ruleOrRuleCall;
else
rule = (ParserRule) ((RuleCall) ruleOrRuleCall).getRule();
if(seenRules.contains(rule))
return false;
seenRules.add(rule);
pathToImportSection.addLast(ruleOrRuleCall);
returnType = rule.getType().getClassifier();
if(returnType instanceof EClass
&& XtypePackage.Literals.XIMPORT_SECTION.isSuperTypeOf((EClass) returnType)) {
return true;
}
for(RuleCall containedRuleCall: GrammarUtil.containedRuleCalls(rule)) {
if(containedRuleCall.getRule() instanceof ParserRule)
if(internalFindPathToImportSection(pathToImportSection, seenRules, containedRuleCall)) {
return true;
}
}
pathToImportSection.removeLast();
return false;
}
示例3: setReturnType
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReturnType(JvmTypeReference newReturnType)
{
if (newReturnType != returnType)
{
NotificationChain msgs = null;
if (returnType != null)
msgs = ((InternalEObject)returnType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE, null, msgs);
if (newReturnType != null)
msgs = ((InternalEObject)newReturnType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE, null, msgs);
msgs = basicSetReturnType(newReturnType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE, newReturnType, newReturnType));
}
示例4: eGet
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES:
return getParamTypes();
case XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE:
return getReturnType();
case XtypePackage.XFUNCTION_TYPE_REF__TYPE:
if (resolve) return getType();
return basicGetType();
case XtypePackage.XFUNCTION_TYPE_REF__INSTANCE_CONTEXT:
return isInstanceContext();
}
return super.eGet(featureID, resolve, coreType);
}
示例5: eSet
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES:
getParamTypes().clear();
getParamTypes().addAll((Collection<? extends JvmTypeReference>)newValue);
return;
case XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE:
setReturnType((JvmTypeReference)newValue);
return;
case XtypePackage.XFUNCTION_TYPE_REF__TYPE:
setType((JvmType)newValue);
return;
case XtypePackage.XFUNCTION_TYPE_REF__INSTANCE_CONTEXT:
setInstanceContext((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
示例6: eUnset
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES:
getParamTypes().clear();
return;
case XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE:
setReturnType((JvmTypeReference)null);
return;
case XtypePackage.XFUNCTION_TYPE_REF__TYPE:
setType((JvmType)null);
return;
case XtypePackage.XFUNCTION_TYPE_REF__INSTANCE_CONTEXT:
setInstanceContext(INSTANCE_CONTEXT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
示例7: eIsSet
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES:
return paramTypes != null && !paramTypes.isEmpty();
case XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE:
return returnType != null;
case XtypePackage.XFUNCTION_TYPE_REF__TYPE:
return type != null;
case XtypePackage.XFUNCTION_TYPE_REF__INSTANCE_CONTEXT:
return instanceContext != INSTANCE_CONTEXT_EDEFAULT;
}
return super.eIsSet(featureID);
}
示例8: eGet
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XtypePackage.XIMPORT_DECLARATION__WILDCARD:
return isWildcard();
case XtypePackage.XIMPORT_DECLARATION__EXTENSION:
return isExtension();
case XtypePackage.XIMPORT_DECLARATION__STATIC:
return isStatic();
case XtypePackage.XIMPORT_DECLARATION__IMPORTED_TYPE:
if (resolve) return getImportedType();
return basicGetImportedType();
case XtypePackage.XIMPORT_DECLARATION__MEMBER_NAME:
return getMemberName();
case XtypePackage.XIMPORT_DECLARATION__IMPORTED_NAMESPACE:
return getImportedNamespace();
}
return super.eGet(featureID, resolve, coreType);
}
示例9: eIsSet
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XtypePackage.XIMPORT_DECLARATION__WILDCARD:
return wildcard != WILDCARD_EDEFAULT;
case XtypePackage.XIMPORT_DECLARATION__EXTENSION:
return extension != EXTENSION_EDEFAULT;
case XtypePackage.XIMPORT_DECLARATION__STATIC:
return static_ != STATIC_EDEFAULT;
case XtypePackage.XIMPORT_DECLARATION__IMPORTED_TYPE:
return importedType != null;
case XtypePackage.XIMPORT_DECLARATION__MEMBER_NAME:
return MEMBER_NAME_EDEFAULT == null ? memberName != null : !MEMBER_NAME_EDEFAULT.equals(memberName);
case XtypePackage.XIMPORT_DECLARATION__IMPORTED_NAMESPACE:
return IMPORTED_NAMESPACE_EDEFAULT == null ? importedNamespace != null : !IMPORTED_NAMESPACE_EDEFAULT.equals(importedNamespace);
}
return super.eIsSet(featureID);
}
示例10: init
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* 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 PureXbasePackage#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 PureXbasePackage init()
{
if (isInited) return (PureXbasePackage)EPackage.Registry.INSTANCE.getEPackage(PureXbasePackage.eNS_URI);
// Obtain or create and register package
PureXbasePackageImpl thePureXbasePackage = (PureXbasePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PureXbasePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PureXbasePackageImpl());
isInited = true;
// Initialize simple dependencies
XbasePackage.eINSTANCE.eClass();
XtypePackage.eINSTANCE.eClass();
// Create package meta-data objects
thePureXbasePackage.createPackageContents();
// Initialize created meta-data
thePureXbasePackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
thePureXbasePackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(PureXbasePackage.eNS_URI, thePureXbasePackage);
return thePureXbasePackage;
}
示例11: initializePackageContents
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents()
{
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
XtypePackage theXtypePackage = (XtypePackage)EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI);
XbasePackage theXbasePackage = (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
// Initialize classes and features; add operations and parameters
initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getModel_ImportSection(), theXtypePackage.getXImportSection(), null, "importSection", null, 0, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getModel_Block(), theXbasePackage.getXBlockExpression(), null, "block", null, 0, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
}
示例12: checkDeprecated
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
@Check
public void checkDeprecated(XImportDeclaration decl) {
if (!isIgnored(DEPRECATED_MEMBER_REFERENCE)) {
JvmType jvmType = decl.getImportedType();
checkDeprecated(
jvmType,
decl,
XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE);
}
}
示例13: getImportedTypeName
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
@Override
public String getImportedTypeName() {
String result = getImportedNamespace();
if (result == null) {
if (this.eIsSet(XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE)) {
JvmType unresolvedType = (JvmType) this.eGet(XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE, false);
if(!unresolvedType.eIsProxy())
return unresolvedType.getIdentifier();
List<INode> list = NodeModelUtils.findNodesForFeature(this,
XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE);
StringBuilder sb = new StringBuilder();
for (INode iNode : list) {
sb.append(NodeModelUtils.getTokenText(iNode).replace("^", ""));
}
result = sb.toString().replace(" ", "");
if (isStatic()) {
return trim(result, 1);
}
return result;
}
return null;
}
if (isWildcard()) {
return trim(result, 2);
}
return result;
}
示例14: init
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* 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
XbasePackageImpl theXbasePackage = (XbasePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XbasePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XbasePackageImpl());
isInited = true;
// Initialize simple dependencies
TypesPackage.eINSTANCE.eClass();
// Obtain or create and register interdependencies
XAnnotationsPackageImpl theXAnnotationsPackage = (XAnnotationsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI) instanceof XAnnotationsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XAnnotationsPackage.eNS_URI) : XAnnotationsPackage.eINSTANCE);
XtypePackageImpl theXtypePackage = (XtypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) instanceof XtypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) : 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;
}
示例15: init
import org.eclipse.xtext.xtype.XtypePackage; //导入依赖的package包/类
/**
* 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
XAnnotationsPackageImpl theXAnnotationsPackage = (XAnnotationsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XAnnotationsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XAnnotationsPackageImpl());
isInited = true;
// Initialize simple dependencies
TypesPackage.eINSTANCE.eClass();
// Obtain or create and register interdependencies
XtypePackageImpl theXtypePackage = (XtypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) instanceof XtypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI) : XtypePackage.eINSTANCE);
XbasePackageImpl theXbasePackage = (XbasePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI) instanceof XbasePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI) : 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;
}