Example usage for org.eclipse.swt.widgets Display getActiveShell

List of usage examples for org.eclipse.swt.widgets Display getActiveShell

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Display getActiveShell.

Prototype

public Shell getActiveShell() 

Source Link

Document

Returns the currently active Shell, or null if no shell belonging to the currently running application is active.

Usage

From source file:org.amanzi.splash.chart.Charts.java

private static void displayDataParsingError(final int countBad) {
    final Display display = PlatformUI.getWorkbench().getDisplay();
    display.asyncExec(new Runnable() {

        @Override/* w w w .j av a2s.c  o m*/
        public void run() {
            ErrorDialog.openError(display.getActiveShell(), "Invalid input",
                    "There were " + countBad + " data parsing errors in creating the chart!",
                    new Status(Status.ERROR, SplashPlugin.getId(), NumberFormatException.class.getName()));
        }

    });
}

From source file:org.amanzi.splash.chart.Charts.java

/**
 * @param e//from w ww . j ava 2s . c o  m
 */
private static void showErrorDlg(final NumberFormatException e) {
    final Display display = PlatformUI.getWorkbench().getDisplay();
    display.asyncExec(new Runnable() {

        @Override
        public void run() {
            ErrorDialog.openError(display.getActiveShell(), "Invalid input",
                    "Chart can't be created due to invalid input!",
                    new Status(Status.ERROR, SplashPlugin.getId(), NumberFormatException.class.getName(), e));
        }

    });
}

From source file:org.eclipse.swt.examples.graphics.GraphicsExample.java

boolean checkAdvancedGraphics() {
    if (advanceGraphicsInit)
        return advanceGraphics;
    advanceGraphicsInit = true;//from   ww  w.  jav a2  s  .c  o  m
    Display display = parent.getDisplay();
    try {
        Path path = new Path(display);
        path.dispose();
    } catch (SWTException e) {
        Shell shell = display.getActiveShell(), newShell = null;
        if (shell == null)
            shell = newShell = new Shell(display);
        MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
        dialog.setText(RESOURCE_BUNDLE.getString("Warning")); //$NON-NLS-1$
        dialog.setMessage(RESOURCE_BUNDLE.getString("LibNotFound")); //$NON-NLS-1$
        dialog.open();
        if (newShell != null)
            newShell.dispose();
        return false;
    }
    return advanceGraphics = true;
}

From source file:GraphicsExample.java

boolean checkAdvancedGraphics() {
    if (advanceGraphicsInit)
        return advanceGraphics;
    advanceGraphicsInit = true;/*from   w  w w . jav a 2  s  .com*/
    Display display = Display.getCurrent();
    try {
        Path path = new Path(display);
        path.dispose();
    } catch (SWTException e) {
        Shell shell = display.getActiveShell(), newShell = null;
        if (shell == null)
            shell = newShell = new Shell(display);
        MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
        dialog.setText("Warning"); //$NON-NLS-1$
        dialog.setMessage("LibNotFound"); //$NON-NLS-1$
        dialog.open();
        if (newShell != null)
            newShell.dispose();
        return false;
    }
    return advanceGraphics = true;
}