Example usage for org.eclipse.jface.dialogs InputDialog close

List of usage examples for org.eclipse.jface.dialogs InputDialog close

Introduction

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

Prototype

@Override
public boolean close() 

Source Link

Usage

From source file:cbc.helpers.Helper.java

License:Open Source License

public String getInputFromUser(String text, String predef) {
    InputDialog input = new InputDialog(window.getShell(), name, text, predef, null);
    input.open();/*  ww  w .  jav  a 2 s.c o  m*/
    input.close();
    return input.getValue();
}

From source file:com.google.gdt.eclipse.login.GoogleLogin.java

License:Open Source License

/**
 * Opens an external browser for the user to login, opens a dialog telling the
 * user to login using that browser, and paste the verification code in a
 * dialog box that pops up./*  w  ww .j  a  va 2s  .c o  m*/
 */
private String openExternalBrowserForLogin(String authorizeUrl) {

    IWebBrowser browser = null;
    try {
        // we don't send them to the logout url because we don't want to
        // force them to log out of their normal sessions
        browser = BrowserUtilities.launchBrowser(authorizeUrl);
    } catch (PartInitException e) {
        showNoBrowsersMessageDialog();
        return null;
    } catch (MalformedURLException e) {
        GoogleLoginPlugin.logError("Could not open external browser", e);
    }

    final InputDialog md = new InputDialog(Display.getDefault().getActiveShell(), "Sign in to Google Services",
            EXTERNAL_BROWSER_MSG, null, new IInputValidator() {
                public String isValid(String newText) {
                    if (!newText.trim().isEmpty()) {
                        return null;
                    }
                    return "Verification code cannot be empty";
                }
            });

    int rc = md.open();
    String verificationCode = md.getValue();

    browser.close();
    md.close();
    return verificationCode;
}