List of usage examples for org.eclipse.jdt.core.dom ThrowStatement EXPRESSION_PROPERTY
ChildPropertyDescriptor EXPRESSION_PROPERTY
To view the source code for org.eclipse.jdt.core.dom ThrowStatement EXPRESSION_PROPERTY.
Click Source Link
From source file:org.moe.natjgen.MethodEditor.java
License:Apache License
@SuppressWarnings("unchecked") public void setBodyAsProtocolDefaultMethod(Type rettype) { Block code = (Block) getRewrite().get(methodDecl, MethodDeclaration.BODY_PROPERTY); if (code == null) { code = getAST().newBlock();/*from w w w .j a v a2 s. co m*/ getRewrite().set(methodDecl, MethodDeclaration.BODY_PROPERTY, code, getEditGroup()); } ListRewrite statements = getRewrite().getListRewrite(code, Block.STATEMENTS_PROPERTY); for (ASTNode object : (List<ASTNode>) statements.getRewrittenList()) { statements.remove(object, getEditGroup()); } Name uoe = getAST().newName("java.lang.UnsupportedOperationException"); SimpleType uoet = getAST().newSimpleType(uoe); ClassInstanceCreation cic = getAST().newClassInstanceCreation(); getRewrite().set(cic, ClassInstanceCreation.TYPE_PROPERTY, uoet, getEditGroup()); ThrowStatement th = getAST().newThrowStatement(); getRewrite().set(th, ThrowStatement.EXPRESSION_PROPERTY, cic, getEditGroup()); statements.insertLast(th, getEditGroup()); }