01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.ui.text.comment;
11:
12: import org.eclipse.jface.text.formatter.FormattingContext;
13:
14: import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
15:
16: /**
17: * Formatting context for the comment formatter.
18: *
19: * @since 3.0
20: */
21: public class CommentFormattingContext extends FormattingContext {
22:
23: /*
24: * @see org.eclipse.jface.text.formatter.IFormattingContext#getPreferenceKeys()
25: */
26: public String[] getPreferenceKeys() {
27: return new String[] {
28: DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT,
29: DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT,
30: DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT,
31: DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER,
32: DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE,
33: DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION,
34: DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_ROOT_TAGS,
35: DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER,
36: DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS,
37: DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH,
38: DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT,
39: DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT,
40: DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML };
41: }
42:
43: /*
44: * @see org.eclipse.jface.text.formatter.IFormattingContext#isBooleanPreference(java.lang.String)
45: */
46: public boolean isBooleanPreference(String key) {
47: return !key
48: .equals(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
49: }
50:
51: /*
52: * @see org.eclipse.jface.text.formatter.IFormattingContext#isIntegerPreference(java.lang.String)
53: */
54: public boolean isIntegerPreference(String key) {
55: return key
56: .equals(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
57: }
58: }
|