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

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

Introduction

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

Prototype

public MessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
        int dialogImageType, int defaultIndex, String... dialogButtonLabels) 

Source Link

Document

Create a message dialog.

Usage

From source file:codeOrchestra.lcs.license.FastCompilerBetaExpirationStrategy.java

@Override
public boolean showLicenseExpiredDialog() {
    String expireMessage = "This copy of COLT has expired.";

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT 1.1 (beta)", null,
            expireMessage, MessageDialog.INFORMATION, new String[] { "OK" }, 0);
    dialog.open();//  w w  w .  j  a  va 2s  .c  o  m

    return false;
}

From source file:codeOrchestra.lcs.license.FastCompilerBetaExpirationStrategy.java

@SuppressWarnings("deprecation")
@Override// ww  w  .  j  a  v  a 2s  .co  m
public void showLicenseExpirationInProgressDialog() {
    String expireMessage = String.format("This copy of COLT will expire on %s",
            new Date(113, 5, 24).toLocaleString());

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT 1.1 (beta)", null,
            expireMessage, MessageDialog.INFORMATION, new String[] { "OK" }, 0);
    dialog.open();
}

From source file:codeOrchestra.lcs.license.PlimusSubscriptionExpirationStrategy.java

@Override
public boolean showLicenseExpiredDialog() {
    if (haventValidatedOnServerForTooLong()) {
        String expireMessage = "Key validation requires an active internet connection";

        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT License", null,
                expireMessage, MessageDialog.INFORMATION, new String[] { "Exit" }, 0);
        dialog.open();//from   w  ww . j a v  a 2s  .co  m

        return false;
    }

    String expireMessage = isInTrialMode()
            ? "Your COLT trial period has expired. Browse to www.codeorchestra.com to purchase a subscription."
            : "Your COLT subscription has expired. Browse to www.codeorchestra.com to update the subscription.";

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT License", null,
            expireMessage, MessageDialog.INFORMATION, new String[] { "Exit", "Enter Serial Number" }, 1);
    int result = dialog.open();
    if (result == 1) {
        return showSerialNumberDialog();
    }

    return false;
}

From source file:codeOrchestra.lcs.license.PlimusSubscriptionExpirationStrategy.java

@Override
public void showLicenseExpirationInProgressDialog() {
    if (isInTrialMode()) {
        String expireMessage = String.format(
                "You have %d days of %d evaluation period days left. You may continue evaluation or enter a serial number",
                getDaysLeft(), getExpirationPeriod());

        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "Evaluation License",
                null, expireMessage, MessageDialog.INFORMATION,
                new String[] { "Continue Evaluation", "Enter Serial Number" }, 0);
        int result = dialog.open();
        if (result == 1) {
            showSerialNumberDialog();//w ww .j  a  v a  2 s . com
        }
    } else {
        if (getSubscriptionDaysLeft() < 4) {
            String expireMessage = String.format("You have %d days of paid subscription left.",
                    getSubscriptionDaysLeft());

            MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(),
                    "Evaluation License", null, expireMessage, MessageDialog.INFORMATION, new String[] { "OK" },
                    0);
            dialog.open();
        }
    }
}

From source file:codeOrchestra.lcs.license.PlimusSubscriptionWithDemoExpirationStrategy.java

@Override
public void handleExpiration() {
    demoMode = true;/*from w w  w. j  av a  2s  .c o m*/

    String expireMessage = String.format("COLT is in Demo mode. Compilations count is limited to %d.",
            DemoHelper.get().getMaxCompilationsCount() - 1);

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT License", null,
            expireMessage, MessageDialog.INFORMATION, new String[] { "OK" }, 0);
    dialog.open();
}

From source file:codeOrchestra.lcs.license.PlimusSubscriptionWithDemoExpirationStrategy.java

@Override
public boolean showLicenseExpiredDialog() {
    if (haventValidatedOnServerForTooLong() && !CodeOrchestraLicenseManager.noSerialNumberPresent()) {
        String expireMessage = "Key validation requires an active internet connection. COLT will be launched in Demo mode";

        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT License", null,
                expireMessage, MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        dialog.open();/* w w  w.  j av a 2 s .c  o m*/

        return false;
    }

    String expireMessage = CodeOrchestraLicenseManager.noSerialNumberPresent()
            ? "Browse to www.codeorchestra.com to purchase a subscription or continue in Demo mode."
            : "Your COLT subscription has expired. Browse to www.codeorchestra.com to update the subscription or continue in Demo mode.";

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT License", null,
            expireMessage, MessageDialog.INFORMATION,
            new String[] { "Continue in Demo mode", "Enter Serial Number" }, 1);
    int result = dialog.open();
    if (result == 1) {
        return showSerialNumberDialog();
    }

    return false;
}

From source file:com.amalto.workbench.dialogs.ImportExchangeOptionsDialog.java

License:Open Source License

private void unzipDownloadRes(boolean export) {
    JSONObject datum = dataContent[exchangeDwnTable.getSelectionIndex()];
    InputStream stream = null;//from   www .j a  v  a 2  s . co  m
    OutputStream out = null;
    try {
        String url = datum.getString(COLUMN_URL_NAME);
        stream = HttpClientUtil.getInstreamContentByHttpget(url);
        if (null == stream) {
            throw new RuntimeException("cannot get the content stream"); //$NON-NLS-1$
        }
        String downloadFolder = System.getProperty("user.dir") + File.separator + (export ? "temp" : "xsdTemp");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
        String subFolderForTmp = downloadFolder + File.separator + "tmp" + System.currentTimeMillis();//$NON-NLS-1$
        File tempFile = new File(subFolderForTmp + File.separator + "tmp" + System.currentTimeMillis());//$NON-NLS-1$

        File dir = new File(downloadFolder);
        if (!dir.exists()) {
            dir.mkdir();
        }
        File subDir = new File(subFolderForTmp);
        if (!subDir.exists()) {
            subDir.mkdir();
        }
        if (zipFileRepository.length() > 0) {
            zipFileRepository.delete(0, zipFileRepository.length());
        }
        out = new FileOutputStream(tempFile);
        IOUtils.copy(stream, out);
        out.flush();
        if (!export) {
            ZipToFile.unZipFile(tempFile.getAbsolutePath(), subFolderForTmp);
            boolean result = false;
            int tryCount = 0;
            while (!result && tryCount++ < 10) {
                System.gc();
                result = tempFile.delete();
            }
            zipFileRepository.append(subFolderForTmp);
        } else {
            zipFileRepository.append(tempFile.getAbsolutePath());
        }
    } catch (Exception e1) {
        final MessageDialog dialog = new MessageDialog(this.getParentShell().getShell(),
                Messages.ImportExchangeOptionsDialog_ParsingError, null, e1.getMessage(), MessageDialog.ERROR,
                new String[] { IDialogConstants.OK_LABEL }, 0);
        dialog.open();
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(stream);
    }
}

From source file:com.amalto.workbench.export.ImportItemsWizard.java

License:Open Source License

private boolean isSaveModifiedEditor(String editorName) {
    final MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportItemsWizard_4, null,
            Messages.ImportItemsWizard_5 + editorName + Messages.ImportItemsWizard_6, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
    dialog.open();/*  w  w  w.j  ava 2s  .co m*/
    if (dialog.getReturnCode() == 0) {
        return true;
    }
    return false;
}

From source file:com.amalto.workbench.export.ImportItemsWizard.java

License:Open Source License

private int isOveride(String name, String obTypeName) {

    final MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportItemsWizard_12, null,
            Messages.ImportItemsWizard_13 + obTypeName + Messages.ImportItemsWizard_14 + name
                    + Messages.ImportItemsWizard_15,
            MessageDialog.QUESTION,/*from w w  w  .  j a  v  a  2s  .  com*/
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
            0);
    dialog.open();
    int result = dialog.getReturnCode();
    if (result == 0) {
        return IDialogConstants.YES_ID;
    }
    if (result == 1) {
        return IDialogConstants.YES_TO_ALL_ID;
    }
    if (result == 2) {
        return IDialogConstants.NO_ID;
    }
    return IDialogConstants.CANCEL_ID;

}

From source file:com.amazonaws.eclipse.core.accounts.profiles.SdkCredentialsFileContentMonitor.java

License:Apache License

/**
 * Should only be invoked in the main thread
 *//*from w  w w  .  j a v a 2s.  co m*/
private static void showCredentialsReloadConfirmBox(File credentialsFile) {

    String message = "The AWS credentials file '" + credentialsFile.getAbsolutePath()
            + "' has been changed in the file system. "
            + "Do you want to reload the credentials from the updated file content?";

    MessageDialog dialog = new MessageDialog(null, // use the top-level shell
            "AWS Credentials File Changed",
            AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_AWS_ICON), message,
            MessageDialog.CONFIRM, new String[] { "No", "Yes" }, 1 // default to YES
    );

    int result = dialog.open();
    if (result == 1) {
        AwsToolkitCore.getDefault().getAccountManager().reloadAccountInfo();
    }
}