View | Details | Raw Unified | Return to bug 281655
Collapse All | Expand All

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (+1 lines)
Lines 79-84 Link Here
79
	private String lineSeparator;
79
	private String lineSeparator;
80
	public Alignment memberAlignment;
80
	public Alignment memberAlignment;
81
	public boolean needSpace = false;
81
	public boolean needSpace = false;
82
	boolean inAnnotation = false;
82
83
83
	public int nlsTagCounter;
84
	public int nlsTagCounter;
84
	public int pageWidth;
85
	public int pageWidth;
(-)formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java (+28 lines)
Lines 4267-4272 Link Here
4267
		MemberValuePair[] memberValuePairs = annotation.memberValuePairs;
4267
		MemberValuePair[] memberValuePairs = annotation.memberValuePairs;
4268
		if (memberValuePairs != null) {
4268
		if (memberValuePairs != null) {
4269
			int length = memberValuePairs.length;
4269
			int length = memberValuePairs.length;
4270
			/*
4270
			for (int i = 0; i < length - 1; i++) {
4271
			for (int i = 0; i < length - 1; i++) {
4271
				memberValuePairs[i].traverse(this, scope);
4272
				memberValuePairs[i].traverse(this, scope);
4272
				this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_annotation);
4273
				this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_annotation);
Lines 4275-4280 Link Here
4275
				}
4276
				}
4276
			}
4277
			}
4277
			memberValuePairs[length - 1].traverse(this, scope);
4278
			memberValuePairs[length - 1].traverse(this, scope);
4279
			*/
4280
			Alignment annotationAlignment = this.scribe.createAlignment(
4281
					"annotationMemberValuePairs",//$NON-NLS-1$
4282
					this.preferences.alignment_for_expressions_in_array_initializer,
4283
					length,
4284
					this.scribe.scanner.currentPosition);
4285
			this.scribe.enterAlignment(annotationAlignment);
4286
			boolean ok = false;
4287
			do {
4288
				try {
4289
					for (int i = 0; i < length; i++) {
4290
						if (i > 0) {
4291
							this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_annotation);
4292
							this.scribe.printTrailingComment();
4293
						}
4294
						this.scribe.alignFragment(annotationAlignment, i);
4295
						if (i > 0 && this.preferences.insert_space_after_comma_in_annotation) {
4296
							this.scribe.space();
4297
						}
4298
						memberValuePairs[i].traverse(this, scope);
4299
					}
4300
					ok = true;
4301
				} catch (AlignmentException e) {
4302
					this.scribe.redoAlignment(e);
4303
				}
4304
			} while (!ok);
4305
			this.scribe.exitAlignment(annotationAlignment, true);
4278
		}
4306
		}
4279
		this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_annotation);
4307
		this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_annotation);
4280
		return false;
4308
		return false;

Return to bug 281655