KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > formatter > comment > JavaDocLine


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jdt.internal.formatter.comment;
13
14 /**
15  * Javadoc comment line in a comment region.
16  *
17  * @since 3.0
18  */

19 public class JavaDocLine extends MultiCommentLine {
20
21     /** Line prefix of javadoc start lines */
22     public static final String JavaDoc JAVADOC_START_PREFIX= "/**"; //$NON-NLS-1$
23

24     /**
25      * Creates a new javadoc line.
26      *
27      * @param region comment region to create the line for
28      */

29     protected JavaDocLine(final CommentRegion region) {
30         super(region);
31     }
32
33     /*
34      * @see org.eclipse.jdt.internal.corext.text.comment.CommentLine#formatUpperBorder(org.eclipse.jdt.internal.corext.text.comment.CommentRange, java.lang.String, int)
35      */

36     protected void formatUpperBorder(final CommentRange range, final String JavaDoc indentation, final int length) {
37
38         final CommentRegion parent= getParent();
39
40         if (parent.isSingleLine() && parent.getSize() == 1) {
41             parent.logEdit(getStartingPrefix() + CommentRegion.COMMENT_RANGE_DELIMITER, 0, range.getOffset());
42         } else
43             super.formatUpperBorder(range, indentation, length);
44     }
45
46     /*
47      * @see org.eclipse.jdt.internal.corext.text.comment.CommentLine#getStartingPrefix()
48      */

49     protected String JavaDoc getStartingPrefix() {
50         return JAVADOC_START_PREFIX;
51     }
52 }
53
Popular Tags