KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > comment > CommentFormattingContext


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.ui.text.comment;
13
14 import org.eclipse.jface.text.formatter.FormattingContext;
15
16 import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
17
18 /**
19  * Formatting context for the comment formatter.
20  *
21  * @since 3.0
22  */

23 public class CommentFormattingContext extends FormattingContext {
24
25     /*
26      * @see org.eclipse.jface.text.formatter.IFormattingContext#getPreferenceKeys()
27      */

28     public String JavaDoc[] getPreferenceKeys() {
29         return new String JavaDoc[] {
30                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT,
31                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT,
32                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT,
33                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER,
34                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE,
35                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION,
36                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_ROOT_TAGS,
37                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER,
38                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS,
39                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH,
40                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT,
41                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT,
42                 DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML }; }
43
44
45     /*
46      * @see org.eclipse.jface.text.formatter.IFormattingContext#isBooleanPreference(java.lang.String)
47      */

48     public boolean isBooleanPreference(String JavaDoc key) {
49         return !key.equals(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
50     }
51
52     /*
53      * @see org.eclipse.jface.text.formatter.IFormattingContext#isIntegerPreference(java.lang.String)
54      */

55     public boolean isIntegerPreference(String JavaDoc key) {
56         return key.equals(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
57     }
58 }
59
Popular Tags