Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 315060
Collapse All | Expand All

(-)src/org/eclipse/swt/widgets/Shell.java (-1 / +5 lines)
Lines 849-855 Link Here
849
  // TODO [rst] move to class Decorations as soon as it exists
849
  // TODO [rst] move to class Decorations as soon as it exists
850
  public Button getDefaultButton() {
850
  public Button getDefaultButton() {
851
    checkWidget();
851
    checkWidget();
852
    return defaultButton;
852
    Button result = null;
853
    if( defaultButton != null && !defaultButton.isDisposed() ) {
854
      result = defaultButton;
855
    }
856
    return result;
853
  }
857
  }
854
858
855
  /**
859
  /**
(-)src/org/eclipse/swt/widgets/Shell_Test.java (+9 lines)
Lines 336-341 Link Here
336
    assertEquals( null, shell.getDefaultButton() );
336
    assertEquals( null, shell.getDefaultButton() );
337
  }
337
  }
338
338
339
  public void testDefaultButtonDisposed() {
340
    Display display = new Display();
341
    Shell shell = new Shell( display );
342
    Button defaultButton = new Button( shell, SWT.PUSH );
343
    shell.setDefaultButton( defaultButton );
344
    defaultButton.dispose();
345
    assertNull( shell.getDefaultButton() );
346
  }
347
339
  public void testForceActive() throws Exception {
348
  public void testForceActive() throws Exception {
340
    Display display = new Display();
349
    Display display = new Display();
341
    Shell shell = new Shell( display );
350
    Shell shell = new Shell( display );

Return to bug 315060