Bug 74580 formatting for condition quick assists
3.1 M2 test pass The formatting of conditionals modified by the new quick assists is misleading. Consider the following: if (c1) { one(); } else if (c2) { two(); } else { three(); } translates into: if (!c1) if (c2) { two(); } else { three(); } else { one(); } which is correct, but it is barely visible from the formatting that the last else clause belongs to the first if statement. I would expect this (with or without the braces): if (!c1) if (c2) { two(); } else { three(); } else { one(); }
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java
private static final Class THIS= AdvancedQuickAssistTest.class;
	private IJavaProject fJProject1;
	private IPackageFragmentRoot fSourceFolder;
	public AdvancedQuickAssistTest(String name) {
		super(name);
	}
	public static Test allTests() {
		return new ProjectTestSetup(new TestSuite(THIS));
	}
	public static Test setUpTest(Test test) {
		return new ProjectTestSetup(test);
	}
	public static Test suite() {
		if (true) {
			return allTests();
		}
		return setUpTest(new AdvancedQuickAssistTest("testAssignToLocal1"));
	}
	protected void setUp() throws Exception {
		Hashtable options= TestOptions.getFormatterOptions();
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
		JavaCore.setOptions(options);
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
		store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);
		TemplateStore codeTemplateStore= JavaPlugin.getDefault().getCodeTemplateStore();
		codeTemplateStore.findTemplate(CodeTemplateContextType.METHODSTUB).setPattern("//TODO\n${body_statement}");
		Preferences corePrefs= JavaCore.getPlugin().getPluginPreferences();
		corePrefs.setValue(JavaCore.CODEASSIST_FIELD_PREFIXES, "");