Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321935

Summary: ToggleButtonRidget - setOutputOnly(...) interferes with setSelected()
Product: [RT] Riena Reporter: Elias Volanakis <elias>
Component: communicationAssignee: Elias Volanakis <elias>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christian.campo
Version: unspecified   
Target Milestone: 3.0.0.M2   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Elias Volanakis CLA 2010-08-05 20:14:04 EDT
Due to a hack introduced to fix Bug 271762 we have the following undesired behavior: if the toggle-button-ridget is output-only and state change via setSelected(boolean) will be blocked. Output-only should only block changes from the user (i.e. UI) and not interfere with programmatic API calls. Fixing.

Note: the fix slightly modifies the semantics of setSelected(...) but since the broken/unexpected behavior was not specified in the javadoc, I consider it an implementation detail.

Test case:

	public void testSetSelectedOnOutputOnlyCheckboxChangesState() {
		final IToggleButtonRidget ridget = getRidget();

		ridget.setOutputOnly(false);
		ridget.setSelected(false);

		assertFalse(ridget.isSelected());

		ridget.setOutputOnly(true);
		ridget.setSelected(true);

		assertTrue(ridget.isSelected());   // <--- this fails, it should be true
	}
Comment 1 Elias Volanakis CLA 2010-08-05 22:45:37 EDT
Resolved in HEAD.