Java Code Examples for org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#getIndentStyle()

The following examples show how to use org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#getIndentStyle() . 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: LineWrappingTabPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void insertIntoMap(Map<Object, Integer> wrappingMap, Map<Object, Integer> indentMap, Map<Object, Integer> forceMap, Category category) {
         final String value= fWorkingValues.get(category.key);
         Integer wrappingStyle;
         Integer indentStyle;
         Boolean forceWrapping;

         try {
             wrappingStyle= new Integer(DefaultCodeFormatterConstants.getWrappingStyle(value));
             indentStyle= new Integer(DefaultCodeFormatterConstants.getIndentStyle(value));
             forceWrapping= new Boolean(DefaultCodeFormatterConstants.getForceWrapping(value));
         } catch (IllegalArgumentException e) {
	forceWrapping= new Boolean(false);
	indentStyle= new Integer(DefaultCodeFormatterConstants.INDENT_DEFAULT);
	wrappingStyle= new Integer(DefaultCodeFormatterConstants.WRAP_NO_SPLIT);
}

         increaseMapEntry(wrappingMap, wrappingStyle);
         increaseMapEntry(indentMap, indentStyle);
         increaseMapEntry(forceMap, forceWrapping);
     }
 
Example 2
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int prefArrayIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
	try {
		if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
			return 1;
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}

	return prefContinuationIndent(); // default
}
 
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 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 4
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 5
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int prefTernaryIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
	try {
		if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
			return 1;
		else
			return prefContinuationIndent();
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}

	return prefContinuationIndent();
}
 
Example 6
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 7
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int prefMethodDeclIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
	try {
		if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
			return 1;
		else
			return prefContinuationIndent();
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}
	return 1;
}
 
Example 8
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
}
 
Example 9
Source File: JavaIndenter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int prefMethodCallIndent() {
	String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
	try {
		if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
			return 1;
		else
			return prefContinuationIndent();
	} catch (IllegalArgumentException e) {
		// ignore and return default
	}

	return 1; // sensible default
}
 
Example 10
Source File: JavaStringAutoIndentStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private int getBinaryOperatorAlignmentStyle() {
	String binaryAlignmentValue= getCoreFormatterOption(
			DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION);
	return DefaultCodeFormatterConstants.getIndentStyle(binaryAlignmentValue);
}