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

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

Introduction

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

Prototype

int WARNING

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

Click Source Link

Document

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

Usage

From source file:sernet.verinice.rcp.search.SearchView.java

License:Open Source License

private boolean isReindexConfirmed() {
    final int ok = 0;
    if (ServiceFactory.lookupSearchService().isReindexRunning()) {
        MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.SearchView_33,
                Messages.SearchView_34);
        return false;
    }/*from  www  .j a  v  a  2s  . c o m*/
    MessageDialog dialog = new MessageDialog(getShell(), Messages.SearchView_29, null, Messages.SearchView_30,
            MessageDialog.WARNING, new String[] { Messages.SearchView_27, Messages.SearchView_28 }, 0);
    return dialog.open() == ok;
}

From source file:skillpro.view.impl.CreateSEEComposite.java

License:Open Source License

private SelectionAdapter addResourceListener() {
    return new SelectionAdapter() {
        @Override//  w w  w . j a  v  a2  s  .c  om
        public void widgetSelected(SelectionEvent e) {
            ChooseAssetFromConfigurationDialog dialog = new ChooseAssetFromConfigurationDialog(getShell());
            if (dialog.open() == Window.OK) {
                Resource result = dialog.getResult()[0];
                if (result != null) {
                    List<SEE> correspondingSEEs = SkillproService.getSkillproProvider().getSEERepo()
                            .getCorrespondingSEEs(result);
                    if (correspondingSEEs.isEmpty()) {
                        changeResource(result);
                    } else {
                        String seeNames = "";
                        SEE otherSEE = null;
                        if (correspondingSEEs != null && correspondingSEEs.size() > 1) {
                            throw new IllegalArgumentException(
                                    "Please update this method or SEE's implementation.");
                        }
                        for (SEE see : correspondingSEEs) {
                            seeNames += "\"" + "SEE:" + see.getSeeID() + see.getResource() + "\"\n";
                            if (otherSEE != null) {
                                throw new IllegalArgumentException(
                                        "Resource should always be controlled by 1 SEE!"
                                                + "This SEE violated the rule: " + see.getSeeID());
                            }
                            otherSEE = see;
                        }
                        MessageDialog alertDialog = new MessageDialog(Display.getCurrent().getActiveShell(),
                                "VIS-Server not running!", null,
                                "The resource you chose is controlled by the following SEE:\n" + seeNames
                                        + "Are you sure you want to assign " + "the resource: "
                                        + result.getName() + " to this SEE?",
                                MessageDialog.WARNING, new String[] { "Yes", "No" }, 0);
                        if (alertDialog.open() == Dialog.OK) {
                            otherSEE.removeResource();
                            changeResource(result);
                        }
                    }
                }
                validate();
            }
        }
    };
}

From source file:thahn.java.agui.ide.eclipse.wizard.AguiPlugin.java

private void checkSdkLocation() {
    final Display disp = getDisplay();
    disp.asyncExec(new Runnable() {
        @Override/*from ww w. jav  a 2  s.c  o  m*/
        public void run() {
            Shell shell = disp.getActiveShell();
            if (shell == null) {
                return;
            }

            String customLabel = null;
            customLabel = "Open Preferences";

            String btnLabels[] = new String[customLabel == null ? 1 : 2];
            btnLabels[0] = customLabel;
            btnLabels[btnLabels.length - 1] = IDialogConstants.CLOSE_LABEL;

            MessageDialog dialog = new MessageDialog(shell, // parent
                    "Agui Sdk", null, // dialogTitleImage
                    "Set Agui SDK Path", MessageDialog.WARNING, btnLabels, btnLabels.length - 1);
            int index = dialog.open();

            if (customLabel != null && index == 0) {
                //                    switch(solution) {
                //                    case OPEN_ANDROID_PREFS:
                openAguiPrefs();
                //                        break;
                //                    case OPEN_P2_UPDATE:
                //                        openP2Update();
                //                        break;
                //
                //                   case OPEN_SDK_MANAGER:
                //                        openSdkManager();
                //                        break;
                //                    }
                //                }
            }
        }
    });
}

From source file:tinyos.dlrc.jobs.InvokeMakeJob.java

License:Open Source License

public void execShouldContinue() {
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            IStatus ready = target.ready();
            if (ready != null) {
                int type = -1;
                String title = null;
                String message = null;

                switch (ready.getSeverity()) {
                case IStatus.ERROR:
                    title = "Error";
                    message = "an error";
                    type = MessageDialog.ERROR;
                    break;
                case IStatus.WARNING:
                    title = "Warning";
                    message = "a warning";
                    type = MessageDialog.WARNING;
                    break;
                case IStatus.INFO:
                    title = "Info";
                    message = "a message";
                    type = MessageDialog.INFORMATION;
                    break;
                }// ww w  .j  av a 2  s . c  o  m

                if (type >= 0) {
                    message = "There is " + message + " associated with this make-option:\n\n" + "'"
                            + ready.getMessage() + "'\n\n" + "Would you like to continue anyway?";

                    MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), title, null,
                            message, type,
                            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);

                    if (dialog.open() != 0) {
                        shouldContinue = false;
                    }
                }
            }
        }
    });
}

From source file:uk.ac.diamond.scisoft.arpes.calibration.wizards.GoldCalibrationWizard.java

License:Open Source License

@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    one = new GoldCalibrationPageOne(calibrationData);
    two = new GoldCalibrationPageTwo(calibrationData);
    three = new GoldCalibrationPageThree(calibrationData);
    four = new GoldCalibrationPageFour(calibrationData);
    five = new GoldCalibrationPageFive(calibrationData);
    pageChangeListener = new IPageChangedListener() {
        @Override// ww  w . jav a  2  s  .c  o  m
        public void pageChanged(PageChangedEvent event) {
            if (event.getSelectedPage() instanceof CalibrationWizardPage) {
                CalibrationWizardPage page = (CalibrationWizardPage) event.getSelectedPage();
                // not the last page
                if (isProcessOKToRun && page.getPageNumber() != 5) {
                    try {
                        page.runProcess();
                    } catch (InterruptedException e) {
                        logger.debug("Run process interrupted:" + e.getMessage());
                        MessageDialog dialog = new MessageDialog(getShell(), "Calibrating process interrupted",
                                null, e.getMessage(), MessageDialog.WARNING, new String[] { "OK" }, 0);
                        dialog.open();
                    }
                }
            }
        }
    };
    pageChangingListener = new IPageChangingListener() {
        @Override
        public void handlePageChanging(PageChangingEvent event) {
            CalibrationWizardPage currentpage = (CalibrationWizardPage) event.getCurrentPage();
            CalibrationWizardPage targetpage = (CalibrationWizardPage) event.getTargetPage();
            if (currentpage.getPageNumber() > targetpage.getPageNumber())
                isProcessOKToRun = false;
            else
                isProcessOKToRun = true;
        }
    };

    addPage(one);
    addPage(two);
    addPage(three);
    addPage(four);
    addPage(five);

    Object selected = selection.getFirstElement();
    String path = "";
    if (selected instanceof IFile) {
        IFile ifile = (IFile) selected;
        path = ifile.getLocation().toOSString();
    } else if (selected instanceof File) {
        File file = (File) selected;
        path = file.getPath();
    }
    setData(path);
}

From source file:uk.ac.gda.client.UIHelper.java

License:Open Source License

public static void showWarning(final String message, final String reason) {
    showMessage(MessageDialog.WARNING, message, reason);
}

From source file:uk.ac.gda.client.UIHelper.java

License:Open Source License

private static void showMessage(final int messageDialogType, final String message, final String reason) {
    Display.getDefault().syncExec(new Runnable() {
        @Override//  w  ww .  j  a  va2  s .  c o m
        public void run() {
            StringBuilder messageString = new StringBuilder();
            messageString.append(message);
            if (reason != null) {
                messageString.append("\n\nReason:\n" + reason);
            }
            if (messageDialogType == MessageDialog.ERROR) {
                MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
                        messageString.toString());
            } else if (messageDialogType == MessageDialog.WARNING) {
                MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning",
                        messageString.toString());
            }
        }
    });
}

From source file:uk.ac.stfc.isis.ibex.ui.configserver.commands.DeleteComponentsHandler.java

License:Open Source License

private void displayWarning(Map<String, Collection<String>> selectedDependencies) {
    String message = viewModel.buildWarning(selectedDependencies);
    new MessageDialog(shell(), "Component in Use", null, message, MessageDialog.WARNING, new String[] { "Ok" },
            0).open();//from  w w  w  . ja  v  a  2s. c om
}

From source file:uk.ac.stfc.isis.ibex.ui.configserver.commands.helpers.EditComponentHelper.java

License:Open Source License

private void openConflictsDialog(String warning) {

    new MessageDialog(shell, "Conflicts with current configuration", null, warning, MessageDialog.WARNING, OK,
            0).open();/*from w ww  .j a  va 2s . com*/
}

From source file:uk.ac.stfc.isis.ibex.ui.configserver.commands.LoadConfigHandler.java

License:Open Source License

/**
 * {@inheritDoc}/*from  w w w  .  java2  s  . c  o  m*/
 */
@Override
public void safeExecute(ExecutionEvent event) {
    updateObservers();
    ConfigSelectionDialog dialog = new ConfigSelectionDialog(shell(), "Load Configuration",
            SERVER.configsInfo().getValue(), false, false);
    if (dialog.open() == Window.OK) {
        String config = dialog.selectedConfig();
        Map<String, Set<String>> conflicts = getConflicts(config);
        if (conflicts.isEmpty()) {
            configService.uncheckedWrite(config);
        } else {
            new MessageDialog(shell(), "Conflicts in selected configuration", null, buildWarning(conflicts),
                    MessageDialog.WARNING, new String[] { "Ok" }, 0).open();
            safeExecute(event);
        }
    }
}