Community
Participate
Working Groups
this.removeState("abandoned");
this.removeState("pressed");
}
if( this.getFocused() ) {
this.setFocused( false );
} else {
this.removeState("disabled");
public void setEnabled( boolean enabled ) {
checkWidget();
/*
* TODO [rst] handle focus
* Feature in Windows. If the receiver has focus, disabling
* the receiver causes no window to have focus. The fix is
* to assign focus to the first ancestor window that takes
* focus. If no window will take focus, set focus to the
* desktop.
*/
Control control = null;
boolean fixFocus = false;
if( !enabled ) {
control = display.getFocusControl();
fixFocus = isFocusAncestor( control );
if( enabled ) {
state &= ~DISABLED;
state |= DISABLED;
if( fixFocus ) {
fixFocus( control );
/**
} ),
testDisableOfFocused : function() {
var button = new org.eclipse.rwt.widgets.Button( "push" );
button.addToDocument();
button.setFocused( true );
assertTrue( button.getFocused() );
button.setEnabled( false );
assertFalse( button.getFocused() );
},
/////////
// Helper
assertTrue( noFocusControl.isFocusControl() );
public void testDisableOfFocused() {
Control control = new Button( shell, SWT.PUSH );
shell.open();
control.setFocus();
control.setEnabled( false );
assertSame( shell, display.getFocusControl() );
public void testDisposeOfFocused() {
Control control1 = new Button( shell, SWT.PUSH );
Composite composite = new Composite( shell, SWT.NONE );