List of usage examples for org.eclipse.jdt.core.dom AbstractTypeDeclaration isMemberTypeDeclaration
public boolean isMemberTypeDeclaration()
From source file:org.eclipse.pde.api.tools.internal.util.Signatures.java
License:Open Source License
/** * Collects the synthetic parameter of the fully qualified name of the * enclosing context for a constructor of an inner type * //from ww w.ja v a 2 s . c om * @param method the constructor declaration * @param rparams the listing of parameters to add to */ static void collectSyntheticParam(final MethodDeclaration method, List<String> rparams) { Assert.isNotNull(method); if (Signatures.isInTopLevelType(method)) { return; } ASTNode parent = method.getParent(); AbstractTypeDeclaration type = (AbstractTypeDeclaration) parent; if (Signatures.isStatic(type)) { // if the type is static it doesn't need the enclosing type return; } StringBuffer name = new StringBuffer(); while (parent != null) { parent = parent.getParent(); if (parent instanceof AbstractTypeDeclaration) { type = (AbstractTypeDeclaration) parent; name.insert(0, type.getName().getFullyQualifiedName()); if (type.isMemberTypeDeclaration()) { name.insert(0, '$'); } continue; } if (parent instanceof CompilationUnit) { CompilationUnit cunit = (CompilationUnit) parent; PackageDeclaration pdec = cunit.getPackage(); if (pdec != null) { name.insert(0, '.'); name.insert(0, cunit.getPackage().getName().getFullyQualifiedName()); } } } name.insert(0, "L"); //$NON-NLS-1$ name.append(';'); if (name.length() > 2) { rparams.add(0, name.toString()); } }