@Override public boolean visit(TypeDeclaration node) { if (topClass == null) { topClass = node; } types.put(topClass, node.getName().getIdentifier()); return super.visit(node); }
public boolean visit(TypeDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveBinding(); return true; }
@Override public boolean visit(TypeDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveBinding(); return true; }
@Override public boolean visit(TypeDeclaration node) { handleBodyDeclarations(node.bodyDeclarations()); if (node.getName().getStartPosition() == -1) return true; // this is a fake type created by parsing in class body mode breakLineBefore(node); handleBracedCode(node, node.getName(), this.options.brace_position_for_type_declaration, this.options.indent_body_declarations_compare_to_type_header); this.declarationModifierVisited = false; return true; }
public boolean visit(TypeDeclaration node) { handleBodyDeclarations(node.bodyDeclarations()); if (node.getName().getStartPosition() == -1) return true; // this is a fake type created by parsing in class body mode breakLineBefore(node); handleBracedCode(node, node.getName(), this.options.brace_position_for_type_declaration, this.options.indent_body_declarations_compare_to_type_header, this.options.insert_new_line_in_empty_type_declaration); this.declarationModifierVisited = false; return true; }
/** * Returns name of the class, e.g. {@code FooBarBean} * * @param path path to java source file */ public static String getClassName(final Path path) { final CompilationUnit unit = getCompilationUnit(path); unit.recordModifications(); final TypeDeclaration classType = (TypeDeclaration) unit.types().get(0); return classType.getName().getIdentifier(); }
public boolean visit(TypeDeclaration node) { if (fBinding.getKind() == IBinding.METHOD) { IMethodBinding binding= (IMethodBinding) fBinding; if (binding.isConstructor() && binding.getDeclaringClass() == node.resolveBinding()) { fResult.add(node.getName()); } } return true; }
@Override public void endVisit(TypeDeclaration node) { if (node.getParent().getLength() == 0) return; // this is a fake block created by parsing in statements mode tryKeepOnOneLine(node, node.getName(), node.bodyDeclarations(), this.options.keep_type_declaration_on_one_line); }
@Override public boolean visit(TypeDeclaration node) { if (isNotVisible(node.getModifiers())) { return false; } enterType(node.getName()); scanTypeJavaDoc(node); return true; }
private static void addMakeTypeAbstractProposal(IInvocationContext context, TypeDeclaration parentTypeDecl, Collection<CUCorrectionProposal> proposals) { MakeTypeAbstractOperation operation = new UnimplementedCodeFix.MakeTypeAbstractOperation(parentTypeDecl); String label = Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(parentTypeDecl.getName().getIdentifier())); UnimplementedCodeFix fix = new UnimplementedCodeFix(label, context.getASTRoot(), new CompilationUnitRewriteOperation[] { operation }); FixCorrectionProposal proposal = new FixCorrectionProposal(fix, null, IProposalRelevance.MAKE_TYPE_ABSTRACT_FIX, context); proposals.add(proposal); }
@Override public boolean visit(TypeDeclaration node) { push(node.isInterface() ? JavaNode.INTERFACE : JavaNode.CLASS, node.getName().toString(), node.getStartPosition(), node.getLength()); return true; }
@Override public boolean visit(TypeDeclaration node) { push(node.isInterface() ? JavaNode.INTERFACE : JavaNode.CLASS, node.getName().toString(), node.getStartPosition(), node.getLength()); return true; }
public final boolean visit(final TypeDeclaration node) { final String name= node.getName().getIdentifier(); if (name.equals(getNewElementName())) { fStatus.addError(Messages.format(RefactoringCoreMessages.RenameTypeParameterRefactoring_type_parameter_inner_class_clash, new String[] { name}), JavaStatusContext.create(fTypeParameter.getDeclaringMember().getCompilationUnit(), new SourceRange(node))); return false; } return true; } }
private static void addMakeTypeAbstractProposal(IInvocationContext context, TypeDeclaration parentTypeDecl, Collection<ICommandAccess> proposals) { MakeTypeAbstractOperation operation= new UnimplementedCodeFix.MakeTypeAbstractOperation(parentTypeDecl); String label= Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(parentTypeDecl.getName().getIdentifier())); UnimplementedCodeFix fix= new UnimplementedCodeFix(label, context.getASTRoot(), new CompilationUnitRewriteOperation[] { operation }); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); FixCorrectionProposal proposal= new FixCorrectionProposal(fix, null, IProposalRelevance.MAKE_TYPE_ABSTRACT_FIX, image, context); proposals.add(proposal); }
private static void addMakeTypeAbstractProposal(IInvocationContext context, TypeDeclaration parentTypeDecl, Collection<ICommandAccess> proposals) { MakeTypeAbstractOperation operation= new UnimplementedCodeFix.MakeTypeAbstractOperation(parentTypeDecl); String label= Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(parentTypeDecl.getName().getIdentifier())); UnimplementedCodeFix fix= new UnimplementedCodeFix(label, context.getASTRoot(), new CompilationUnitRewriteOperation[] { operation }); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); FixCorrectionProposal proposal= new FixCorrectionProposal(fix, null, IProposalRelevance.MAKE_TYPE_ABSTRACT_FIX, image, context); proposals.add(proposal); }
public static UnimplementedCodeFix createMakeTypeAbstractFix(CompilationUnit root, IProblemLocation problem) { ASTNode typeNode= getSelectedTypeNode(root, problem); if (!(typeNode instanceof TypeDeclaration)) return null; TypeDeclaration typeDeclaration= (TypeDeclaration) typeNode; MakeTypeAbstractOperation operation= new MakeTypeAbstractOperation(typeDeclaration); String label= Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(typeDeclaration.getName().getIdentifier())); return new UnimplementedCodeFix(label, root, new CompilationUnitRewriteOperation[] { operation }); }
public static UnimplementedCodeFix createMakeTypeAbstractFix(CompilationUnit root, IProblemLocationCore problem) { ASTNode typeNode= getSelectedTypeNode(root, problem); if (!(typeNode instanceof TypeDeclaration)) { return null; } TypeDeclaration typeDeclaration= (TypeDeclaration) typeNode; MakeTypeAbstractOperation operation= new MakeTypeAbstractOperation(typeDeclaration); String label= Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(typeDeclaration.getName().getIdentifier())); return new UnimplementedCodeFix(label, root, new CompilationUnitRewriteOperation[] { operation }); }
public static UnimplementedCodeFix createMakeTypeAbstractFix(CompilationUnit root, IProblemLocation problem) { ASTNode typeNode= getSelectedTypeNode(root, problem); if (!(typeNode instanceof TypeDeclaration)) return null; TypeDeclaration typeDeclaration= (TypeDeclaration) typeNode; MakeTypeAbstractOperation operation= new MakeTypeAbstractOperation(typeDeclaration); String label= Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(typeDeclaration.getName().getIdentifier())); return new UnimplementedCodeFix(label, root, new CompilationUnitRewriteOperation[] { operation }); }
public static ASTRewriteCorrectionProposal getMakeTypeAbstractProposal(ICompilationUnit cu, TypeDeclaration typeDeclaration, int relevance) { AST ast= typeDeclaration.getAST(); ASTRewrite rewrite= ASTRewrite.create(ast); Modifier newModifier= ast.newModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD); rewrite.getListRewrite(typeDeclaration, TypeDeclaration.MODIFIERS2_PROPERTY).insertLast(newModifier, null); String label= Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, typeDeclaration.getName().getIdentifier()); Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); LinkedCorrectionProposal proposal= new LinkedCorrectionProposal(label, cu, rewrite, relevance, image); proposal.addLinkedPosition(rewrite.track(newModifier), true, "modifier"); //$NON-NLS-1$ return proposal; }