View | Details | Raw Unified | Return to bug 227043 | Differences between
and this patch

Collapse All | Expand All

(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java (-13 / +13 lines)
Lines 181-199 Link Here
181
	return true;
181
	return true;
182
}
182
}
183
183
184
/* (non-Javadoc)
184
protected void toString(StringBuffer buffer) {
185
 * @see java.lang.Object#toString()
185
	StringBuffer indentation = new StringBuffer();
186
 */
186
	for (int t=0; t<=this.depth; t++) indentation.append('\t');
187
public String toString() {
187
	buffer.append(indentation);
188
	StringBuffer buffer = new StringBuffer();
188
	buffer.append("text"); //$NON-NLS-1$
189
	buffer.append("	").append("[FJText] - at offset: " + this.sourceStart).append(" end position: " + this.sourceEnd).append('\n'); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
189
	super.toString(buffer);
190
	buffer.append("	").append(this.separatorsPtr+1).append(" text sections, "); //$NON-NLS-1$ //$NON-NLS-2$
190
	buffer.append(" ("); //$NON-NLS-1$
191
	buffer.append("	").append(this.htmlNodesPtr+1).append(" html tags.\n"); //$NON-NLS-1$ //$NON-NLS-2$
191
	buffer.append(this.separatorsPtr+1).append(" sections, "); //$NON-NLS-1$
192
	buffer.append("	").append("depth=").append(this.depth) //$NON-NLS-1$ //$NON-NLS-2$
192
	buffer.append(this.htmlNodesPtr+1).append(" html tags, "); //$NON-NLS-1$
193
		.append(", lines before=").append(this.linesBefore) //$NON-NLS-1$
193
	buffer.append(this.depth).append(" depth, "); //$NON-NLS-1$
194
		.append(", htmlTagIndex=").append(this.htmlTagIndex) //$NON-NLS-1$
194
	buffer.append(this.linesBefore).append(" before, "); //$NON-NLS-1$
195
		.append('\n');
195
	buffer.append(this.htmlTagIndex).append(" tag index)"); //$NON-NLS-1$
196
	return buffer.toString();
196
	buffer.append('\n');
197
}
197
}
198
198
199
public void toStringDebug(StringBuffer buffer, char[] source) {
199
public void toStringDebug(StringBuffer buffer, char[] source) {
(-)formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java (-2 / +52 lines)
Lines 16-21 Link Here
16
import org.eclipse.jdt.core.compiler.InvalidInputException;
16
import org.eclipse.jdt.core.compiler.InvalidInputException;
17
import org.eclipse.jdt.internal.compiler.parser.JavadocParser;
17
import org.eclipse.jdt.internal.compiler.parser.JavadocParser;
18
import org.eclipse.jdt.internal.compiler.parser.Parser;
18
import org.eclipse.jdt.internal.compiler.parser.Parser;
19
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
19
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
20
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
20
import org.eclipse.jdt.internal.formatter.comment.IJavaDocTagConstants;
21
import org.eclipse.jdt.internal.formatter.comment.IJavaDocTagConstants;
21
22
Lines 95-100 Link Here
95
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#createTag()
96
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#createTag()
96
 */
97
 */
97
protected void createTag() {
98
protected void createTag() {
99
//	if (this.tagValue == TAG_OTHERS_VALUE)  {
100
//		if (this.textStart == -1) this.textStart = this.tagSourceStart;
101
//		return;
102
//	}
98
	int lineStart = this.scanner.getLineNumber(this.tagSourceStart);
103
	int lineStart = this.scanner.getLineNumber(this.tagSourceStart);
99
	FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue);
104
	FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue);
100
	if (this.inlineTagStarted) {
105
	if (this.inlineTagStarted) {
Lines 250-256 Link Here
250
		}
255
		}
251
		for (int i=0, max=IJavaDocTagConstants.JAVADOC_SEPARATOR_TAGS.length; i<max; i++) {
256
		for (int i=0, max=IJavaDocTagConstants.JAVADOC_SEPARATOR_TAGS.length; i<max; i++) {
252
			char[] tag = IJavaDocTagConstants.JAVADOC_SEPARATOR_TAGS[i];
257
			char[] tag = IJavaDocTagConstants.JAVADOC_SEPARATOR_TAGS[i];
253
			if (htmlTag[0] == tag[0] && length == tag.length && CharOperation.equals(htmlTag, tag, false)) {
258
			if (length == tag.length && CharOperation.equals(htmlTag, tag, false)) {
254
				return JAVADOC_SEPARATOR_TAGS_ID + i;
259
				return JAVADOC_SEPARATOR_TAGS_ID + i;
255
			}
260
			}
256
		}
261
		}
Lines 258-263 Link Here
258
	return JAVADOC_TAGS_ID_MASK;
263
	return JAVADOC_TAGS_ID_MASK;
259
}
264
}
260
265
266
/* (non-Javadoc)
267
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#parseParam()
268
 */
269
protected boolean parseParam() throws InvalidInputException {
270
	boolean valid = super.parseParam();
271
	if (!valid) {
272
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
273
		this.index = this.tagSourceEnd+1;
274
		char ch = peekChar();
275
		if (ch != ' ' && !ScannerHelper.isWhitespace(ch)) {
276
			// no space after the tag, just create a normal tag
277
			return false;
278
		}
279
		this.scanner.getNextToken(); // consume first token
280
		pushIdentifier(true, false); // force the identifier even if invalid
281
		pushParamName(false);
282
		this.index = this.scanner.currentPosition;
283
		valid = true;
284
	}
285
	return valid;
286
}
287
288
/* (non-Javadoc)
289
 * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#parseReference()
290
 */
291
protected boolean parseReference() throws InvalidInputException {
292
	boolean valid = super.parseReference();
293
	if (!valid) {
294
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
295
		this.index = this.tagSourceEnd+1;
296
//		char ch = peekChar();
297
//		if (ch != ' ' && !ScannerHelper.isWhitespace(ch)) {
298
//			// no space after the tag, just create a normal tag
299
//			return false;
300
//		}
301
//		this.scanner.getNextToken(); // consume first token
302
//		pushIdentifier(true, false); // force the identifier even if invalid
303
//		pushSeeRef(createTypeReference(0));
304
//		this.index = this.scanner.currentPosition;
305
//		valid = true;
306
	}
307
	return valid;
308
}
309
261
/*
310
/*
262
 * Parse @return tag declaration
311
 * Parse @return tag declaration
263
 */
312
 */
Lines 270-275 Link Here
270
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#parseTag(int)
319
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#parseTag(int)
271
 */
320
 */
272
protected boolean parseTag(int previousPosition) throws InvalidInputException {
321
protected boolean parseTag(int previousPosition) throws InvalidInputException {
322
	int ptr = this.astPtr;
273
	boolean valid = super.parseTag(previousPosition);
323
	boolean valid = super.parseTag(previousPosition);
274
	this.textStart = -1;
324
	this.textStart = -1;
275
	consumeToken();
325
	consumeToken();
Lines 281-287 Link Here
281
				createTag();
331
				createTag();
282
				break;
332
				break;
283
		}
333
		}
284
	} else {
334
	} else if (this.astPtr == ptr) {
285
		createTag();
335
		createTag();
286
	}
336
	}
287
	return true;
337
	return true;
(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-13 / +96 lines)
Lines 1143-1148 Link Here
1143
1143
1144
	private void printBlockComment(int currentTokenStartPosition, int currentTokenEndPosition) {
1144
	private void printBlockComment(int currentTokenStartPosition, int currentTokenEndPosition) {
1145
1145
1146
1147
		// Compute indentation
1148
		int firstColumn = this.column;
1149
		int indentLevel = this.indentationLevel;
1150
		int indentations = this.numberOfIndentations;
1151
		this.indentationLevel = getNextIndentationLevel(firstColumn);
1152
		this.numberOfIndentations = this.indentationLevel % this.indentationSize;
1153
1146
		// Consume the comment prefix
1154
		// Consume the comment prefix
1147
		StringBuffer buffer = new StringBuffer();
1155
		StringBuffer buffer = new StringBuffer();
1148
		this.scanner.getNextChar();
1156
		this.scanner.getNextChar();
Lines 1274-1279 Link Here
1274
								this.column += breakBuffer.length();
1282
								this.column += breakBuffer.length();
1275
								previousToken = token;
1283
								previousToken = token;
1276
								scannerLine = lineNumber;
1284
								scannerLine = lineNumber;
1285
								newLine = false;
1277
								continue;
1286
								continue;
1278
							}
1287
							}
1279
						}
1288
						}
Lines 1332-1338 Link Here
1332
			int tokenStart = this.scanner.getCurrentTokenStartPosition();
1341
			int tokenStart = this.scanner.getCurrentTokenStartPosition();
1333
    		int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart;
1342
    		int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart;
1334
    		hasTokens = true;
1343
    		hasTokens = true;
1335
    		if (scannerLine == firstLine) hastTextOnFirstLine = true;
1344
    		if (!hastTextOnFirstLine && scannerLine == firstLine) {
1345
    			hastTextOnFirstLine = true;
1346
    			this.column++;
1347
    		}
1336
			this.column += tokenLength;
1348
			this.column += tokenLength;
1337
    		if (previousToken == -1 || insertSpace) this.column++;
1349
    		if (previousToken == -1 || insertSpace) this.column++;
1338
    		
1350
    		
Lines 1379-1384 Link Here
1379
		}
1391
		}
1380
1392
1381
		// Reset
1393
		// Reset
1394
		this.indentationLevel = indentLevel;
1395
		this.numberOfIndentations = indentations;
1382
		this.lastNumberOfNewLines = 0;
1396
		this.lastNumberOfNewLines = 0;
1383
		needSpace = false;
1397
		needSpace = false;
1384
		this.scanner.resetTo(currentTokenEndPosition, this.scannerEndPosition - 1);
1398
		this.scanner.resetTo(currentTokenEndPosition, this.scannerEndPosition - 1);
Lines 2062-2067 Link Here
2062
		}
2076
		}
2063
		
2077
		
2064
		// tag section: iterate through the blocks composing this tag but the last one
2078
		// tag section: iterate through the blocks composing this tag but the last one
2079
		int maxColumn = this.formatter.preferences.comment_line_length;
2080
		if (block.isHeaderLine()) maxColumn++;
2065
		for (int i=0; i<=maxNodes; i++) {
2081
		for (int i=0; i<=maxNodes; i++) {
2066
			FormatJavadocNode node = block.nodes[i];
2082
			FormatJavadocNode node = block.nodes[i];
2067
			int nodeStart = node.sourceStart;
2083
			int nodeStart = node.sourceStart;
Lines 2089-2095 Link Here
2089
					if (newLines < text.linesBefore) newLines = text.linesBefore;
2105
					if (newLines < text.linesBefore) newLines = text.linesBefore;
2090
					if (newLines == 0 && text.isImmutableHtmlTag()) {
2106
					if (newLines == 0 && text.isImmutableHtmlTag()) {
2091
						textLength = getTextLength(block, text);
2107
						textLength = getTextLength(block, text);
2092
						if ((this.column + textLength) > this.formatter.preferences.comment_line_length) {
2108
						if ((this.column + textLength) > maxColumn) {
2093
							newLines = 1;
2109
							newLines = 1;
2094
						}
2110
						}
2095
					}
2111
					}
Lines 2116-2122 Link Here
2116
							if (nodeStart > (previousEnd+1)) {
2132
							if (nodeStart > (previousEnd+1)) {
2117
								tokenLength++; // include space between nodes
2133
								tokenLength++; // include space between nodes
2118
							}
2134
							}
2119
							if ((this.column + tokenLength) > this.formatter.preferences.comment_line_length) {
2135
							if ((this.column + tokenLength) > maxColumn) {
2120
								// finally a new line will be inserted while printing next text
2136
								// finally a new line will be inserted while printing next text
2121
								newLines = 1;
2137
								newLines = 1;
2122
								((FormatJavadocText)node).linesBefore = 1;
2138
								((FormatJavadocText)node).linesBefore = 1;
Lines 2436-2444 Link Here
2436
	}
2452
	}
2437
2453
2438
	private int printJavadocHtmlTag(FormatJavadocText text, FormatJavadocBlock block) {
2454
	private int printJavadocHtmlTag(FormatJavadocText text, FormatJavadocBlock block) {
2439
		
2455
2440
		// Local variables init
2456
		// Compute indentation if necessary
2441
		boolean clearBlankLines = this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment;
2457
		boolean clearBlankLines = this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment;
2458
		boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isDescription();
2459
		boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isParamTag();
2460
		boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2461
		int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH;
2462
		if (headerLine) firstColumn++;
2463
		StringBuffer indentationBuffer = null;
2464
		if (indentRootTags) {
2465
			int indentLevel = this.indentationLevel;
2466
			int indentations = this.numberOfIndentations;
2467
			this.numberOfIndentations += (BLOCK_LINE_PREFIX_LENGTH / this.indentationSize) + 1;
2468
			this.indentationLevel = this.numberOfIndentations * this.indentationSize;
2469
			int currentColumn = this.column;
2470
			this.column = firstColumn;
2471
			if (indentParamTag) {
2472
				this.indentationLevel += this.indentationSize;
2473
				this.numberOfIndentations++;
2474
			}
2475
			printIndentationIfNecessary(indentationBuffer = new StringBuffer());
2476
			this.column = currentColumn;
2477
			this.indentationLevel = indentLevel;
2478
			this.numberOfIndentations = indentations;
2479
		}
2480
2481
		// Local variables init
2442
		int textStart = text.sourceStart;
2482
		int textStart = text.sourceStart;
2443
		int nextStart = textStart;
2483
		int nextStart = textStart;
2444
		int startLine = Util.getLineNumber(textStart, this.lineEnds, 0, this.maxLines);
2484
		int startLine = Util.getLineNumber(textStart, this.lineEnds, 0, this.maxLines);
Lines 2468-2484 Link Here
2468
						newLines = linesAfter;
2508
						newLines = linesAfter;
2469
						if (newLines > 1 && clearBlankLines) newLines = 1;
2509
						if (newLines > 1 && clearBlankLines) newLines = 1;
2470
					}
2510
					}
2471
					if (textStart < previousEnd) addReplaceEdit(textStart, previousEnd, buffer.toString());
2511
					if (textStart < previousEnd) {
2512
						addReplaceEdit(textStart, previousEnd, buffer.toString());
2513
//						this.column += buffer.length();
2514
					}
2515
					boolean immutable = htmlTag == null ? false : htmlTag.isImmutableHtmlTag();
2516
					boolean overEndLine = false;
2517
					if (immutable) {
2518
						overEndLine = (this.column + htmlTag.getLength()) > this.formatter.preferences.comment_line_length;
2519
						if (overEndLine) {
2520
							if (newLines < 1) newLines = 1;
2521
						}
2522
					}
2472
					printJavadocGapLines(previousEnd+1, node.sourceStart-1, newLines, clearBlankLines, false, null);
2523
					printJavadocGapLines(previousEnd+1, node.sourceStart-1, newLines, clearBlankLines, false, null);
2473
					if (newLines > 0) textOnNewLine = true;
2524
					if (newLines > 0) textOnNewLine = true;
2525
					buffer = new StringBuffer();
2474
					if (node.isText()) {
2526
					if (node.isText()) {
2475
						linesAfter = printJavadocHtmlTag(htmlTag, block);
2527
						if (immutable) {
2528
							// do not change immutable tags, just increment column
2529
							this.column += getTextLength(block, htmlTag);
2530
							linesAfter = 0;
2531
							if (overEndLine) {
2532
								// need to indent
2533
								if (indentationBuffer != null) {
2534
									addInsertEdit(node.sourceStart, indentationBuffer.toString());
2535
								}
2536
//								buffer.append(' ');
2537
//								this.column++;
2538
							}
2539
						} else {
2540
							linesAfter = printJavadocHtmlTag(htmlTag, block);
2541
						}
2476
					} else {
2542
					} else {
2477
						printJavadocBlock((FormatJavadocBlock)node);
2543
						printJavadocBlock((FormatJavadocBlock)node);
2478
						linesAfter = 0;
2544
						linesAfter = 0;
2479
					}
2545
					}
2480
					buffer = new StringBuffer();
2546
					textStart = node.sourceEnd+1;
2481
					textStart = node.sourceEnd + 1;
2482
					ptr++;
2547
					ptr++;
2483
					if (idx > max)  {
2548
					if (idx > max)  {
2484
						return linesAfter;
2549
						return linesAfter;
Lines 2515-2521 Link Here
2515
					if (clearBlankLines) {
2580
					if (clearBlankLines) {
2516
						// keep previously computed lines after
2581
						// keep previously computed lines after
2517
					} else {
2582
					} else {
2518
						if (wasHtmlTag || idx==0 || (idx==max && ((text.htmlIndexes[max] & JAVADOC_TAGS_ID_MASK) == htmlTagID))) {
2583
//						if (wasHtmlTag || idx==0 || (idx==max && ((text.htmlIndexes[max] & JAVADOC_TAGS_ID_MASK) == htmlTagID))) {
2584
						if (idx==0 || (idx==max && ((text.htmlIndexes[max] & JAVADOC_TAGS_ID_MASK) == htmlTagID)) || (idx < max && wasHtmlTag && (text.htmlIndexes[idx-1] & JAVADOC_TAGS_ID_MASK) != JAVADOC_IMMUTABLE_TAGS_ID)) {
2519
							if (linesAfter < linesGap) {
2585
							if (linesAfter < linesGap) {
2520
								linesAfter = linesGap;
2586
								linesAfter = linesGap;
2521
							}
2587
							}
Lines 2652-2658 Link Here
2652
2718
2653
		boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isDescription();
2719
		boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isDescription();
2654
		boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isParamTag();
2720
		boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isParamTag();
2655
		boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2721
		boolean headerLine = (buffer.indexOf(Util.LINE_SEPARATOR) < 0) && block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2656
		StringBuffer textBuffer = isHtmlTag ? new StringBuffer() : buffer;
2722
		StringBuffer textBuffer = isHtmlTag ? new StringBuffer() : buffer;
2657
		
2723
		
2658
		// First we need to know what is the indentation
2724
		// First we need to know what is the indentation
Lines 2689-2694 Link Here
2689
			this.scanner.resetTo(textStart, textEnd);
2755
			this.scanner.resetTo(textStart, textEnd);
2690
			this.scanner.skipComments = true;
2756
			this.scanner.skipComments = true;
2691
			int previousToken = -1;
2757
			int previousToken = -1;
2758
			boolean openedString  =false;
2692
2759
2693
			// Consume text token per token
2760
			// Consume text token per token
2694
    		while (!this.scanner.atEnd()) {
2761
    		while (!this.scanner.atEnd()) {
Lines 2696-2713 Link Here
2696
				try {
2763
				try {
2697
					token = this.scanner.getNextToken();
2764
					token = this.scanner.getNextToken();
2698
				} catch (InvalidInputException iie) {
2765
				} catch (InvalidInputException iie) {
2766
					boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE;
2699
					String msg = iie.getMessage();
2767
					String msg = iie.getMessage();
2700
					if (msg == Scanner.INVALID_CHARACTER_CONSTANT) {
2768
					if (msg == Scanner.INVALID_CHARACTER_CONSTANT) {
2769
						if (insertSpace) {
2770
							buffer.append(' ');
2771
							this.column++;
2772
						}
2701
						buffer.append('\'');
2773
						buffer.append('\'');
2774
						this.column++;
2702
					} else if (msg == Scanner.INVALID_CHAR_IN_STRING) {
2775
					} else if (msg == Scanner.INVALID_CHAR_IN_STRING) {
2776
						if (openedString) {
2777
							openedString = false;
2778
						} else {
2779
							if (insertSpace) {
2780
								buffer.append(' ');
2781
								this.column++;
2782
							}
2783
							openedString = true;
2784
						}
2703
						buffer.append('"');
2785
						buffer.append('"');
2786
						this.column++;
2704
					} else {
2787
					} else {
2705
						// skip failure
2788
						// skip failure
2706
					}
2789
					}
2707
					this.column++;
2708
					// Need to retrieve correct position
2790
					// Need to retrieve correct position
2709
					this.scanner.resetTo(this.scanner.startPosition, textEnd);
2791
					this.scanner.resetTo(this.scanner.startPosition, textEnd);
2710
					this.scanner.getNextChar();
2792
					this.scanner.getNextChar();
2793
					previousToken = 1;
2711
					continue;
2794
					continue;
2712
				}
2795
				}
2713
				if (token == TerminalTokens.TokenNameWHITESPACE) {
2796
				if (token == TerminalTokens.TokenNameWHITESPACE) {
Lines 2734-2740 Link Here
2734
			    	this.column = 1;
2817
			    	this.column = 1;
2735
			    	printIndentationIfNecessary(buffer);
2818
			    	printIndentationIfNecessary(buffer);
2736
		    		buffer.append(BLOCK_LINE_PREFIX);
2819
		    		buffer.append(BLOCK_LINE_PREFIX);
2737
			    	this.column = firstColumn;
2820
			    	this.column = headerLine ? firstColumn-1 : firstColumn;
2738
			    	if (indentationBuffer != null) {
2821
			    	if (indentationBuffer != null) {
2739
			    		buffer.append(indentationBuffer);
2822
			    		buffer.append(indentationBuffer);
2740
			    	}
2823
			    	}
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java (-17 / +22 lines)
Lines 156-168 Link Here
156
			// Text breakage
156
			// Text breakage
157
			if (lastText.isHtmlTag() && text != null) {
157
			if (lastText.isHtmlTag() && text != null) {
158
				// Set some lines before if previous was specific html tag
158
				// Set some lines before if previous was specific html tag
159
				switch (lastText.getHtmlTagID()) {
159
				if (lastText.separatorsPtr == -1 || lastText.isClosingHtmlTag()) {
160
					case JAVADOC_CODE_TAGS_ID:
160
					switch (lastText.getHtmlTagID()) {
161
						text.linesBefore = 2;
161
						case JAVADOC_CODE_TAGS_ID:
162
						break;
162
							if (text.linesBefore < 2) {
163
					case JAVADOC_SEPARATOR_TAGS_ID:
163
								text.linesBefore = 2;
164
			    	case JAVADOC_SINGLE_BREAK_TAG_ID:
164
							}
165
						if (text.linesBefore < 1) text.linesBefore = 1;
165
							break;
166
						case JAVADOC_SEPARATOR_TAGS_ID:
167
				    	case JAVADOC_SINGLE_BREAK_TAG_ID:
168
							if (text.linesBefore < 1) {
169
								text.linesBefore = 1;
170
							}
171
					}
166
				}
172
				}
167
				// If adding an html tag on same html tag, then close previous one and leave
173
				// If adding an html tag on same html tag, then close previous one and leave
168
				if (text.isHtmlTag() && !text.isClosingHtmlTag() && text.getHtmlTagIndex() == lastText.getHtmlTagIndex() && !lastText.isClosingHtmlTag()) {
174
				if (text.isHtmlTag() && !text.isClosingHtmlTag() && text.getHtmlTagIndex() == lastText.getHtmlTagIndex() && !lastText.isClosingHtmlTag()) {
Lines 269-292 Link Here
269
	return false;
275
	return false;
270
}
276
}
271
277
272
/* (non-Javadoc)
278
protected void toString(StringBuffer buffer) {
273
 * @see java.lang.Object#toString()
274
 */
275
public String toString() {
276
	StringBuffer buffer = new StringBuffer();
277
	if ((this.flags & INLINED) != 0) buffer.append('{');
279
	if ((this.flags & INLINED) != 0) buffer.append('{');
278
	buffer.append('@');
280
	buffer.append('@');
279
	buffer.append(this.tagValue);
281
	buffer.append(this.tagValue);
280
	if (this.reference != null) {
282
	super.toString(buffer);
281
		buffer.append(' ');
283
	if (this.reference == null) {
282
		buffer.append(this.reference);
284
		buffer.append('\n');
285
	} else {
286
		buffer.append(" ("); //$NON-NLS-1$
287
		this.reference.toString(buffer);
288
		buffer.append(")\n"); //$NON-NLS-1$
283
	}
289
	}
284
	if (this.nodesPtr > -1) {
290
	if (this.nodesPtr > -1) {
285
		for (int i = 0; i <= this.nodesPtr; i++) {
291
		for (int i = 0; i <= this.nodesPtr; i++) {
286
			buffer.append(this.nodes[i]);
292
			this.nodes[i].toString(buffer);
287
		}
293
		}
288
	}
294
	}
289
	return buffer.toString();
290
}
295
}
291
296
292
public String toStringDebug(char[] source) {
297
public String toStringDebug(char[] source) {
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocReference.java (-7 / +3 lines)
Lines 38-49 Link Here
38
	// Clean positions when used
38
	// Clean positions when used
39
}
39
}
40
40
41
public String toString() {
41
protected void toString(StringBuffer buffer) {
42
	StringBuffer buffer = new StringBuffer("[FJRef] - at offset: ");	//$NON-NLS-1$
42
	buffer.append("ref");	//$NON-NLS-1$
43
	buffer.append(this.sourceStart);
43
	super.toString(buffer);
44
	buffer.append(" end position: ");	//$NON-NLS-1$
45
	buffer.append(this.sourceEnd);
46
	buffer.append('\n');
47
	return buffer.toString();
48
}
44
}
49
}
45
}
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocNode.java (+16 lines)
Lines 39-44 Link Here
39
	return null;
39
	return null;
40
}
40
}
41
41
42
public int getLength() {
43
	return this.sourceEnd - this.sourceStart + 1;	
44
}
45
42
/**
46
/**
43
 * Returns whether the node is a text (see {@link FormatJavadocText} or not.
47
 * Returns whether the node is a text (see {@link FormatJavadocText} or not.
44
 * In case not, that means that the node is an block (see
48
 * In case not, that means that the node is an block (see
Lines 51-56 Link Here
51
	return false;
55
	return false;
52
}
56
}
53
57
58
public String toString() {
59
	StringBuffer buffer = new StringBuffer();
60
	toString(buffer);
61
	return buffer.toString();
62
}
63
protected void toString(StringBuffer buffer) {
64
	buffer.append(": "); //$NON-NLS-1$
65
	buffer.append(this.sourceStart);
66
	buffer.append(" -> ");	//$NON-NLS-1$
67
	buffer.append(this.sourceEnd);
68
}
69
54
public String toStringDebug(char[] source) {
70
public String toStringDebug(char[] source) {
55
	StringBuffer buffer = new StringBuffer();
71
	StringBuffer buffer = new StringBuffer();
56
	toStringDebug(buffer, source);
72
	toStringDebug(buffer, source);
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X04b.java (-49 lines)
Removed Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>
5
 * P1:
6
 * <ul>
7
 * <li>T1.L1<b>B1<i>I1</i></b><br>
8
 * T1.L11 </li>
9
 * <li><b>T1.L2</b>
10
 * 
11
 * <pre>
12
 * immutable
13
 * </pre>
14
 * 
15
 * <p>
16
 * T1.L2.P1
17
 * <ul>
18
 * <li>T1.L2.T2.L1 <i>I2</i>.
19
 * <li>T1.L2.T2.L2</i>.
20
 * <p>
21
 * T1.L2.T2.L2.P1 with string":".
22
 * </ul>
23
 * <p>
24
 * T1.L2.P2 end.
25
 * <p>
26
 * T1.L2.P3
27
 * </ul>
28
 * <li>X.L1
29
 * 
30
 * <pre>
31
 *    [application-args] := *( &quot;:&quot; [value])
32
 *    [value] := [token] | [quoted-string]
33
 * </pre>
34
 * 
35
 * <p>
36
 * X.L2.P1 </li>
37
 * <p>
38
 * P2
39
 * <p>
40
 * P3
41
 * <ul>
42
 * <li>T2.L1
43
 * <li>T2.L2
44
 * <li>T2.L3
45
 * </ul>
46
 */
47
public class X04b {
48
49
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X04c.java (-23 lines)
Removed Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>
5
 * P:
6
 * <ul>
7
 * <li>L
8
 * <p>
9
 * PL
10
 * <ul>
11
 * <li>PLTL
12
 * <p>
13
 * PLTLP
14
 * </ul>
15
 * <p>
16
 * PL2
17
 * <p>
18
 * PL3
19
 * </ul>
20
 */
21
public class X04c {
22
23
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X04c.java (-18 lines)
Removed Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>P:
5
 * <ul>
6
 * <li>L
7
 * <p>PL
8
 * <ul>
9
 * <li>PLTL
10
 * <p>PLTLP
11
 * </ul>
12
 * <p>PL2
13
*  <p>PL3
14
 * </ul>
15
 */
16
public class X04c {
17
18
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X04b.java (-41 lines)
Removed Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>P1:
5
 * <ul>
6
 * <li>T1.L1<b>B1<i>I1</i></b><br>
7
 *   T1.L11
8
 * </li>
9
 * <li><b>T1.L2</b>
10
 * <pre>
11
 * immutable
12
 * </pre>
13
 *   <p>T1.L2.P1
14
 *   <ul>
15
 *   <li>T1.L2.T2.L1 <i>I2</i>.
16
 *   <li>T1.L2.T2.L2</i>.
17
 *   <p>T1.L2.T2.L2.P1
18
 *   with string":".
19
 *   </ul>
20
 *   <p>T1.L2.P2
21
 *   end.
22
 *   <p>T1.L2.P3
23
 * </ul>
24
 * <li>X.L1
25
 * <pre>
26
 *    [application-args] := *( ":" [value])
27
 *    [value] := [token] | [quoted-string]
28
 * </pre>
29
 * <p>X.L2.P1
30
 * </li>
31
 * <p>P2
32
 * <p>P3
33
 * <ul>
34
 * <li>T2.L1
35
 * <li>T2.L2
36
 * <li>T2.L3
37
 * </ul>
38
 */
39
public class X04b {
40
41
}
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java (-7 / +7 lines)
Lines 132-144 Link Here
132
 * <ul>
132
 * <ul>
133
 * 	<li>3.0 performance workspace (9951 units):<ul>
133
 * 	<li>3.0 performance workspace (9951 units):<ul>
134
 * 		<li>0 error</li>
134
 * 		<li>0 error</li>
135
 * 		<li>418 failures</li>
135
 * 		<li>199 failures</li>
136
 * 		<li>690 different lines leading spaces</li>
136
 * 		<li>751 different lines leading spaces</li>
137
 *		</ul></li>
137
 *		</ul></li>
138
 *		<li>ganymede workspace (25819 units):<ul>
138
 *		<li>ganymede workspace (25819 units):<ul>
139
 * 		<li>0 error</li>
139
 * 		<li>0 error</li>
140
 * 		<li>4011 failures</li>
140
 * 		<li>376 failures</li>
141
 * 		<li>1079 different lines leading spaces</li>
141
 * 		<li>1350 different lines leading spaces</li>
142
 *		</ul></li>
142
 *		</ul></li>
143
 * </ul>
143
 * </ul>
144
 * 
144
 * 
Lines 146-154 Link Here
146
 * <code>all</code> (e.g. ignore all white spaces):
146
 * <code>all</code> (e.g. ignore all white spaces):
147
 * <ul>
147
 * <ul>
148
 * 	<li>3.0 performance workspace (9951 units):<ul>
148
 * 	<li>3.0 performance workspace (9951 units):<ul>
149
 * 		<li>? error</li>
149
 * 		<li>0 error</li>
150
 * 		<li>? failures</li>
150
 * 		<li>376 failures</li>
151
 * 		<li>? different spaces</li>
151
 * 		<li>732 different spaces</li>
152
 *		</ul></li>
152
 *		</ul></li>
153
 *		<li>ganymede workspace (25819 units):<ul>
153
 *		<li>ganymede workspace (25819 units):<ul>
154
 * 		<li>? error</li>
154
 * 		<li>? error</li>
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java (+54 lines)
Lines 794-799 Link Here
794
public void testBlockComments07() throws JavaModelException {
794
public void testBlockComments07() throws JavaModelException {
795
	formatUnit("comments.block", "X07.java");
795
	formatUnit("comments.block", "X07.java");
796
}
796
}
797
public void testBlockComments08() throws JavaModelException {
798
	formatUnit("comments.block", "X08.java");
799
}
800
public void testBlockComments09() throws JavaModelException {
801
	formatUnit("comments.block", "X09.java");
802
}
803
public void testBlockComments10() throws JavaModelException {
804
	formatUnit("comments.block", "X10.java");
805
}
797
806
798
/*
807
/*
799
 * Test formatter on example got from workspaces
808
 * Test formatter on example got from workspaces
Lines 815-820 Link Here
815
public void _testWkspEclipse04() throws JavaModelException {
824
public void _testWkspEclipse04() throws JavaModelException {
816
	formatUnit("wksp.eclipse", "X04.java");
825
	formatUnit("wksp.eclipse", "X04.java");
817
}
826
}
827
public void testWkspEclipse05() throws JavaModelException {
828
	formatUnit("wksp.eclipse", "X05.java");
829
}
830
public void testWkspEclipse06() throws JavaModelException {
831
	formatUnit("wksp.eclipse", "X06.java");
832
}
833
public void testWkspEclipse07() throws JavaModelException {
834
	formatUnit("wksp.eclipse", "X07.java");
835
}
836
public void testWkspEclipse08() throws JavaModelException {
837
	formatUnit("wksp.eclipse", "X08.java");
838
}
839
public void testWkspEclipse08b() throws JavaModelException {
840
	formatUnit("wksp.eclipse", "X08b.java");
841
}
842
public void testWkspEclipse08c() throws JavaModelException {
843
	formatUnit("wksp.eclipse", "X08c.java");
844
}
845
public void testWkspEclipse09() throws JavaModelException {
846
	formatUnit("wksp.eclipse", "X09.java");
847
}
848
public void testWkspEclipse09b() throws JavaModelException {
849
	formatUnit("wksp.eclipse", "X09b.java");
850
}
851
public void testWkspEclipse10() throws JavaModelException {
852
	formatUnit("wksp.eclipse", "X10.java");
853
}
854
public void testWkspEclipse11() throws JavaModelException {
855
	formatUnit("wksp.eclipse", "X11.java");
856
}
857
public void testWkspEclipse11b() throws JavaModelException {
858
	formatUnit("wksp.eclipse", "X11b.java");
859
}
860
public void testWkspEclipse11c() throws JavaModelException {
861
	formatUnit("wksp.eclipse", "X11c.java");
862
}
863
public void testWkspEclipse12() throws JavaModelException {
864
	formatUnit("wksp.eclipse", "X12.java");
865
}
866
public void testWkspEclipse12b() throws JavaModelException {
867
	formatUnit("wksp.eclipse", "X12b.java");
868
}
869
public void testWkspEclipse13() throws JavaModelException {
870
	formatUnit("wksp.eclipse", "X13.java");
871
}
818
// JUnit 3.8.2
872
// JUnit 3.8.2
819
public void testWkspJUnit01() throws JavaModelException {
873
public void testWkspJUnit01() throws JavaModelException {
820
	formatUnit("wksp.junit", "X01.java");
874
	formatUnit("wksp.junit", "X01.java");
(-)workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X17c.java (-1 / +1 lines)
Lines 14-20 Link Here
14
	 * 	<ul>
14
	 * 	<ul>
15
	 * 	<li>this element does not exist</li>
15
	 * 	<li>this element does not exist</li>
16
	 * 	<li>an exception occurs while accessing its corresponding resource</li>
16
	 * 	<li>an exception occurs while accessing its corresponding resource</li>
17
	 * 	<li>a classpath variable or classpath container was not resolvable and 
17
	 * 	<li>a classpath variable or classpath container was not resolvable and
18
	 * 	<code>ignoreUnresolvedEntry</code> is <code>false</code> .</li>
18
	 * 	<code>ignoreUnresolvedEntry</code> is <code>false</code> .</li>
19
	 * 	</ul>
19
	 * 	</ul>
20
	 * @see String
20
	 * @see String
(-)workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X17c.java (-1 / +1 lines)
Lines 14-20 Link Here
14
	 * <ul>
14
	 * <ul>
15
	 * <li>this element does not exist</li>
15
	 * <li>this element does not exist</li>
16
	 * <li>an exception occurs while accessing its corresponding resource</li>
16
	 * <li>an exception occurs while accessing its corresponding resource</li>
17
	 * <li>a classpath variable or classpath container was not resolvable and 
17
	 * <li>a classpath variable or classpath container was not resolvable and
18
	 * <code>ignoreUnresolvedEntry</code> is <code>false</code> .</li>
18
	 * <code>ignoreUnresolvedEntry</code> is <code>false</code> .</li>
19
	 * </ul>
19
	 * </ul>
20
	 * @see String
20
	 * @see String
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X10.java (+21 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X10 {
4
5
	/**
6
	 * Returns a complete node containing the contents of the subtree rooted at
7
	 * 
8
	 * @key in the receiver. Uses the public API.
9
	 */
10
	void foo(String key) {
11
	}
12
13
	/**
14
	 * Returns a complete node containing the contents of the subtree rooted at
15
	 * 
16
	 * @key in the receiver. Returns null if this node does not exist in the
17
	 * tree. This is a thread-safe version of naiveCopyCompleteSubtree
18
	 */
19
	void bar(String key) {
20
	}
21
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X09b.java (+7 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X09b {
4
5
	/** Test_immutable_tag_____at_the_end_of_line (value: <code>enablement</code>) */
6
	int foo82;
7
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X06.java (+13 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X06 {
4
5
	/**
6
	 * Creates the project location specification controls.
7
	 *
8
	 * @param projectGroup the parent composite
9
	 * @param boolean - the initial enabled state of the widgets created
10
	 */
11
	void foo(Object projectGroup, boolean enabled) {
12
	}
13
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X07.java (+11 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X07 {
4
	/**
5
	 * The proposal mode for the current content assist
6
	 * 
7
	 * @see determineProposalMode(IDocument, int, String)
8
	 */
9
	int currentProposalMode = -1;
10
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X12.java (+11 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X12 {
4
5
	/**
6
	 * The unique identifier constant (value "
7
	 * <code>org.eclipse.core.runtime</code>") of the Core Runtime (pseudo-)
8
	 * plug-in.
9
	 */
10
	int foo;
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X05.java (+16 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X05 {
4
5
	/**
6
	 * Adds standard actions to the given <code>ToolBarManager</code>.
7
	 * <p>
8
	 * Subclasses may override to add their own actions.
9
	 * </p>
10
	 * 
11
	 * @param toolBarManager
12
	 * 		the <code>ToolBarManager</code> to which to contribute
13
	 */
14
	void foo(Object toolBarManager) {
15
	}
16
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X05.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X05 {
4
5
	/**
6
	 * Adds standard actions to the given <code>ToolBarManager</code>.
7
	 * <p>
8
	 * Subclasses may override to add their own actions.
9
	 * </p>
10
	 * 
11
	 * @param toolBarManager the <code>ToolBarManager</code> to which to contribute
12
	 */
13
	void foo(Object toolBarManager) {
14
	}
15
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X09.java (+13 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X09 {
4
5
	/** Test_immutable_tag___at_the_end_of_line (value: <code>enablement</code>) */
6
	int foo80;
7
	
8
	/** Test_immutable_tag____at_the_end_of_line (value: <code>enablement</code>) */
9
	int foo81;
10
	
11
	/** Test_immutable_tag___________at_the_end_of_line (value: <code>enablement</code>) */
12
	int foo88;
13
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X05.java (+16 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X05 {
4
5
	/**
6
	 * Adds standard actions to the given <code>ToolBarManager</code>.
7
	 * <p>
8
	 * Subclasses may override to add their own actions.
9
	 * </p>
10
	 * 
11
	 * @param toolBarManager
12
	 * the <code>ToolBarManager</code> to which to contribute
13
	 */
14
	void foo(Object toolBarManager) {
15
	}
16
}
(-)workspace/FormatterJavadoc/test/comments/block/X08.java (+14 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X08 {
4
	void foo(boolean condition) {
5
		if (true) {
6
			if (true) {
7
				if (true) {
8
					if (condition /* && useChange(d.fDirection) && !d.fIsWhitespace */) {
9
					}
10
				}
11
			}
12
		}
13
	}
14
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X06 {
4
5
	/**
6
	 * Creates the project location specification controls.
7
	 * 
8
	 * @param projectGroup
9
	 * 	the parent composite
10
	 * @param boolean
11
	 * 	- the initial enabled state of the widgets created
12
	 */
13
	void foo(Object projectGroup, boolean enabled) {
14
	}
15
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X11.java (+10 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X11 {
4
5
	/** Status code constant (value 269) indicating a resource unexpectedly 
6
	 * does not exist on the local file system.
7
	 * Severity: error. Category: local file system.
8
	 */
9
	int foo;
10
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X09b.java (+10 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X09b {
4
5
	/**
6
	 * Test_immutable_tag_____at_the_end_of_line (value: <code>enablement</code>
7
	 * )
8
	 */
9
	int foo82;
10
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X10.java (+21 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X10 {
4
5
	/**
6
	 * Returns a complete node containing the contents of the subtree rooted at
7
	 * 
8
	 * @key in the receiver. Uses the public API.
9
	 */
10
	void foo(String key) {
11
	}
12
13
	/**
14
	 * Returns a complete node containing the contents of the subtree rooted at
15
	 * 
16
	 * @key in the receiver. Returns null if this node does not exist in the
17
	 * 	tree. This is a thread-safe version of naiveCopyCompleteSubtree
18
	 */
19
	void bar(String key) {
20
	}
21
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X08.java (+57 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * A compare operation which can present its results in a special editor.
5
 * Running the compare operation and presentating the results in a compare editor
6
 * are combined in one class because it allows a client to keep the implementation
7
 * all in one place while separating it from the innards of a specific UI implementation of compare/merge.
8
 * <p> 
9
 * A <code>CompareEditorInput</code> defines methods for the following sequence steps:
10
 * <UL>
11
 * <LI>running a lengthy compare operation under progress monitor control,
12
 * <LI>creating a UI for displaying the model and initializing the some widgets with the compare result,
13
 * <LI>tracking the dirty state of the model in case of merge,
14
 * <LI>saving the model.
15
 * </UL>
16
 * The Compare plug-in's <code>openCompareEditor</code> method takes an <code>ICompareEditorInput</code>
17
 * and starts sequencing through the above steps. If the compare result is not empty a new compare editor
18
 * is opened and takes over the sequence until eventually closed.
19
 * <p>
20
 * The <code>prepareInput</code> method should contain the
21
 * code of the compare operation. It is executed under control of a progress monitor
22
 * and can be canceled. If the result of the compare is not empty, that is if there are differences
23
 * that needs to be presented, the <code>ICompareEditorInput</code> should hold onto them and return them with
24
 * the <code>getCompareResult</code> method.
25
 * If the value returned from <code>getCompareResult</code> is not <code>null</code>
26
 * a compare editor is opened on the <code>ICompareEditorInput</code> with title and title image initialized by the
27
 * corresponding methods of the <code>ICompareEditorInput</code>.
28
 * <p>
29
 * Creation of the editor's SWT controls is delegated to the <code>createContents</code> method.
30
 * Here the SWT controls must be created and initialized  with the result of the compare operation.
31
 * <p>
32
 * If merging is allowed, the modification state of the compared constituents must be tracked and the dirty
33
 * state returned from method <code>isSaveNeeded</code>. The value <code>true</code> triggers a subsequent call
34
 * to <code>save</code> where the modified resources can be saved.
35
 * <p>
36
 * The most important part of this implementation is the setup of the compare/merge UI.
37
 * The UI uses a simple browser metaphor to present compare results.
38
 * The top half of the layout shows the structural compare results (e.g. added, deleted, and changed files),
39
 * the bottom half the content compare results (e.g. textual differences between two files).
40
 * A selection in the top pane is fed to the bottom pane. If a content viewer is registered
41
 * for the type of the selected object, this viewer is installed in the pane.
42
 * In addition if a structure viewer is registered for the selection type the top pane
43
 * is split horizontally to make room for another pane and the structure viewer is installed
44
 * in it. When comparing Java files this second structure viewer would show the structural
45
 * differences within a Java file, e.g. added, deleted or changed methods and fields.
46
 * <p>
47
 * Subclasses provide custom setups, e.g. for a Catchup/Release operation
48
 * by passing a subclass of <code>CompareConfiguration</code> and by implementing the <code>prepareInput</code> method.
49
 * If a subclass cannot use the <code>DiffTreeViewer</code> which is installed by default in the
50
 * top left pane, method <code>createDiffViewer</code> can be overridden.
51
 * 
52
 * @see CompareUI
53
 * @see CompareEditorInput
54
 */
55
public class X08 {
56
57
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X08b.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>
5
 * Subclasses provide custom setups, e.g. for a Catchup/Release operation
6
 * by passing a subclass of <code>CompareConfiguration</code> and by implementing the <code>prepareInput</code> method.
7
 * If a subclass cannot use the <code>DiffTreeViewer</code> which is installed by default in the
8
 * top left pane, method <code>createDiffViewer</code> can be overridden.
9
 * 
10
 * @see CompareUI
11
 * @see CompareEditorInput
12
 */
13
public class X08b {
14
15
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X08.java (+68 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * A compare operation which can present its results in a special editor.
5
 * Running the compare operation and presentating the results in a compare
6
 * editor are combined in one class because it allows a client to keep the
7
 * implementation all in one place while separating it from the innards of a
8
 * specific UI implementation of compare/merge.
9
 * <p>
10
 * A <code>CompareEditorInput</code> defines methods for the following sequence
11
 * steps:
12
 * <UL>
13
 * <LI>running a lengthy compare operation under progress monitor control,
14
 * <LI>creating a UI for displaying the model and initializing the some widgets
15
 * with the compare result,
16
 * <LI>tracking the dirty state of the model in case of merge,
17
 * <LI>saving the model.
18
 * </UL>
19
 * The Compare plug-in's
20
 * <code>openCompareEditor</code> method takes an
21
 * <code>ICompareEditorInput</code> and starts sequencing through the above
22
 * steps. If the compare result is not empty a new compare editor is opened and
23
 * takes over the sequence until eventually closed.
24
 * <p>
25
 * The <code>prepareInput</code> method should contain the code of the compare
26
 * operation. It is executed under control of a progress monitor and can be
27
 * canceled. If the result of the compare is not empty, that is if there are
28
 * differences that needs to be presented, the <code>ICompareEditorInput</code>
29
 * should hold onto them and return them with the <code>getCompareResult</code>
30
 * method. If the value returned from <code>getCompareResult</code> is not
31
 * <code>null</code> a compare editor is opened on the
32
 * <code>ICompareEditorInput</code> with title and title image initialized by
33
 * the corresponding methods of the <code>ICompareEditorInput</code>.
34
 * <p>
35
 * Creation of the editor's SWT controls is delegated to the
36
 * <code>createContents</code> method. Here the SWT controls must be created and
37
 * initialized with the result of the compare operation.
38
 * <p>
39
 * If merging is allowed, the modification state of the compared constituents
40
 * must be tracked and the dirty state returned from method
41
 * <code>isSaveNeeded</code> . The value <code>true</code> triggers a subsequent
42
 * call to <code>save</code> where the modified resources can be saved.
43
 * <p>
44
 * The most important part of this implementation is the setup of the compare/
45
 * merge UI. The UI uses a simple browser metaphor to present compare results.
46
 * The top half of the layout shows the structural compare results (e.g. added,
47
 * deleted, and changed files), the bottom half the content compare results (e.g
48
 * . textual differences between two files). A selection in the top pane is fed
49
 * to the bottom pane. If a content viewer is registered for the type of the
50
 * selected object, this viewer is installed in the pane. In addition if a
51
 * structure viewer is registered for the selection type the top pane is split
52
 * horizontally to make room for another pane and the structure viewer is
53
 * installed in it. When comparing Java files this second structure viewer would
54
 * show the structural differences within a Java file, e.g. added, deleted or
55
 * changed methods and fields.
56
 * <p>
57
 * Subclasses provide custom setups, e.g. for a Catchup/Release operation by
58
 * passing a subclass of <code>CompareConfiguration</code> and by implementing
59
 * the <code>prepareInput</code> method. If a subclass cannot use the
60
 * <code>DiffTreeViewer</code> which is installed by default in the top left
61
 * pane, method <code>createDiffViewer</code> can be overridden.
62
 * 
63
 * @see CompareUI
64
 * @see CompareEditorInput
65
 */
66
public class X08 {
67
68
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X06 {
4
5
	/**
6
	 * Creates the project location specification controls.
7
	 * 
8
	 * @param projectGroup
9
	 * the parent composite
10
	 * @param boolean
11
	 * - the initial enabled state of the widgets created
12
	 */
13
	void foo(Object projectGroup, boolean enabled) {
14
	}
15
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X12b.java (+10 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X12b {
4
5
	/**
6
	 * The unique identifier constant (value "
7
	 * <code>org.eclipse.core.boot</code>") of the Core Boot (pseudo-) plug-in.
8
	 */
9
	int foo;
10
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X08b.java (+16 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>
5
 * Subclasses provide custom setups, e.g. for a Catchup/Release operation by
6
 * passing a subclass of <code>CompareConfiguration</code> and by implementing
7
 * the <code>prepareInput</code> method. If a subclass cannot use the
8
 * <code>DiffTreeViewer</code> which is installed by default in the top left
9
 * pane, method <code>createDiffViewer</code> can be overridden.
10
 * 
11
 * @see CompareUI
12
 * @see CompareEditorInput
13
 */
14
public class X08b {
15
16
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X12.java (+10 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X12 {
4
5
	/**
6
	 * The unique identifier constant (value "<code>org.eclipse.core.runtime</code>")
7
	 * of the Core Runtime (pseudo-) plug-in.
8
	 */
9
	int foo;
10
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X07.java (+10 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X07 {
4
	/**
5
	 * The proposal mode for the current content assist
6
     * @see determineProposalMode(IDocument, int, String)
7
     */
8
	int currentProposalMode= -1;
9
10
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X13.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X13 {
4
5
	/**
6
	 * Returns the string from the plugin's resource bundle,
7
	 * or 'key' if not found.
8
	 * 
9
	 * @param key the resource string key
10
	 * @return the resource string for the given key
11
	 */
12
	String foo(String key) {
13
		return null;
14
	}
15
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X05.java (+16 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X05 {
4
5
	/**
6
	 * Adds standard actions to the given <code>ToolBarManager</code>.
7
	 * <p>
8
	 * Subclasses may override to add their own actions.
9
	 * </p>
10
	 * 
11
	 * @param toolBarManager
12
	 * 	the <code>ToolBarManager</code> to which to contribute
13
	 */
14
	void foo(Object toolBarManager) {
15
	}
16
}
(-)workspace/FormatterJavadoc/test/comments/block/out/default/X10.java (+11 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X10 {
4
5
	/*
6
	 * (Intentionally not javadoc'd) Implements the corresponding method on
7
	 * <code>IStatus</code>.
8
	 */
9
	void foo() {
10
	}
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X08c.java (+12 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>
5
 * The Compare plug-in's <code>openCompareEditor</code> method takes an
6
 * <code>ICompareEditorInput</code> and starts sequencing through the above
7
 * steps. If the compare result is not empty a new compare editor is opened and
8
 * takes over the sequence until eventually closed.
9
 */
10
public class X08c {
11
12
}
(-)workspace/FormatterJavadoc/test/comments/block/out/default/X09.java (+11 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X09 {
4
5
	/*
6
	 * (non-Javadoc) Recursively calls setMaximizedControl for all direct
7
	 * parents that are itself Splitters.
8
	 */
9
	void foo() {
10
	}
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X09.java (+19 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X09 {
4
5
	/** Test_immutable_tag___at_the_end_of_line (value: <code>enablement</code>) */
6
	int foo80;
7
8
	/**
9
	 * Test_immutable_tag____at_the_end_of_line (value: <code>enablement</code>
10
	 * )
11
	 */
12
	int foo81;
13
14
	/**
15
	 * Test_immutable_tag___________at_the_end_of_line (value:
16
	 * <code>enablement</code>)
17
	 */
18
	int foo88;
19
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X10.java (+19 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X10 {
4
5
	/**
6
	 * Returns a complete node containing the contents of the subtree rooted at
7
	 * @key in the receiver. Uses the public API.
8
	 */
9
	void foo(String key) {
10
	}
11
12
	/**
13
	 * Returns a complete node containing the contents of the subtree rooted at
14
	 * @key in the receiver. Returns null if this node does not exist in the
15
	 * tree. This is a thread-safe version of naiveCopyCompleteSubtree
16
	 */
17
	void bar(String key) {
18
	}
19
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X11b.java (+13 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X11b {
4
5
	/** Status code constant (value 380) indicating that an attempt was made to modify 
6
	 * the workspace while it was locked.  Resource changes are disallowed
7
	 * during certain types of resource change event notification. 
8
	 * Severity: error. Category: workspace.
9
	 * @see IResourceChangeEvent
10
	 * @since 2.1
11
	 */
12
	int foo;
13
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X11c.java (+12 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X11c {
4
5
	/**
6
	 * Status code constant (value 378) indicating that linking is not permitted
7
	 * on a certain project. Severity: error. Category: workspace.
8
	 * 
9
	 * @since 2.1
10
	 */
11
	int foo;
12
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X06 {
4
5
	/**
6
	 * Creates the project location specification controls.
7
	 * 
8
	 * @param projectGroup
9
	 * 		the parent composite
10
	 * @param boolean
11
	 * 		- the initial enabled state of the widgets created
12
	 */
13
	void foo(Object projectGroup, boolean enabled) {
14
	}
15
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X11c.java (+11 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X11c {
4
5
	/** Status code constant (value 378) indicating that linking is
6
	 * not permitted on a certain project.
7
	 * Severity: error. Category: workspace.
8
	 * @since 2.1
9
	 */
10
	int foo;
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X13.java (+16 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X13 {
4
5
	/**
6
	 * Returns the string from the plugin's resource bundle, or 'key' if not
7
	 * found.
8
	 * 
9
	 * @param key
10
	 * 		the resource string key
11
	 * @return the resource string for the given key
12
	 */
13
	String foo(String key) {
14
		return null;
15
	}
16
}
(-)workspace/FormatterJavadoc/test/comments/block/X10.java (+10 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X10 {
4
5
	/* (Intentionally not javadoc'd)
6
	 * Implements the corresponding method on <code>IStatus</code>.
7
	 */
8
	void foo() {
9
	}
10
}
(-)workspace/FormatterJavadoc/test/comments/block/X09.java (+11 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X09 {
4
5
	/* (non-Javadoc)
6
	 * Recursively calls setMaximizedControl for all direct parents that are
7
	 * itself Splitters.
8
	 */
9
	void foo() {
10
	}
11
}
(-)workspace/FormatterJavadoc/test/comments/block/out/default/X08.java (+17 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X08 {
4
	void foo(boolean condition) {
5
		if (true) {
6
			if (true) {
7
				if (true) {
8
					if (condition /*
9
									 * && useChange(d.fDirection) && !d.
10
									 * fIsWhitespace
11
									 */) {
12
					}
13
				}
14
			}
15
		}
16
	}
17
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X08c.java (+11 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
/**
4
 * <p>
5
 * The Compare plug-in's <code>openCompareEditor</code> method takes an <code>ICompareEditorInput</code>
6
 * and starts sequencing through the above steps. If the compare result is not empty a new compare editor
7
 * is opened and takes over the sequence until eventually closed.
8
 */
9
public class X08c {
10
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X11.java (+11 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X11 {
4
5
	/**
6
	 * Status code constant (value 269) indicating a resource unexpectedly does
7
	 * not exist on the local file system. Severity: error. Category: local file
8
	 * system.
9
	 */
10
	int foo;
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X12b.java (+10 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X12b {
4
5
	/**
6
	 * The unique identifier constant (value "<code>org.eclipse.core.boot</code>")
7
	 * of the Core Boot (pseudo-) plug-in.
8
	 */
9
	int foo;
10
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X11b.java (+15 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X11b {
4
5
	/**
6
	 * Status code constant (value 380) indicating that an attempt was made to
7
	 * modify the workspace while it was locked. Resource changes are disallowed
8
	 * during certain types of resource change event notification. Severity:
9
	 * error. Category: workspace.
10
	 * 
11
	 * @see IResourceChangeEvent
12
	 * @since 2.1
13
	 */
14
	int foo;
15
}

Return to bug 227043