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

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

Introduction

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

Prototype

protected TrayDialog(IShellProvider parentShell) 

Source Link

Document

Creates a tray dialog with the given parent.

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 .  j a v 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]);
}

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

License:Open Source License

public void testSelfClosure() {
    final TrayDialog td[] = new TrayDialog[] { null };
    try {/*from ww w  .j a  va  2 s .  com*/
        td[0] = new TrayDialog(new Shell()) {
        };
        Map dialogState = new HashMap();
        dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER, new StatusAdapter(Status.OK_STATUS));
        SupportTray st = new SupportTray(dialogState, new Listener() {
            public void handleEvent(Event event) {
                td[0].closeTray();
            }
        });
        td[0].setBlockOnOpen(false);
        td[0].open();
        td[0].openTray(st);
    } finally {
        if (td != null)
            td[0].close();
    }
}