本文整理汇总了Java中org.eclipse.xtext.xbase.XbasePackage类的典型用法代码示例。如果您正苦于以下问题:Java XbasePackage类的具体用法?Java XbasePackage怎么用?Java XbasePackage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XbasePackage类属于org.eclipse.xtext.xbase包,在下文中一共展示了XbasePackage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setExpression
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpression(XExpression newExpression)
{
if (newExpression != expression)
{
NotificationChain msgs = null;
if (expression != null)
msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCATCH_CLAUSE__EXPRESSION, null, msgs);
if (newExpression != null)
msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XCATCH_CLAUSE__EXPRESSION, null, msgs);
msgs = basicSetExpression(newExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XCATCH_CLAUSE__EXPRESSION, newExpression, newExpression));
}
示例2: eSet
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XbasePackage.XTYPE_LITERAL__TYPE:
setType((JvmType)newValue);
return;
case XbasePackage.XTYPE_LITERAL__ARRAY_DIMENSIONS:
getArrayDimensions().clear();
getArrayDimensions().addAll((Collection<? extends String>)newValue);
return;
}
super.eSet(featureID, newValue);
}
示例3: setMemberCallTarget
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMemberCallTarget(XExpression newMemberCallTarget)
{
if (newMemberCallTarget != memberCallTarget)
{
NotificationChain msgs = null;
if (memberCallTarget != null)
msgs = ((InternalEObject)memberCallTarget).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET, null, msgs);
if (newMemberCallTarget != null)
msgs = ((InternalEObject)newMemberCallTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET, null, msgs);
msgs = basicSetMemberCallTarget(newMemberCallTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET, newMemberCallTarget, newMemberCallTarget));
}
示例4: eGet
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XbasePackage.XCONSTRUCTOR_CALL__CONSTRUCTOR:
if (resolve) return getConstructor();
return basicGetConstructor();
case XbasePackage.XCONSTRUCTOR_CALL__ARGUMENTS:
return getArguments();
case XbasePackage.XCONSTRUCTOR_CALL__TYPE_ARGUMENTS:
return getTypeArguments();
case XbasePackage.XCONSTRUCTOR_CALL__INVALID_FEATURE_ISSUE_CODE:
return getInvalidFeatureIssueCode();
case XbasePackage.XCONSTRUCTOR_CALL__VALID_FEATURE:
return isValidFeature();
case XbasePackage.XCONSTRUCTOR_CALL__EXPLICIT_CONSTRUCTOR_CALL:
return isExplicitConstructorCall();
case XbasePackage.XCONSTRUCTOR_CALL__ANONYMOUS_CLASS_CONSTRUCTOR_CALL:
return isAnonymousClassConstructorCall();
}
return super.eGet(featureID, resolve, coreType);
}
示例5: sequence_XForLoopExpression
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* Constraint:
* (declaredParam=JvmFormalParameter forExpression=XExpression eachExpression=XExpression)
*/
protected void sequence_XForLoopExpression(EObject context, XForLoopExpression semanticObject) {
if(errorAcceptor != null) {
if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION));
if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION));
if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__DECLARED_PARAM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__DECLARED_PARAM));
}
INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_0_0_3_0(), semanticObject.getDeclaredParam());
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getForExpressionXExpressionParserRuleCall_1_0(), semanticObject.getForExpression());
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getEachExpressionXExpressionParserRuleCall_3_0(), semanticObject.getEachExpression());
feeder.finish();
}
示例6: testIncompleteCasesOnEnum_7
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Test
public void testIncompleteCasesOnEnum_7() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("switch org.eclipse.xtext.xbase.tests.validation.Color x : org.eclipse.xtext.xbase.tests.validation.Color.RED {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this._validationTestHelper.assertWarning(this.expression(_builder), XbasePackage.Literals.XMEMBER_FEATURE_CALL, IssueCodes.INCOMPLETE_CASES_ON_ENUM);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例7: validate
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Override
public boolean validate(IAcceptor<? super AbstractDiagnostic> result) {
if (!getState().isInstanceContext()) {
JvmIdentifiableElement implicitFeature = getFeature();
if (implicitFeature instanceof JvmType) {
JvmIdentifiableElement feature = getState().getResolvedTypes().getLinkedFeature(getOwner());
if (feature == null || feature.eIsProxy() || !(feature instanceof JvmFeature))
return true;
String message = "Cannot make an implicit reference to this from a static context";
AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(Severity.ERROR,
IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, message, getOwner(),
XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1, null);
result.accept(diagnostic);
return false;
}
}
return super.validate(result);
}
示例8: setBody
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBody(XExpression newBody)
{
if (newBody != body)
{
NotificationChain msgs = null;
if (body != null)
msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, null, msgs);
if (newBody != null)
msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, null, msgs);
msgs = basicSetBody(newBody, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XABSTRACT_WHILE_EXPRESSION__BODY, newBody, newBody));
}
示例9: testDuplicateCases_enum
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Test
public void testDuplicateCases_enum() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("switch x : Thread.State.NEW {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("case NEW: 1");
_builder.newLine();
_builder.append("\t\t");
_builder.append("case NEW: 1");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this._validationTestHelper.assertError(this.expression(_builder), XbasePackage.Literals.XFEATURE_CALL, IssueCodes.DUPLICATE_CASE);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例10: testDuplicateCases_int
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Test
public void testDuplicateCases_int() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("switch x : 1 {");
_builder.newLine();
_builder.append("\t");
_builder.append("case 1: 1");
_builder.newLine();
_builder.append("\t");
_builder.append("case 1: 1");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this._validationTestHelper.assertError(this.expression(_builder), XbasePackage.Literals.XNUMBER_LITERAL, IssueCodes.DUPLICATE_CASE);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例11: getConcreteSyntaxFeatureName
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Override
public String getConcreteSyntaxFeatureName() {
List<INode> list = NodeModelUtils.findNodesForFeature(this, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE);
if (list.size()!=1) {
if (feature == null || feature.eIsProxy())
return "<unkown>";
return String.format("<implicit: %s>", feature.getIdentifier());
}
INode node = list.get(0);
if (node instanceof ILeafNode) {
return node.getText();
}
StringBuilder result = new StringBuilder();
for(ILeafNode leafNode: node.getLeafNodes()) {
if (!leafNode.isHidden())
result.append(leafNode.getText());
}
return result.toString();
}
示例12: eIsSet
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__EXPRESSION:
return expression != null;
case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__EACH_EXPRESSION:
return eachExpression != null;
case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__INIT_EXPRESSIONS:
return initExpressions != null && !initExpressions.isEmpty();
case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__UPDATE_EXPRESSIONS:
return updateExpressions != null && !updateExpressions.isEmpty();
}
return super.eIsSet(featureID);
}
示例13: testBug458742_03
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Test
public void testBug458742_03() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("val list = #[\"foo\"]");
_builder.newLine();
_builder.append(" ");
_builder.append("val b = list?.add(\"bar\")");
_builder.newLine();
_builder.append(" ");
_builder.append("return b");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this._validationTestHelper.assertWarning(this.expression(_builder), XbasePackage.Literals.XMEMBER_FEATURE_CALL,
IssueCodes.NULL_SAFE_FEATURE_CALL_OF_PRIMITIVE_VALUED_FEATURE,
"Null-safe call of primitive-valued feature");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例14: testSwitchDeclaredParameter_5
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
@Test
public void testSwitchDeclaredParameter_5() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("switch (Integer x : \"lalala\") {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XExpression block = this.expression(_builder);
this._validationTestHelper.assertError(block, XbasePackage.Literals.XSTRING_LITERAL, IssueCodes.INCOMPATIBLE_TYPES);
this._validationTestHelper.assertWarning(block, TypesPackage.Literals.JVM_FORMAL_PARAMETER, IssueCodes.UNUSED_LOCAL_VARIABLE);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例15: eIsSet
import org.eclipse.xtext.xbase.XbasePackage; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET:
return memberCallTarget != null;
case XbasePackage.XMEMBER_FEATURE_CALL__MEMBER_CALL_ARGUMENTS:
return memberCallArguments != null && !memberCallArguments.isEmpty();
case XbasePackage.XMEMBER_FEATURE_CALL__EXPLICIT_OPERATION_CALL:
return explicitOperationCall != EXPLICIT_OPERATION_CALL_EDEFAULT;
case XbasePackage.XMEMBER_FEATURE_CALL__EXPLICIT_STATIC:
return explicitStatic != EXPLICIT_STATIC_EDEFAULT;
case XbasePackage.XMEMBER_FEATURE_CALL__NULL_SAFE:
return nullSafe != NULL_SAFE_EDEFAULT;
case XbasePackage.XMEMBER_FEATURE_CALL__TYPE_LITERAL:
return typeLiteral != TYPE_LITERAL_EDEFAULT;
case XbasePackage.XMEMBER_FEATURE_CALL__STATIC_WITH_DECLARING_TYPE:
return staticWithDeclaringType != STATIC_WITH_DECLARING_TYPE_EDEFAULT;
case XbasePackage.XMEMBER_FEATURE_CALL__PACKAGE_FRAGMENT:
return packageFragment != PACKAGE_FRAGMENT_EDEFAULT;
}
return super.eIsSet(featureID);
}