Java Code Examples for org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#INDENT_ON_COLUMN

The following examples show how to use org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#INDENT_ON_COLUMN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaStringAutoIndentStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns extra indentation string for strings that are broken by a newline
 * based on the value of the formatter preferences for tabs vs. spaces.
 *
 * @return two tabs or equivalent number of spaces
 */
private String getExtraIndentAfterNewLine() {
	// read settings
	int formatterContinuationIndentationSize= getContinuationIndentationSize();
	int binaryAlignmentValue= getBinaryOperatorAlignmentStyle();
	
	// work out indent
	int indentSize= formatterContinuationIndentationSize;
	if (binaryAlignmentValue == DefaultCodeFormatterConstants.INDENT_BY_ONE) {
		indentSize= 1;
	} else if (binaryAlignmentValue == DefaultCodeFormatterConstants.INDENT_ON_COLUMN) {
		// there is no obvious way to work out the current column indent
	}
	
	// generate indentation string with correct size
	return CodeFormatterUtil.createIndentString(indentSize, fProject);
}
 
Example 2
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean prefArrayDeepIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
	try {
		return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}

	return true;
}
 
Example 3
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean prefTernaryDeepAlign() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
	try {
		return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}
	return false;
}
 
Example 4
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean prefMethodDeclDeepIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
	try {
		return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}

	return true;
}
 
Example 5
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean prefMethodCallDeepIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
	try {
		return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}
	return false; // sensible default
}