Search in sources :

Example 1 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project cogtool by cogtool.

the class WindowUtil method createMessageDialog.

/**
     * Creates a nested interaction pop-up (modal) window.
     *
     * For the "flag" parameters, use the following values:
     * <code>
     * buttons: one of the following combinations
     *          SWT.OK
     *          SWT.OK | SWT.CANCEL
     *          SWT.YES | SWT.NO
     *          SWT.YES | SWT.NO | SWT.CANCEL
     *          SWT.RETRY | SWT.CANCEL
     *          SWT.ABORT | SWT.RETRY | SWT.IGNORE
     *
     * icon: one of
     *       SWT.ICON_ERROR, SWT.ICON_INFORMATION, SWT.ICON_QUESTION,
     *       SWT.ICON_WARNING, SWT.ICON_WORKING, SWT.NONE
     *
     * mode: one of (in increasing order of restriction)
     *       SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL
     * </code>
     *
     * @param parent    the window the pop-up "adheres" to
     * @param title     the title for the pop-up window
     * @param message   the message to display to the user
     * @param buttons   which buttons to display in the pop-up
     * @param icon      the icon to display, indicating the message's nature
     * @param mode      whether the pop-up is modal relative to
     *                  the parent window, the application as a whole,
     *                  or the entire user's system/computer
     * @return          the created MessageBox
     * @author          mlh
     * @see org.eclipse.swt.widgets.MessageBox
     * @see org.eclipse.swt.SWT
     */
public static MessageBox createMessageDialog(Shell parent, String title, String message, int buttons, int icon, int mode) {
    MessageBox msgBox = new MessageBox(parent, buttons | icon | mode);
    msgBox.setText(title);
    msgBox.setMessage(message);
    return msgBox;
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 2 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project dbeaver by serge-rider.

the class DBeaverApplication method showMessageBox.

int showMessageBox(String title, String message, int style) {
    // Can't lock specified path
    Shell shell = new Shell(getDisplay(), SWT.ON_TOP);
    shell.setText(GeneralUtils.getProductTitle());
    MessageBox messageBox = new MessageBox(shell, style);
    messageBox.setText(title);
    messageBox.setMessage(message);
    int msgResult = messageBox.open();
    shell.dispose();
    return msgResult;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 3 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project translationstudio8 by heartsome.

the class NativeDialogFactory method showMessageBox.

/**
	 * Show message box.
	 * 
	 * In default mode, a native MessageBox is used.
	 * In testing mode, we use a MessageDialog, showing the same title and message.
	 * 	  
	 * @param messageText the text of the message
	 * @param title the title
	 * @param iconStyle the icon style
	 * @param shell the parent shell
	 */
public static void showMessageBox(Shell shell, String messageText, final String title, final int iconStyle) {
    if (shell == null) {
        //			logger
        //					.fatal("Shell not yet instantiated, cannot display error message");
        System.err.println("Shell not yet instantiated, cannot display error message");
    } else {
        switch(getMode()) {
            case DEFAULT:
                {
                    MessageBox messageBox = new MessageBox(shell, iconStyle);
                    messageBox.setMessage(messageText);
                    messageBox.setText(title);
                    messageBox.open();
                    break;
                }
            case TESTING:
                {
                    // ignore the iconStyle, this only creates trouble when testing.
                    MessageDialog messagDialog = new MessageDialog(shell, title, null, messageText, MessageDialog.NONE, new String[] { "OK" }, 0);
                    messagDialog.open();
                    break;
                }
            default:
                final String msg = "Reached default case in NativeDialogFactory, this is a bug, unknown state " + getMode();
                //				logger.warn(msg);
                System.err.println(msg);
                throw new RuntimeException(msg);
        }
    }
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 4 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project translationstudio8 by heartsome.

the class AspellChecker method checkStatus.

private void checkStatus() {
    try {
        while (response != null && !response.equals("")) {
            if (isError) {
                return;
            }
            if (response.equals("*")) {
                // 当前单词是存在于词典中的
                spellWriter.write(spellCheckLinePrefix);
                spellWriter.newLine();
                spellWriter.flush();
                response = spellReader.readLine();
            } else {
                if (response.startsWith("&") || response.startsWith("#")) {
                    parseSuggestions(response);
                    response = spellReader.readLine();
                }
            }
        }
        if (response == null || response.equals("")) {
            return;
        }
    } catch (IOException e) {
        MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
        box.setMessage(e.getMessage());
        box.open();
        logger.error(Messages.getString("qa.spellCheck.all.log2"), e);
    }
}
Also used : IOException(java.io.IOException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 5 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project translationstudio8 by heartsome.

the class AddOrUpdateLanguageDialog method okPressed.

@Override
public void okPressed() {
    if (txtCode.getText() == null || "".equals(txtCode.getText().trim())) {
        //$NON-NLS-1$
        MessageDialog.openInformation(getShell(), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg1"));
        txtCode.forceFocus();
        return;
    }
    if (intType == DIALOG_ADD) {
        if (languageModel.getLanguagesMap().containsKey(txtCode.getText())) {
            MessageDialog.openInformation(getShell(), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg2"));
            return;
        }
    } else if (intType == DIALOG_EDIT) {
        if (!txtCode.getText().equals(strCode) && languageModel.getLanguagesMap().containsKey(txtCode.getText())) {
            MessageDialog.openInformation(getShell(), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg2"));
            return;
        }
    }
    if (txtName.getText() == null || "".equals(txtName.getText().trim())) {
        //$NON-NLS-1$
        MessageDialog.openInformation(getShell(), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg3"));
        txtName.forceFocus();
        return;
    }
    String status = parse(txtCode.getText());
    if (!status.equals("")) {
        //$NON-NLS-1$
        MessageBox box = new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
        //$NON-NLS-1$
        box.setMessage(status + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg4"));
        if (box.open() == SWT.NO) {
            return;
        }
    }
    imagePath = (String) imageLabel.getData();
    if (imagePath == null) {
        imagePath = "";
    }
    strCode = txtCode.getText();
    strName = txtName.getText();
    blnIsBidi = btnIsBidi.getSelection();
    close();
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

MessageBox (org.eclipse.swt.widgets.MessageBox)37 ArrayList (java.util.ArrayList)8 Shell (org.eclipse.swt.widgets.Shell)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 IOException (java.io.IOException)4 List (java.util.List)4 IElementParameter (org.talend.core.model.process.IElementParameter)4 Node (org.talend.designer.core.ui.editor.nodes.Node)4 File (java.io.File)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Label (org.eclipse.swt.widgets.Label)3 Text (org.eclipse.swt.widgets.Text)3 IConnection (org.talend.core.model.process.IConnection)3 Message (ca.uhn.hl7v2.model.Message)2 IllegalOperationException (cl.utfsm.acs.acg.core.IllegalOperationException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2