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:com.mercatis.lighthouse3.status.ui.wizards.StatusWizard.java

License:Apache License

@Override
public boolean performFinish() {
    try {/*from w ww .j  a va 2s.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.environment.wizards.NewProcessTaskWizard.java

License:Apache License

public void addPages() {
    page = new WizardNewProcessTaskPage("ProjectCreationPage");

    page.setLighthouseDomain(lighthouseDomain);
    page.setParentEntity(parentProcessTask);

    List<Deployment> deps = CommonBaseActivator.getPlugin().getDomainService()
            .getAllDeployments(lighthouseDomain);

    deploymentsPage = new WizardProcessTaskAddDeploymentsPage("AddDeploymentsPage", deps);

    addPage(page);/*from   w  w w. j  av a2s  .  co  m*/
    addPage(deploymentsPage);

    statusMainPage = new StatusWizardMainPage("Status");
    statusMainPage.setTitle("Status");
    statusMainPage.setDescription("Edit details of the Status.");

    try {
        statusOkPage = new WizardEventTemplatePage("OK Template", lighthouseDomain,
                WizardEventTemplatePage.EventType.OK);
        statusOkPage.setTitle("OK Template");
        statusOkPage.setDescription("Define details of OK Template");

        statusErrorPage = new WizardEventTemplatePage("Error Template", lighthouseDomain,
                WizardEventTemplatePage.EventType.ERROR);
        statusErrorPage.setTitle("Error Template");
        statusErrorPage.setDescription("Define details of Error Template");

        statusNotificationPage = new StatusWizardNotificationPage("Notification Channel", lighthouseDomain);
        statusNotificationPage.setTitle("Notification Channel");
        statusNotificationPage.setDescription("Edit the template for email notification");

        addPage(statusMainPage);
        addPage(statusOkPage);
        addPage(statusErrorPage);
        addPage(statusNotificationPage);
    } catch (Exception e) {
        new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "New Status Wizard", null,
                e.getMessage(), MessageDialog.WARNING, new String[] { "OK" }, 0).open();
        //This RuntimeException will be catched by the UI framework and prevents this wizard from opening
        throw new RuntimeException("wizardkillerexception", null);
    }
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.handlers.ExecuteJobHandler.java

License:Apache License

@Override
protected void execute(Object element) throws ExecutionException {
    if (element instanceof Job) {
        Job job = (Job) element;/*  w  ww  .ja v a  2 s .c  o m*/
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                "Manual Execute", null, "Execute " + LabelConverter.getLabel(job) + "?", MessageDialog.QUESTION,
                new String[] { "Yes", "No" }, 1);
        int button = md.open();
        if (button == 0) {
            LighthouseDomain lighthouseDomain = OperationBase.getJobService().getLighthouseDomainForJob(job);
            OperationBase.getOperationInstallationService().execute(lighthouseDomain, job.getScheduledCall());
        }
    }
}

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

License:Apache License

@Override
public boolean performFinish() {
    try {//from   w  w  w  .  j av a 2s.  co  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 {//ww  w .  ja  va  2  s . co  m
        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 {/*from w w  w .  j a  v  a  2s  .co  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.mercatis.lighthouse3.ui.status.handler.ViewReasonHandler.java

License:Apache License

@Override
protected void execute(Object element) throws ExecutionException {
    if (element instanceof ManualStatusClearance) {
        ManualStatusClearance msc = (ManualStatusClearance) element;
        String message = "Cleared by: " + msc.getClearer() + "\n\n";
        message += msc.getReason() != null && !msc.getReason().equals("") ? msc.getReason()
                : "No reason defined";
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                "Manual Clearance Reason", null, message, MessageDialog.INFORMATION, new String[] { "Ok" }, 0);
        md.open();/* www.j  a  v  a  2 s.  co m*/
    }
}

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

License:Open Source License

public static int deleteAzureDockerHostConfirmationDialog(Shell shell, Azure azureClient,
        DockerHost dockerHost) {//from w  w w  .j  a v  a 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.microsoft.tfs.client.common.ui.dialogs.vc.checkinpolicies.PolicyScopeDialog.java

License:Open Source License

@Override
protected void hookCustomButtonPressed(final int buttonId) {
    if (buttonId == IDialogConstants.HELP_ID) {
        final String text = Messages.getString("PolicyScopeDialog.CheckInPolicyRegexDialogText"); //$NON-NLS-1$

        final MessageDialog dialog = new MessageDialog(getShell(),
                Messages.getString("PolicyScopeDialog.CheckInPolicyRegexDialogTitle"), //$NON-NLS-1$
                null, text, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);

        dialog.open();//from www  .  ja  v a  2  s .  c  om
    }
}

From source file:com.microsoft.tfs.client.common.ui.helpers.UndoHelper.java

License:Open Source License

private static int promptForChange(final Shell shell, final PendingChange change) {
    final String message = MessageFormat.format(
            Messages.getString("UndoHelper.ConfirmUndoAndDiscardChangesFormat"), //$NON-NLS-1$
            change.getLocalItem());/*from ww w. j a  va  2 s . com*/

    final MessageDialog dialog = new MessageDialog(shell, Messages.getString("UndoHelper.ConfirmDialogTitle"), //$NON-NLS-1$
            null, message, MessageDialog.WARNING, DIALOG_BUTTON_LABELS, YES);

    return dialog.open();
}