List of usage examples for org.eclipse.jdt.core.dom EnumConstantDeclaration getAST
public final AST getAST()
From source file:com.crispico.flower.mp.codesync.code.java.adapter.JavaEnumConstantDeclarationModelAdapter.java
License:Open Source License
@Override public void setValueFeatureValue(Object element, Object feature, Object value) { if (CodeSyncPackage.eINSTANCE.getCodeSyncElement_Name().equals(feature)) { EnumConstantDeclaration enumConstant = getEnumConstant(element); enumConstant.setName(enumConstant.getAST().newSimpleName((String) value)); }// www.j a va 2 s. c o m super.setValueFeatureValue(element, feature, value); }
From source file:com.crispico.flower.mp.codesync.code.java.adapter.JavaEnumConstantDeclarationModelAdapter.java
License:Open Source License
@Override public Object createChildOnContainmentFeature(Object element, Object feature, Object correspondingChild) { if (AstCacheCodePackage.eINSTANCE.getEnumConstant_Arguments().equals(feature)) { EnumConstantDeclaration parent = (EnumConstantDeclaration) element; AST ast = parent.getAST(); Expression arg = getExpressionFromString(ast, (String) correspondingChild); parent.arguments().add(arg);/*from w w w. j a va 2 s. c o m*/ return arg; } return super.createChildOnContainmentFeature(element, feature, correspondingChild); }
From source file:org.asup.dk.compiler.rpj.writer.JDTNamedNodeWriter.java
License:Open Source License
@SuppressWarnings("unchecked") public void writeEnumField(EnumConstantDeclaration enumField, QSpecialElement elem) { AST ast = enumField.getAST(); NormalAnnotation normalAnnotation = ast.newNormalAnnotation(); String name = new String("*" + enumField.getName()); if (elem.getValue() != null && !name.equals(elem.getValue())) { normalAnnotation.setTypeName(ast.newSimpleName(Special.class.getSimpleName())); MemberValuePair memberValuePair = ast.newMemberValuePair(); memberValuePair.setName(ast.newSimpleName("value")); StringLiteral stringLiteral = ast.newStringLiteral(); stringLiteral.setLiteralValue(elem.getValue()); memberValuePair.setValue(stringLiteral); normalAnnotation.values().add(memberValuePair); enumField.modifiers().add(normalAnnotation); }//from w w w . j a va 2 s . c o m }
From source file:org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase.java
License:Open Source License
protected void changeEnumConstantName(EnumConstantDeclaration enumConstantDeclaration, String newEnumConstantName) { enumConstantDeclaration.setName(enumConstantDeclaration.getAST().newSimpleName(newEnumConstantName)); }
From source file:org.flowerplatform.codesync.code.java.adapter.JavaEnumConstantDeclarationModelAdapter.java
License:Open Source License
@Override public void setValueFeatureValue(Object element, Object feature, Object value) { if (CoreConstants.NAME.equals(feature)) { EnumConstantDeclaration enumConstant = getEnumConstant(element); enumConstant.setName(enumConstant.getAST().newSimpleName((String) value)); }/*from w ww . ja v a 2 s.c o m*/ super.setValueFeatureValue(element, feature, value); }
From source file:org.flowerplatform.codesync.code.java.adapter.JavaEnumConstantDeclarationModelAdapter.java
License:Open Source License
@Override public Object createChildOnContainmentFeature(Object element, Object feature, Object correspondingChild, ITypeProvider typeProvider) {/* w w w .j av a2s . c o m*/ if (CodeSyncCodeJavaConstants.ENUM_CONSTANT_ARGUMENTS.equals(feature)) { EnumConstantDeclaration parent = (EnumConstantDeclaration) element; AST ast = parent.getAST(); Expression arg = getExpressionFromString(ast, ((Node) correspondingChild).getPropertyValue(CoreConstants.NAME).toString()); parent.arguments().add(arg); return arg; } return super.createChildOnContainmentFeature(element, feature, correspondingChild, typeProvider); }
From source file:org.spoofax.interpreter.adapter.ecj.ECJFactory.java
License:LGPL
private EnumConstantDeclaration asEnumConstantDeclaration(IStrategoTerm term) { EnumConstantDeclaration x = ((WrappedEnumConstantDeclaration) term).getWrappee(); return x.getParent() == null && x.getAST() == ast ? x : (EnumConstantDeclaration) ASTNode.copySubtree(ast, x); }