Bug 80573 Prepare project specific preference options
I200412081200 From Martin's e-mail: I deprecated some methods that access options that will soon be offered per project as well: CodeFormatterUtil.getTabWidth() -> CodeFormatterUtil.getTabWidth(IJavaProject) CodeFormatterUtil.createIndentString(int) -> CodeFormatterUtil.createIndentString(int, IJavaProject) JavaPreferencesSettings.getCodeGenerationSettings() -> JavaPreferencesSettings.getCodeGenerationSettings(IJavaProject) JavaPreferencesSettings.getImportNumberThreshold(IPreferenceStore) -> JavaPreferencesSettings.getImportNumberThreshold(IJavaProject) JavaPreferencesSettings.getImportOrderPreference(IPreferenceStore) -> JavaPreferencesSettings.getImportOrderPreference(IJavaProject) Also make sure to not directly access to the following preference constants: PreferenceConstants.CODEGEN_* PreferenceConstants.ORGIMPORTS_* PreferenceConstants.FORMATTER_COMMENT_* -> Use PreferenceConstants.getPreference(String key, IJavaProject project) to get a JDT.UI preference value using the given project scope DefaultCodeFormatterConstants.* -> Use javaProject.getOption(key, true) to get a preference value using the given scope I fixed most of the references. What is still open: Refactoring:, fix the accesses to the deprecated methods listed above Java Editor, IndentAction, JavaAutoIndentStrategy, ...: Check all accesses to DefaultCodeFormatterConstants, e.g. FORMATTER_TAB_SIZE, FORMATTER_TAB_CHAR to see if the OverlayPreferenceStore is used
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaIndenter.java
* 
	 * @param start the start of the document region to copy the indent from
	 * @param indent the exclusive end of the document region to copy the indent
	 *        from
	 * @param convertSpaceRunsToTabs whether to convert consecutive runs of
	 *        spaces to tabs
	 * @return the indentation corresponding to the document content specified
	 *         by <code>start</code> and <code>indent</code>
	 */
	private StringBuffer createIndent(int start, final int indent, final boolean convertSpaceRunsToTabs) {
		final int tabLen= prefTabLength();		
		final StringBuffer ret= new StringBuffer();
		try {
			int spaces= 0;
			while (start < indent) {
				
				char ch= fDocument.getChar(start);
				if (ch == '\t') {
					ret.append('\t');
					spaces= 0;
				} else if (!convertSpaceRunsToTabs || tabLen == -1) {
					ret.append(' ');
				} else {
					spaces++;
					if (spaces == tabLen) {
						ret.append('\t');
						spaces= 0;
					}
				}