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

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

Introduction

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

Prototype

public int open() 

Source Link

Document

Opens this window, creating it first if it has not yet been created.

Usage

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();

        return false;
    }//from  www . ja  va2  s .c  o m

    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();//from w w  w.  j  a v a2  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  ww  w.j a  v a2  s  .  co  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();

        return false;
    }//from   w  w  w.  j av a 2s  .c  om

    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   w  w  w .j ava2 s .  c om
    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();
    if (dialog.getReturnCode() == 0) {
        return true;
    }/*from   w  w  w  . j a  va 2  s . c om*/
    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 ww  w  .  j av  a2 s. c  o m*/
            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
 *//* w w  w.j  av a  2 s.  c  om*/
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();
    }
}

From source file:com.amazonaws.eclipse.core.diagnostic.ui.AwsToolkitErrorSupportProvider.java

License:Apache License

private static void showFailureDialog(Shell parentShell, ErrorReportDataModel errorData) {
    MessageDialog dialog = new ErrorReportFailureMessageDialog(parentShell, errorData);
    dialog.open();
}

From source file:com.amazonaws.eclipse.core.ui.preferences.AwsAccountPreferencePageTab.java

License:Apache License

/**
 * Add the enable-region-default-account check-box and the remove-this-tab
 * button//from w ww .  j  a v  a  2 s.  c o m
 */
private void addEnableRegionDefaultControls(Composite parent) {
    enableRegionDefaultAccount = new BooleanFieldEditor(getRegionAccountEnabledPrefKey(),
            "Enable region default account for " + region.getName(), parent);
    enableRegionDefaultAccount.setPreferenceStore(getPreferenceStore());

    Button removeTabButton = new Button(parent, SWT.PUSH);
    removeTabButton.setText("Remove");
    removeTabButton.setToolTipText("Remove default account configuration for this region.");
    removeTabButton.setImage(AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_REMOVE));
    removeTabButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    removeTabButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            MessageDialog confirmRemoveTabDialog = new MessageDialog(Display.getDefault().getActiveShell(),
                    "Remove all accounts for " + region.getName(),
                    AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_AWS_ICON),
                    "Are you sure you want to remove all the configured accounts for " + region.getName() + "?",
                    MessageDialog.CONFIRM, new String[] { "Cancel", "OK" }, 1);
            if (confirmRemoveTabDialog.open() == 1) {
                AwsAccountPreferencePageTab.this.dispose();
            }

        }
    });
}