Refine search
private void renameIfMatch(TreePath path, Tree tree) { if (workingCopy.getTreeUtilities().isSynthetic(path)) { return; } Element el = workingCopy.getTrees().getElement(path); if(el != null && elementAndNames.containsKey(el)) { Tree nju = make.setLabel(tree, elementAndNames.get(el)); workingCopy.rewrite(tree, nju); } } }
private void renameIfMatch(TreePath path, Tree tree, Element elemToRename) { if (workingCopy.getTreeUtilities().isSynthetic(path)) return; Element el = workingCopy.getTrees().getElement(path); if (el != null && el.equals(elemToRename)) { Tree nju = workingCopy.getTreeMaker().setLabel(tree, newName); workingCopy.rewrite(tree, nju); } } }
@Override public void run(WorkingCopy copy) throws IOException { copy.toPhase(JavaSource.Phase.RESOLVED); TreeMaker maker = copy.getTreeMaker(); ClassTree tree = getTopLevelClassTree(copy); if ( tree ==null ){ return; } Element element = copy.getTrees().getElement( copy.getTrees().getPath(copy.getCompilationUnit(), tree) ); ModifiersTree modifiers = tree.getModifiers(); modifiers = addAnnotation(INTERCEPTOR, maker, modifiers); TypeElement annotation = handle.resolve( copy ); if ( annotation != null ){ modifiers = addAnnotation(annotation.getQualifiedName().toString(), maker, modifiers); } copy.rewrite(tree.getModifiers(), modifiers); ElementOpen.open(copy.getClasspathInfo(), element); }
public void run(WorkingCopy workingCopy) throws Exception { workingCopy.toPhase(Phase.RESOLVED); CompilationUnitTree cut = workingCopy.getCompilationUnit(); gu = GenerationUtils.newInstance(workingCopy); for (Tree typeDecl : cut.getTypeDecls()) { if (TreeUtilities.CLASS_TREE_KINDS.contains(typeDecl.getKind())) { Element e = workingCopy.getTrees().getElement(new TreePath(new TreePath(workingCopy.getCompilationUnit()), typeDecl)); if (e != null && e.getKind().isClass()) { TypeElement te = (TypeElement) e; ClassTree ct = (ClassTree) typeDecl; workingCopy.rewrite(ct, generateInterfaces(workingCopy, te, ct, gu)); } } } } };
private Element getImportedElement(CompilationUnitTree cut, ImportTree imp) { Trees trees = copy.getTrees(); Tree qualIdent = imp.getQualifiedIdentifier(); if (qualIdent.getKind() != Tree.Kind.MEMBER_SELECT) { Element element = trees.getElement(TreePath.getPath(cut, qualIdent)); if (element == null) { String fqn = qualIdent.toString(); Element element = trees.getElement(TreePath.getPath(cut, ((MemberSelectTree)qualIdent).getExpression())); if (element == null) element = getElementByFQN(((MemberSelectTree)qualIdent).getExpression().toString()); Element parent = trees.getElement(TreePath.getPath(cut, ((MemberSelectTree)qualIdent).getExpression())); if (parent == null) parent = getElementByFQN(((MemberSelectTree)qualIdent).getExpression().toString());
Trees trees = copy.getTrees(); Elements elements = copy.getElements(); ElementUtilities elementUtilities = copy.getElementUtilities(); pkg = packageName != null ? (PackageElement)trees.getElement(TreePath.getPath(cut, packageName)) : null; if (pkg == null && packageName != null) { pkg = elements.getPackageElement(elements.getName(packageName.toString()));
Element e = copy.getTrees().getElement(tp);
Trees trees = workingCopy.getTrees(); TypeElement classEl = (TypeElement) trees.getElement(trees.getPath(cut, classTree)); MethodTree method = null; ExecutableElement methodEl = null; TypeElement annEl = (TypeElement) trees.getElement( trees.getPath(cut, at.getAnnotationType())); if (annEl.getQualifiedName().toString().equals("org.jdesktop.application.Action")) { // NOI18N