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

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

Introduction

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

Prototype

int ERROR

To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.

Click Source Link

Document

Constant for the error image, or a simple dialog with the error image and a single OK button (value 1).

Usage

From source file:com.mentor.nucleus.bp.core.util.UIUtil.java

License:Open Source License

/**
 * Note this "MessageDialog" currently only supports an array of 2 dialog button
 * labels.   This is why the result is a boolean.  It simply behaves in
 * a similar manner as if a yes/no question had been asked (offset 0 is
 * yes and offset 1 is no).   If additional buttons are ever needed this
 * will need to be modified to handle it.
 *//*from  ww w. j  a va  2 s.c o m*/
public static boolean openMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage,
        String dialogMessage, BPMessageTypes dialogType, String[] dialogButtonLabels, int defaultIndex) {
    int standardDialogType = MessageDialog.WARNING;
    if (dialogType == BPMessageTypes.ERROR) {
        standardDialogType = MessageDialog.ERROR;
    } else if ((dialogType == BPMessageTypes.INFORMATION)) {
        standardDialogType = MessageDialog.INFORMATION;
    }
    boolean result = (defaultIndex == MessageDialog.OK);
    if (CoreUtil.IsRunningHeadless) {
        outputTextForheadlessRun(dialogType, dialogTitle, dialogMessage, "");
    } else {
        MessageDialog dialog = new MessageDialog(parentShell, dialogTitle, dialogTitleImage, dialogMessage,
                standardDialogType, dialogButtonLabels, defaultIndex);
        dialog.setBlockOnOpen(true);
        int actualResult = dialog.open();
        result = MessageDialog.OK == actualResult;
    }
    return result;
}

From source file:com.mercatis.lighthouse3.security.ui.wizards.NewGroupWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {// w w w. j a v a  2 s  .c om
        group = new Group();
        group.setCode(propertiesPage.getCode());
        group.setLongName(propertiesPage.getLongName());
        group.setContact(propertiesPage.getContact());
        group.setContactEmail(propertiesPage.getContactEmail());
        group.setDescription(propertiesPage.getDescription());

        Security.getService().persistGroup(lighthouseDomain.getProject(), group);
    } catch (Exception e) {
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Create Group", null,
                e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
        return false;
    }
    return true;
}

From source file:com.mercatis.lighthouse3.security.ui.wizards.NewUserWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {/* w ww  . jav  a 2s  . com*/
        user = new User();
        user.setCode(propertiesPage.getCode());
        user.setGivenName(propertiesPage.getGivenName());
        user.setSurName(propertiesPage.getSurName());
        user.setContactEmail(propertiesPage.getContactEmail());
        user.setAndHashPassword(propertiesPage.getPassword());

        Security.getService().persistUser(lighthouseDomain.getProject(), user);
    } catch (Exception e) {
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Create User", null,
                e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
        return false;
    }
    return true;
}

From source file:com.mercatis.lighthouse3.status.ui.editors.pages.StatusOverviewEditorPage.java

License:Apache License

@Override
public void doSave(IProgressMonitor monitor) {
    if (isDirty()) {
        if (statuusToDelete != null && !statuusToDelete.isEmpty()) {
            for (StatusEditingObject std : statuusToDelete) {
                CommonBaseActivator.getPlugin().getStatusService().deleteStatus(std.getStatus());
            }//from w w  w .  java  2  s .c  o m
            PlatformUI.getWorkbench().getDecoratorManager().update(LighthouseStatusDecorator.id);
            statuusToDelete.clear();
        }
        if (getCurrentStatus() != null)
            updateStatusEditingObject();
        for (StatusEditingObject status : statuus) {
            try {
                status.updateModel();
                CommonBaseActivator.getPlugin().getStatusService().updateStatus(status.getStatus());
            } catch (Exception ex) {
                new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Save Status", null,
                        ex.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
            }
        }
    }
    getEditor().editorDirtyStateChanged();
}

From source file:com.mercatis.lighthouse3.status.ui.wizards.StatusWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {//from   ww  w  . j a  va 2  s  .  c o  m
        Status status = createStatus(statusCarrier, mainPage, okPage, errorPage, notificationPage);

        CommonBaseActivator.getPlugin().getStatusService().persistStatus(status);
        PlatformUI.getWorkbench().getDecoratorManager().update(LighthouseStatusDecorator.id);
        return true;
    } catch (Exception e) {
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Create Status", null,
                e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
        return false;
    }
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.wizards.InstallJobWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {// ww w. j  a v  a 2 s .  c o m
        OperationCall call = new OperationCall(operationInstallation);
        String variant = parameterPage.getSelectedVariant();
        if (variant != null && variant.length() > 0)
            call.setVariant(variant);
        Map<Parameter, List<ParameterValue>> values = parameterPage.getValues();
        for (Entry<Parameter, List<ParameterValue>> entry : values.entrySet()) {
            for (ParameterValue value : entry.getValue()) {
                call.addParameterValue(value);
            }
        }
        Job job = new Job();
        job.setScheduledCall(call);
        job.setCode(mainPage.getCode());
        job.setScheduleExpression(mainPage.getScheduleExpression());
        OperationBase.getJobService().persist(job);
        return true;
    } catch (Exception e) {
        OperationsUI.getPlugin().getLog()
                .log(new Status(IStatus.ERROR, OperationsUI.PLUGIN_ID, e.getMessage(), e));
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Job installation error",
                null, e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
        return false;
    }
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.wizards.InstallOperationWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {/*from   w w  w. ja  v  a2 s . c  om*/
        if (selectedDeployments == null) {
            selectedDeployments = listDeploymentsPage.getSelectedDeployments();
        }
        if (selectedOperations == null) {
            selectedOperations = listOperationsPage.getSelectedOperations();
        }
        for (Deployment parentDeployment : selectedDeployments) {
            for (Operation selectedOperation : selectedOperations) {
                OperationInstallation installation = new OperationInstallation();
                installation.setInstallationLocation(parentDeployment);
                installation.setInstalledOperation(selectedOperation);
                OperationBase.getOperationInstallationService().persist(installation);
            }
        }
    } catch (Exception e) {
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Install Operation", null,
                e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
        return false;
    }
    return true;
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.wizards.OperationCallWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {//w  w  w .  j  a v  a  2s  . c  o  m
        OperationCall call = new OperationCall(opertationInstallation);
        String variant = parameterPage.getSelectedVariant();
        if (variant != null && variant.length() > 0)
            call.setVariant(variant);
        Map<Parameter, List<ParameterValue>> values = parameterPage.getValues();
        for (Entry<Parameter, List<ParameterValue>> entry : values.entrySet()) {
            for (ParameterValue value : entry.getValue()) {
                call.addParameterValue(value);
            }
        }
        OperationBase.getOperationInstallationService().execute(lighthouseDomain, call);
        return true;
    } catch (Exception e) {
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Execution error", null,
                e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0).open();
        return false;
    }
}

From source file:com.microsoft.azuretools.docker.utils.AzureDockerUIResources.java

License:Open Source License

public static int deleteAzureDockerHostConfirmationDialog(Shell shell, Azure azureClient,
        DockerHost dockerHost) {//ww w. j  a va  2s .  c om
    String promptMessageDeleteAll = String.format(
            "This operation will delete virtual machine %s and its resources:\n"
                    + "\t - network interface: %s\n" + "\t - public IP: %s\n" + "\t - virtual network: %s\n"
                    + "The associated disks and storage account will not be deleted\n",
            dockerHost.hostVM.name, dockerHost.hostVM.nicName, dockerHost.hostVM.publicIpName,
            dockerHost.hostVM.vnetName);

    String promptMessageDelete = String.format("This operation will delete virtual machine %s.\n"
            + "The associated disks and storage account will not be deleted\n\n"
            + "Are you sure you want to continue?\n", dockerHost.hostVM.name);

    String[] options;
    String promptMessage;

    if (AzureDockerVMOps.isDeletingDockerHostAllSafe(azureClient, dockerHost.hostVM.resourceGroupName,
            dockerHost.hostVM.name)) {
        promptMessage = promptMessageDeleteAll;
        options = new String[] { "Cancel", "Delete VM Only", "Delete All" };
    } else {
        promptMessage = promptMessageDelete;
        options = new String[] { "Cancel", "Delete" };
    }

    MessageDialog deleteDialog = new MessageDialog(shell, "Delete Docker Host", null, promptMessage,
            MessageDialog.ERROR, options, 0);
    int dialogReturn = deleteDialog.open();

    switch (dialogReturn) {
    case 0:
        if (AzureDockerUtils.DEBUG)
            System.out.format("Delete Docker Host op was canceled %s\n", dialogReturn);
        break;
    case 1:
        if (AzureDockerUtils.DEBUG)
            System.out.println("Delete VM only: " + dockerHost.name);
        break;
    case 2:
        if (AzureDockerUtils.DEBUG)
            System.out.println("Delete VM and resources: " + dockerHost.name);
        break;
    default:
        if (AzureDockerUtils.DEBUG)
            System.out.format("Delete Docker Host op was canceled %s\n", dialogReturn);
    }

    return dialogReturn;
}

From source file:com.mindquarry.desktop.client.MindClient.java

License:Open Source License

private void ensureSettingsFolderExists() {
    File file = new File(PreferenceUtilities.SETTINGS_FOLDER);
    if (!file.exists()) {
        if (!file.mkdirs()) {
            log.error("Cannot create settings folder '" + file.getAbsolutePath() + "'");
            MessageDialog dlg = new MessageDialog(getShell(), I18N.getString("Cannot create settings folder"),
                    null,//from   w  w  w. j av  a 2  s.co  m
                    I18N.get("The Mindquarry Desktop Client cannot create its settings folder at\n\n"
                            + "'{0}'\n\nMaybe you don't have permissions to access it?\n\n"
                            + "If you continue, the program won't work properly, so it is strongly "
                            + "recommended to ensure write-access to that folder and restart the client.",
                            file.getAbsolutePath()),
                    MessageDialog.ERROR,
                    new String[] { I18N.getString("Exit"), I18N.getString("Start anyway") }, 0);
            int result = dlg.open();
            if (result == 0) {
                System.exit(1);
            } else {
                log.warn("Starting despite missing settings folder"); //$NON-NLS-1$
            }
        }
    }
}