private int getIndentSize() { return CodeFormatterUtil.getIndentWidth(null); }
private int prefIndentationSize() { return CodeFormatterUtil.getIndentWidth(fProject); }
private int prefIndentationSize() { return CodeFormatterUtil.getIndentWidth(fProject); }
private int prefIndentationSize() { return CodeFormatterUtil.getIndentWidth(fProject); }
/** * Removes the common number of indents from all lines. If a line * only consists out of white space it is ignored. * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static void trimIndentation(String[] lines, IJavaProject project) { trimIndentation(lines, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project), true); } /**
/** * Returns the indent of the given string in indentation units. Odd spaces * are not counted. * * @param line the text line * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static int computeIndentUnits(String line, IJavaProject project) { return IndentManipulation.measureIndentUnits(line, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
/** * Removes the given number of indents from the line. Asserts that the given line * has the requested number of indents. If <code>indentsToRemove <= 0</code> * the line is returned. * * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static String trimIndent(String line, int indentsToRemove, IJavaProject project) { return IndentManipulation.trimIndent(line, indentsToRemove, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
/** * Removes the common number of indents from all lines. If a line * only consists out of white space it is ignored. If <code> * considerFirstLine</code> is false the first line will be ignored. * * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static void trimIndentation(String[] lines, IJavaProject project, boolean considerFirstLine) { trimIndentation(lines, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project), considerFirstLine); }
public static CodeGenerationSettings getCodeGenerationSettings(IJavaProject project) { CodeGenerationSettings res= new CodeGenerationSettings(); res.createComments= Boolean.valueOf(JavaManipulation.getPreference(CodeGenerationSettingsConstants.CODEGEN_ADD_COMMENTS, project)).booleanValue(); res.useKeywordThis= Boolean.valueOf(JavaManipulation.getPreference(CodeGenerationSettingsConstants.CODEGEN_KEYWORD_THIS, project)).booleanValue(); res.overrideAnnotation= Boolean.valueOf(JavaManipulation.getPreference(CodeGenerationSettingsConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, project)).booleanValue(); res.importIgnoreLowercase= Boolean.valueOf(JavaManipulation.getPreference(CodeGenerationSettingsConstants.ORGIMPORTS_IGNORELOWERCASE, project)).booleanValue(); res.tabWidth= CodeFormatterUtil.getTabWidth(project); res.indentWidth= CodeFormatterUtil.getIndentWidth(project); return res; }
/** * Removes the common number of indents from all lines. If a line * only consists out of white space it is ignored. * @param lines the lines * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static void trimIndentation(String[] lines, IJavaProject project) { trimIndentation(lines, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project), true); } /**
/** * Change the indent of, possible muti-line, code range. The current indent is removed, a new indent added. * The first line of the code will not be changed. (It is considered to have no indent as it might start in * the middle of a line) * * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static String changeIndent(String code, int codeIndentLevel, IJavaProject project, String newIndent, String lineDelim) { return IndentManipulation.changeIndent(code, codeIndentLevel, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project), newIndent, lineDelim); }
public static CodeGenerationSettings getCodeGenerationSettings(IJavaProject project) { CodeGenerationSettings res= new CodeGenerationSettings(); res.createComments= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_ADD_COMMENTS, project)).booleanValue(); res.useKeywordThis= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_KEYWORD_THIS, project)).booleanValue(); res.overrideAnnotation= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, project)).booleanValue(); res.importIgnoreLowercase= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE, project)).booleanValue(); res.tabWidth= CodeFormatterUtil.getTabWidth(project); res.indentWidth= CodeFormatterUtil.getIndentWidth(project); return res; }
/** * Removes the common number of indents from all lines. If a line * only consists out of white space it is ignored. * @param lines the lines * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @since 3.1 */ public static void trimIndentation(String[] lines, IJavaProject project) { trimIndentation(lines, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project), true); } /**
/** * Returns the indent of the given string in indentation units. Odd spaces * are not counted. * * @param line the text line * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @return the number of indent units * @since 3.1 */ public static int computeIndentUnits(String line, IJavaProject project) { return IndentManipulation.measureIndentUnits(line, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
/** * Returns the indent of the given string in indentation units. Odd spaces * are not counted. * * @param line the text line * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @return the number of indent units * @since 3.1 */ public static int computeIndentUnits(String line, IJavaProject project) { return IndentManipulation.measureIndentUnits(line, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
/** * Returns that part of the indentation of <code>line</code> that makes up * a multiple of indentation units. * * @param line the line to scan * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @return the indent part of <code>line</code>, but no odd spaces * @since 3.1 */ public static String getIndentString(String line, IJavaProject project) { return IndentManipulation.extractIndentString(line, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
/** * Returns that part of the indentation of <code>line</code> that makes up * a multiple of indentation units. * * @param line the line to scan * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @return the indent part of <code>line</code>, but no odd spaces * @since 3.1 */ public static String getIndentString(String line, IJavaProject project) { return IndentManipulation.extractIndentString(line, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
/** * Returns that part of the indentation of <code>line</code> that makes up * a multiple of indentation units. * * @param line the line to scan * @param project the java project from which to get the formatter * preferences, or <code>null</code> for global preferences * @return the indent part of <code>line</code>, but no odd spaces * @since 3.1 */ public static String getIndentString(String line, IJavaProject project) { return IndentManipulation.extractIndentString(line, CodeFormatterUtil.getTabWidth(project), CodeFormatterUtil.getIndentWidth(project)); }
public static CodeGenerationSettings getCodeGenerationSettings(IJavaProject project) { CodeGenerationSettings res= new CodeGenerationSettings(); res.createComments= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_ADD_COMMENTS, project)).booleanValue(); res.useKeywordThis= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_KEYWORD_THIS, project)).booleanValue(); res.overrideAnnotation= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, project)).booleanValue(); res.importOrder= getImportOrderPreference(project); res.importThreshold= getImportNumberThreshold(project); res.staticImportThreshold= getStaticImportNumberThreshold(project); res.importIgnoreLowercase= Boolean.valueOf(PreferenceConstants.getPreference(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE, project)).booleanValue(); res.tabWidth= CodeFormatterUtil.getTabWidth(project); res.indentWidth= CodeFormatterUtil.getIndentWidth(project); return res; }
public static CodeGenerationSettings getCodeGenerationSettings(IResource resource) { IJavaProject project = JavaCore.create(resource.getProject()); CodeGenerationSettings res = new CodeGenerationSettings(); res.overrideAnnotation = true; res.createComments = false; // TODO indentation settings should be retrieved from client/external // settings? res.tabWidth = CodeFormatterUtil.getTabWidth(project); res.indentWidth = CodeFormatterUtil.getIndentWidth(project); return res; }