Example usage for org.eclipse.jface.dialogs TrayDialog setBlockOnOpen

List of usage examples for org.eclipse.jface.dialogs TrayDialog setBlockOnOpen

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs TrayDialog setBlockOnOpen.

Prototype

public void setBlockOnOpen(boolean shouldBlock) 

Source Link

Document

Sets whether the open method should block until the window closes.

Usage

From source file:org.eclipse.ui.tests.statushandlers.SupportTrayTest.java

License:Open Source License

public void testJFacePolicySupportProvider() {
    Map dialogState = new HashMap();
    StatusAdapter sa = new StatusAdapter(Status.OK_STATUS);
    dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER, sa);
    SupportTray st = new SupportTray(dialogState, new NullListener());

    assertNull(st.providesSupport(sa));/*from w  w  w  .  jav a  2  s. co m*/

    final IStatus[] _status = new IStatus[] { null };

    Policy.setErrorSupportProvider(new ErrorSupportProvider() {

        public Control createSupportArea(Composite parent, IStatus status) {
            _status[0] = status;
            return new Composite(parent, SWT.NONE);
        }
    });

    assertNotNull(st.providesSupport(sa));

    TrayDialog td = null;
    try {
        td = new TrayDialog(new Shell()) {
        };
        td.setBlockOnOpen(false);
        td.open();
        td.openTray(st);
    } finally {
        if (td != null)
            td.close();
    }

    assertEquals(Status.OK_STATUS, _status[0]);
}