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

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

Introduction

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

Prototype

public static Display getCurrent() 

Source Link

Document

Returns the display which the currently running thread is the user-interface thread for, or null if the currently running thread is not a user-interface thread for any display.

Usage

From source file:MainClass.java

protected void configureShell(Shell shell) {
    super.configureShell(shell);
    shell.setText("Send Message");
    shell.setSize(500, 400);/* w  ww  .j  a  v a2s. c o m*/

    InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "", "Enter 5-8 characters", "info",
            new LengthValidator());
    if (dlg.open() == Window.OK) {
        System.out.println(dlg.getValue());
    }
}

From source file:GetInput.java

/**
 * Runs the application// w  w w. java  2  s  .c  om
 */
public void run() {
    // Don't return from open() until window closes
    setBlockOnOpen(true);

    // Open the main window
    open();

    // Dispose the display
    Display.getCurrent().dispose();
}

From source file:TreeViewerFileFromTree.java

public FileTreeWindow() {
    super(null);//  ww  w  . j a  va  2  s. com
    // Don't return from open() until window closes
    setBlockOnOpen(true);

    // Open the main window
    open();

    // Dispose the display
    Display.getCurrent().dispose();
}

From source file:ApplicationWindowManager.java

public MainWindow() {
    super(null);//from w  w w.j av  a  2  s .  co  m
    // Don't return from open() until window closes
    //    setBlockOnOpen(true);

    // Open the main window
    open();

    // Dispose the display
    Display.getCurrent().dispose();

}

From source file:RegistryTest.java

/**
 * Runs the application
 */
public void run() {
    setBlockOnOpen(true);
    open();
    Display.getCurrent().dispose();
}

From source file:FileTreeWindowApplication.java

public FileTreeWindow() {
    super(null);
    // Don't return from open() until window closes
    setBlockOnOpen(true);

    open();
    Display.getCurrent().dispose();
}

From source file:MainClass.java

public MainClass() {
    super(null);
    setBlockOnOpen(true);
    open();
    Display.getCurrent().dispose();

}

From source file:CheckFileTreeViewer.java

public CheckFileTree() {
    super(null);
    // Don't return from open() until window closes
    setBlockOnOpen(true);

    open();
    Display.getCurrent().dispose();
}

From source file:MainClass.java

protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));

    final Text text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    text.setLayoutData(new GridData(GridData.FILL_BOTH));

    Button show = new Button(composite, SWT.PUSH);
    show.setText("Show Error");
    show.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            Status status = new Status(IStatus.ERROR, "My Plug-in ID", 0, "Status Error Message", null);
            ErrorDialog.openError(Display.getCurrent().getActiveShell(), "JFace Error", text.getText(), status);
        }/*  w  ww. j  a va 2 s  .c  o  m*/
    });
    return composite;
}

From source file:MainClass.java

public MainClass() {
    super(null);
    setBlockOnOpen(true);
    open();
    Display.getCurrent().dispose();
}