protected static boolean areAllFragmentsDeleted(final FieldDeclaration declaration, final List<ASTNode> declarationNodes) { for (final Iterator<VariableDeclarationFragment> iterator= declaration.fragments().iterator(); iterator.hasNext();) { if (!declarationNodes.contains(iterator.next())) return false; } return true; }
@Override public boolean visit(FieldDeclaration node) { handleVariableDeclarations(node.fragments()); return true; }
@Override public boolean visit(FieldDeclaration node) { handleVariableDeclarations(node.fragments()); return true; }
/** * {@inheritDoc} */ public boolean visit(FieldDeclaration node) { if (fAddFinalFields) return handleFragments(node.fragments(), node); return false; }
@Override public boolean visit(FieldDeclaration node) { handleToken((ASTNode) node.fragments().get(0), TokenNameIdentifier, true, false); handleCommas(node.fragments(), this.options.insert_space_before_comma_in_multiple_field_declarations, this.options.insert_space_after_comma_in_multiple_field_declarations); handleSemicolon(node); return true; }
@Override public boolean visit(FieldDeclaration node) { handleToken((ASTNode) node.fragments().get(0), TokenNameIdentifier, true, false); handleCommas(node.fragments(), this.options.insert_space_before_comma_in_multiple_field_declarations, this.options.insert_space_after_comma_in_multiple_field_declarations); handleSemicolon(node); return true; }
@Override public ITypeConstraint[] create(FieldDeclaration fd){ List<ITypeConstraint> result= new ArrayList<>(); result.addAll(Arrays.asList(getConstraintsFromFragmentList(fd.fragments(), fd.getType()))); result.addAll(getConstraintsForHiding(fd)); result.addAll(getConstraintsForFieldDeclaringTypes(fd)); return result.toArray(new ITypeConstraint[result.size()]); }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == MODIFIERS2_PROPERTY) { return modifiers(); } if (property == FRAGMENTS_PROPERTY) { return fragments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
@Override public void endVisit(FieldDeclaration node) { // TODO: in principle, no need to tie the VariableDeclarationFragments together. // The FieldDeclaration can be split up when fragments get different types. // Warning: still need to connect fragments with type! endVisitFieldVariableDeclaration(node.getType(), node.fragments()); }
final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == MODIFIERS2_PROPERTY) { return modifiers(); } if (property == FRAGMENTS_PROPERTY) { return fragments(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
public void handleAlign(List<BodyDeclaration> bodyDeclarations) { if (!this.options.align_type_members_on_columns || areKeptOnOneLine(bodyDeclarations)) return; List<List<FieldDeclaration>> fieldGroups = toAlignGroups(bodyDeclarations, n -> optionalCast(n, FieldDeclaration.class)); this.alignGroups.addAll(fieldGroups); AlignIndexFinder<FieldDeclaration> nameFinder = fd -> findName( (VariableDeclarationFragment) fd.fragments().get(0)); fieldGroups.forEach(fg -> alignNodes(fg, nameFinder)); AlignIndexFinder<FieldDeclaration> assignFinder = fd -> findAssign( (VariableDeclarationFragment) fd.fragments().get(0)); fieldGroups.forEach(fg -> alignNodes(fg, assignFinder)); }
@Override public boolean visit(FieldDeclaration node) { //see bug 42383: multiple VariableDeclarationFragments not supported: VariableDeclarationFragment singleFragment= (VariableDeclarationFragment) node.fragments().get(0); if (isMovedMember(singleFragment.resolveBinding())) return false; // don't update javadoc of moved field here return super.visit(node); }
/** * Looks for field declarations (i.e. class member variables). */ @Override public boolean visit(final FieldDeclaration node) { for (final Object fragment : node.fragments()) { final VariableDeclarationFragment frag = (VariableDeclarationFragment) fragment; addBinding(node, frag.getName().getIdentifier()); } return true; }
@Override protected void initialize() { Assert.isTrue(getDeclaration() instanceof FieldDeclaration); Assert.isTrue(((FieldDeclaration) getDeclaration()).fragments().size() == 1); fOldFieldFragment= (VariableDeclarationFragment) ((FieldDeclaration) getDeclaration()).fragments().get(0); if (getNewElementName() == null) { setNewElementName(fOldFieldFragment.getName().getIdentifier()); } setInsertBefore(false); // delegate must be inserted after the original field that is referenced in the initializer }
protected void initialize() { Assert.isTrue(getDeclaration() instanceof FieldDeclaration); Assert.isTrue(((FieldDeclaration) getDeclaration()).fragments().size() == 1); fOldFieldFragment= (VariableDeclarationFragment) ((FieldDeclaration) getDeclaration()).fragments().get(0); if (getNewElementName() == null) setNewElementName(fOldFieldFragment.getName().getIdentifier()); setInsertBefore(false); // delegate must be inserted after the original field that is referenced in the initializer }
@Override public void endVisit(FieldDeclaration node) { if (skipNode(node)) { return; } GenericSequentialFlowInfo info = processSequential(node, node.getType()); process(info, node.fragments()); }
@Override public void endVisit(FieldDeclaration node) { if (skipNode(node)) return; GenericSequentialFlowInfo info= processSequential(node, node.getType()); process(info, node.fragments()); }
public boolean visit(FieldDeclaration node) { IValueList extendedModifiers = parseExtendedModifiers(node); IValue type = visitChild(node.getType()); IValueList fragments = new IValueList(values); for (Iterator it = node.fragments().iterator(); it.hasNext();) { VariableDeclarationFragment f = (VariableDeclarationFragment) it.next(); fragments.add(visitChild(f)); } ownValue = constructDeclarationNode("field", type, fragments.asList()); setKeywordParameters("modifiers", extendedModifiers); return false; }
@Override public void endVisit(FieldDeclaration node) { if (contains(getSelectedNodes(), node.fragments())) { invalidSelection(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_variable_declaration_fragment_from_field, JavaStatusContext.create(fCUnit, node)); } super.endVisit(node); }
@Override public void endVisit(FieldDeclaration node) { if (contains(getSelectedNodes(), node.fragments())) { invalidSelection(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_variable_declaration_fragment_from_field, JavaStatusContext.create(fCUnit, node)); } super.endVisit(node); }