// Find out the name of the adapter
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(adapterCode.toCharArray());
CompilationUnit astRoot = (CompilationUnit) parser
.createAST(null);
List<TypeDeclaration> typeList = astRoot.types();
if (typeList != null && typeList.size() > 0) {
TypeDeclaration adapterType = (TypeDeclaration) typeList
.get(0);
insertType(pkg, adapterType.getName().toString(),
adapterCode, true, monitor);