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

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

Introduction

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

Prototype

int INFORMATION

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

Click Source Link

Document

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

Usage

From source file:gov.redhawk.ide.codegen.ui.internal.command.GenerateCodeHandler.java

License:Open Source License

/**
 * Check to see if any implementation is configured using the Manual Code Generator option
 * @param parent/*w  w w.  jav  a 2  s.  co  m*/
 * @param impls
 * @throws CoreException
 */
private boolean checkManualGeneratorImpls(Shell parent, List<Implementation> impls) throws CoreException {
    if (impls == null || impls.isEmpty()) {
        throw new OperationCanceledException();
    }
    boolean shouldGenerate = true;
    final SoftPkg softPkg = (SoftPkg) impls.get(0).eContainer();
    final WaveDevSettings waveDev = CodegenUtil.loadWaveDevSettings(softPkg);
    boolean hasManualGenerator = false;
    int manualImpls = 0;
    for (final Implementation impl : impls) {
        hasManualGenerator = isManualGenerator(impl, waveDev);
        if (hasManualGenerator) {
            manualImpls++;
        }
    }
    if (manualImpls > 0) {
        String name = softPkg.getName();
        String message = "Some implementations in " + name + " require manual code generation.\n\n"
                + "Automatic Code Generation is only available for implementations using supported code generators.";
        MessageDialog dialog = new MessageDialog(parent, "Manual Code Generation Required", null, message,
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        dialog.open();
    }
    // If all implementations require manual code generation, then do not start the generation process
    if (manualImpls == impls.size()) {
        shouldGenerate = false;
    }
    return shouldGenerate;
}

From source file:io.aos.jface.sample.spl02.JFaceSample02.java

License:Apache License

private Action createAboutAction() {
    return new Action() {
        public String getText() {
            return "Essai";
        }/*  w ww .  jav a2s  .  c o  m*/

        public void run() {
            String[] tab = { IDialogConstants.OK_LABEL };
            MessageDialog dialog = new MessageDialog(getShell(), "Essai JFace", null,
                    "Ceci est une fentre d''information", MessageDialog.INFORMATION, tab, 0);
            dialog.open();
        }
    };
}

From source file:io.aos.jface.sample.spl02.JFaceSample02.java

License:Apache License

protected void handleShellCloseEvent() {
    String[] tab = { IDialogConstants.OK_LABEL };
    MessageDialog dialog = new MessageDialog(getShell(), "Fin de l'essai", null,
            "Nous allons quitter l'application", MessageDialog.INFORMATION, tab, 0);
    dialog.open();//from   ww  w. j a va  2 s .  c o  m
    setReturnCode(CANCEL);
    close();
}

From source file:melnorme.util.swt.SWTUtil.java

License:Open Source License

public static int statusLevelToMessageDialogKing(StatusLevel statusLevel) {
    switch (statusLevel) {
    case ERROR://from   w  ww .  ja  v  a 2s. c o m
        return MessageDialog.ERROR;
    case WARNING:
        return MessageDialog.WARNING;
    case INFO:
        return MessageDialog.INFORMATION;
    case OK:
        return MessageDialog.OK;
    }
    throw assertFail();
}

From source file:net.refractions.udig.ui.ZoomingDialog.java

License:Open Source License

public static void openInformationMessage(Rectangle start, Shell parentShell, String dialogTitle,
        String dialogMessage) {//  ww w .  j  a  va  2 s  . c o m
    openMessageDialog(start, parentShell, dialogTitle, null, dialogMessage, MessageDialog.INFORMATION,
            new String[] { IDialogConstants.OK_LABEL }, 1);
}

From source file:net.rim.ejde.internal.core.BasicClasspathElementChangedListener.java

License:Open Source License

private void setJDKCompatibilitySettings(final IJavaProject mainProject, final List<IJavaProject> nonBBProjects,
        final List<IJavaProject> projectsWithProblem) {
    _log.trace("Entered setJDKCompatibilitySettings()");
    if (projectsWithProblem.size() > 0) {
        StringBuffer projectList = new StringBuffer();
        for (IJavaProject javaProject : projectsWithProblem) {
            projectList.append(javaProject.getProject().getName() + "\n");
        }//from  w  w  w  .j  a  v a 2  s . c om
        final String projectNames = projectList.toString();
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
                Shell shell = ContextManager.getActiveWorkbenchWindow().getShell();
                StringBuffer messageBuffer = new StringBuffer(
                        Messages.ClasspathChangeManager_settingJDKComplianceMsg1);
                messageBuffer.append("\n");
                messageBuffer.append(NLS.bind(Messages.ClasspathChangeManager_settingJDKComplianceMsg2,
                        mainProject.getProject().getName()));
                messageBuffer.append("\n");
                messageBuffer.append(projectNames);
                messageBuffer.append("\n");
                messageBuffer.append(Messages.ClasspathChangeManager_settingJDKComplianceMsg3);
                MessageDialog complianceDialog = new MessageDialog(shell,
                        Messages.ClasspathChangeManager_DialogTitle, null, messageBuffer.toString(),
                        MessageDialog.INFORMATION, new String[] { Messages.IConstants_OK_BUTTON_TITLE,
                                Messages.IConstants_CANCEL_BUTTON_TITLE },
                        0);

                int buttonEventCode = complianceDialog.open();

                switch (buttonEventCode) {
                case Window.OK: {
                    processNonBBProjects(nonBBProjects, projectsWithProblem, true);
                    break;
                }
                case Window.CANCEL: {
                    processNonBBProjects(nonBBProjects, projectsWithProblem, false);
                    break;
                }
                default:
                    throw new IllegalArgumentException("Unsupported dialog button event!");
                }
                complianceDialog.close();
            }
        });
    } else {
        processNonBBProjects(nonBBProjects, projectsWithProblem, false);
    }
}

From source file:net.rim.ejde.internal.core.BasicClasspathElementChangedListener.java

License:Open Source License

private void processNonBBProjects(final List<IJavaProject> nonBBProjects,
        final List<IJavaProject> projectsWithProblem, final boolean fix) {
    for (IJavaProject javaProject : nonBBProjects) {
        if (fix && projectsWithProblem.contains(javaProject)) {
            ImportUtils.initializeProjectOptions(javaProject);
        }//from  w  w w  . ja  v a2  s  .  c  o  m
    }
    if (fix) {
        Shell shell = ContextManager.getActiveWorkbenchWindow().getShell();
        String message = Messages.ClasspathChangeManager_rebuildProjectMsg1;
        StringBuffer projectList = new StringBuffer();
        for (IJavaProject javaProject : projectsWithProblem) {
            projectList.append(javaProject.getProject().getName() + "\n");
        }
        message += projectList.toString();
        message += Messages.ClasspathChangeManager_rebuildProjectMsg2;
        MessageDialog dialog = new MessageDialog(shell,
                Messages.ClasspathChangeManager_RebuildProjectDialogTitle, null, message,
                MessageDialog.INFORMATION,
                new String[] { Messages.IConstants_OK_BUTTON_TITLE, Messages.IConstants_CANCEL_BUTTON_TITLE },
                0);
        int buttonEventCode = dialog.open();

        switch (buttonEventCode) {
        case Window.OK: {
            buildProjects(projectsWithProblem);
            break;
        }
        case Window.CANCEL: {
            break;
        }
        default:
            throw new IllegalArgumentException("Unsupported dialog button event!");
        }
        dialog.close();
    }
}

From source file:net.rim.ejde.internal.signing.ImportSignKeysAction.java

License:Open Source License

@Override
public void run(IAction action) {
    // Open file dialog to allow user select the parent folder of *.csk and *.db files
    SigningSearchDialog oldKeyDialog = new SigningSearchDialog(ContextManager.getActiveWorkbenchShell());
    try {/*from w w  w . ja v a 2s.c  om*/
        ArrayList<File> oldKeyFiles = oldKeyDialog.search();
        if (oldKeyFiles != null) {
            oldKeyDialog.copyFileIntoSignToolDir(oldKeyFiles);
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle1, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg1, MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg9);
        }
    } catch (IllegalArgumentException ex) {
        MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                Messages.CodeSigningPrefsPage_MessageDialogTitle1, null, ex.getMessage(), MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL }, 0);
        dialog.open();
    }
}

From source file:net.rim.ejde.internal.signing.RemoveSignKeysAction.java

License:Open Source License

private void removeKeys() {
    try {// w  w w.j  ava2s  .  c  om
        File cskFile = new File(
                VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME);
        File dbFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME);
        if ((!cskFile.exists()) && (!dbFile.exists())) {
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle3, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg3, MessageDialog.WARNING,
                    new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            return;
        }
        if (cskFile.exists()) {
            cskFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator
                    + IConstants.CSK_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis()));
        }
        if (dbFile.exists()) {
            dbFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator
                    + IConstants.DB_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis()));
        }
        if ((!cskFile.exists()) && (!dbFile.exists())) {
            MessageDialog dialog = new MessageDialog(ContextManager.getActiveWorkbenchShell(),
                    Messages.CodeSigningPrefsPage_MessageDialogTitle3, null,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg5
                            + Messages.CodeSigningPrefsPage_MessageDialogMsg6,
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
            _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg7);
        }
    } catch (IOException e) {
        _log.error(e.getMessage());
    }
}

From source file:net.rim.ejde.internal.ui.preferences.SignatureToolPrefsPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite main = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*from  ww w  .  ja v a 2s  . c  o m*/
    main.setLayout(layout);
    main.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label linkLabel = new Label(main, SWT.NONE);
    linkLabel.setText(Messages.CodeSigningPrefsPage_ClickHereLabel);

    Link keyLink = new Link(main, SWT.NONE);
    keyLink.setText(Messages.CodeSigningPrefsPage_AddNewKeyLabel);
    keyLink.setToolTipText(Messages.CodeSigningPrefsPage_AddNewKeyToolTip);

    keyLink.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            ImportCSIFilesAction action = new ImportCSIFilesAction();
            action.run(null);
        }
    });

    _searchKeyLink = new Link(main, SWT.NONE);
    _searchKeyLink.setText(Messages.CodeSigningPrefsPage_AddOldKeyLabel);
    _searchKeyLink.setToolTipText(Messages.CodeSigningPrefsPage_AddOldKeyToolTip);

    _removeKeyLink = new Link(main, SWT.NONE);
    _removeKeyLink.setText(Messages.CodeSigningPrefsPage_RemoveCurrentKeyLabel);
    _removeKeyLink.setToolTipText(Messages.CodeSigningPrefsPage_RemoveCurrentKeyToolTip);

    File cskFile;
    File dbFile;
    try {
        cskFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME);
        dbFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME);
        if ((cskFile.exists()) && (dbFile.exists())) {
            _searchKeyLink.setEnabled(false);
            _removeKeyLink.setEnabled(true);
        } else {
            _searchKeyLink.setEnabled(true);
            _removeKeyLink.setEnabled(false);
        }
    } catch (IOException io) {
        _log.error(io.getMessage());
    }

    _searchKeyLink.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            // Open file dialog to allow user select the parent folder of *.csk and *.db files
            SigningSearchDialog oldKeyDialog = new SigningSearchDialog(getShell());
            try {
                ArrayList<File> oldKeyFiles = oldKeyDialog.search();
                if (oldKeyFiles != null) {
                    oldKeyDialog.copyFileIntoSignToolDir(oldKeyFiles);
                    MessageDialog dialog = new MessageDialog(getShell(),
                            Messages.CodeSigningPrefsPage_MessageDialogTitle1, null,
                            Messages.CodeSigningPrefsPage_MessageDialogMsg1, MessageDialog.INFORMATION,
                            new String[] { IDialogConstants.OK_LABEL }, 0);
                    dialog.open();
                    _searchKeyLink.setEnabled(false);
                    _removeKeyLink.setEnabled(true);
                    _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg9);
                }
            } catch (IllegalArgumentException ex) {
                MessageDialog dialog = new MessageDialog(getShell(),
                        Messages.CodeSigningPrefsPage_MessageDialogTitle1, null, ex.getMessage(),
                        MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.open();
            }
        }
    });

    _removeKeyLink.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            if (MessageDialog.openQuestion(getShell(), Messages.CodeSigningPrefsPage_MessageDialogTitle3,
                    Messages.CodeSigningPrefsPage_MessageDialogMsg4
                            + Messages.CodeSigningPrefsPage_MessageDialogMsg6)) {
                removeKeys();
            }
        }
    });

    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gridData.verticalIndent = 15;

    _runSignToolAutomatically = new Button(main, SWT.CHECK);
    _runSignToolAutomatically.setText(Messages.SignatureToolPrefsPage_AutomaticallySigningBtnMsg);
    _runSignToolAutomatically.setToolTipText(Messages.SignatureToolPrefsPage_AutomaticallySigningBtnTooltipMsg);
    _runSignToolAutomatically.setLayoutData(gridData);

    _runSignToolSilently = new Button(main, SWT.CHECK);
    _runSignToolSilently.setText(Messages.SignatureToolPrefsPage_SilentToolBtnMsg);
    _runSignToolSilently.setToolTipText(Messages.SignatureToolPrefsPage_SilentToolBtnTooltipMsg);
    _runSignToolSilently.setLayoutData(gridData);

    initValues();

    return parent;
}