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

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

Introduction

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

Prototype

public static void openWarning(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard warning dialog.

Usage

From source file:com.bluexml.side.Portal.modeler.diagram.dialogs.PortalLayoutEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * /*from ww w  .  ja v  a 2s .  c  o  m*/
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(PAGELAYOUT_Name, portalLayoutName.getText());
        data.put(PAGELAYOUT_Columns, inputColumns.getData());
        data.put(PAGELAYOUT_ColumnsKind, portalLayoutColumnKind.getSelection());
        super.okPressed();
    } catch (Exception e) {
        // TODO change this with a validation listener that disable the ok
        // button until the widgets are valid
        PortalPlugin.log("Required fields", IStatus.WARNING);
        MessageDialog.openWarning(getShell(), "Required parameters",
                "Some parameters are not set.\nPlease, fill those fields before validating.");
    }
}

From source file:com.bluexml.side.Portal.modeler.diagram.dialogs.PortletEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from   w w w. j  a  va  2  s  .  c o m
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(PORTLET_Name, pageName.getText());
        super.okPressed();
    } catch (Exception e) {
        // TODO change this with a validation listener that disable the ok
        // button until the widgets are valid
        PortalPlugin.log("Required fields", IStatus.WARNING);
        MessageDialog.openWarning(getShell(), "Required parameters",
                "Some parameters are not set.\nPlease, fill those fields before validating.");
    }
}

From source file:com.bluexml.side.Portal.modeler.diagram.dialogs.PortletInternalEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * // w  w w . j a va2 s  . co  m
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        InternalPortletType t = (InternalPortletType) typeChooser.getSelection();
        data.put(PORTLETINTERNAL_Type, t);
        if (t.equals(InternalPortletType.FORM)) {
            data.put(PORTLETINTERNAL_Form, chooser.getSelection());
        } else {
            data.put(PORTLETINTERNAL_View, chooser.getSelection());
        }

        super.okPressed();
    } catch (Exception e) {
        // TODO change this with a validation listener that disable the ok
        // button until the widgets are valid
        PortalPlugin.log("Required fields", IStatus.WARNING);
        MessageDialog.openWarning(getShell(), "Required parameters",
                "Some parameters are not set.\nPlease, fill those fields before validating.");
    }
}

From source file:com.bluexml.side.Portal.modeler.diagram.dialogs.PortletTypeEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * /*from  w  ww . j  a  va2 s  .  c o m*/
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(PORTLETYPE_ID, portletId.getText());
        data.put(PORTLETYPE_Name, portletName.getText());
        data.put(PORTLETYPE_Attributes, inputAttributes.getData());
        data.put(PORTLETYPE_Instanceable, portletInstanceable.getSelection());
        super.okPressed();
    } catch (Exception e) {
        // TODO change this with a validation listener that disable the ok
        // button until the widgets are valid
        PortalPlugin.log("Required fields", IStatus.WARNING);
        MessageDialog.openWarning(getShell(), "Required parameters",
                "Some parameters are not set.\nPlease, fill those fields before validating.");
    }
}

From source file:com.bluexml.side.Requirements.modeler.RequirementsPlugin.java

License:Open Source License

/**
 * Display a dialog box with the specified level
 * //from  ww w. j ava2  s.c  om
 * @param title title dialog box
 * @param message message displayed
 * @param level message level
 * @generated
 */
public static void displayDialog(final String title, final String message, final int level) {
    if (level == IStatus.INFO) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                MessageDialog.openInformation(getActiveWorkbenchShell(),
                        (title == null) ? "Information" : title, (message == null) ? "" : message);
            }
        });
    } else if (level == IStatus.WARNING) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                MessageDialog.openWarning(getActiveWorkbenchShell(), (title == null) ? "Warning" : title,
                        (message == null) ? "" : message);
            }
        });
    } else if (level == IStatus.ERROR) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                MessageDialog.openError(getActiveWorkbenchShell(), (title == null) ? "Error" : title,
                        (message == null) ? "" : message);
            }
        });
    }
}

From source file:com.bluexml.side.Workflow.modeler.diagram.dialogs.ActionEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * /* w  w w  .  j a  v a 2 s . c  om*/
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap<String, Object>();
    try {
        data.put(ACTION_SCRIPT, scriptTxt.getText());
        if (inEnterpriseVersion())
            data.put(ACTION_JAVA_CLASS, javaClass.getText());
        else
            data.put(ACTION_JAVA_CLASS, "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript");
        data.put(ACTION_VARIABLE, inputParameters.getData());
        super.okPressed();
    } catch (Exception e) {
        WorkflowPlugin.log("Required fields", IStatus.WARNING);
        MessageDialog.openWarning(getShell(), "Required parameters",
                "Some parameters are not set.\nPlease, fill those fields before validating.");
    }
}

From source file:com.bluexml.side.Workflow.modeler.diagram.dialogs.ProcessStateEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from  w w w .  j  a  v  a  2s  . com
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap<String, Object>();
    try {
        data.put(ACTION_VARIABLE, inputParameters.getData());
        super.okPressed();
    } catch (Exception e) {
        WorkflowPlugin.log("Required fields", IStatus.WARNING);
        MessageDialog.openWarning(getShell(), "Required parameters",
                "Some parameters are not set.\nPlease, fill those fields before validating.");
    }
}

From source file:com.byterefinery.rmbench.export.ModelCompareEditor.java

License:Open Source License

/**
 * ask the user for the workspace path of a file resource and save the document there.
 * <p><em>/*from   www  .  jav  a  2 s  .  c  o  m*/
 * copied from {@link org.eclipse.ui.editors.text.TextEditor}. Sorry for that</em>
 * 
 * @param progressMonitor the progress monitor to be used
 */
protected void performSaveAs(IProgressMonitor progressMonitor) {
    Shell shell = getSite().getShell();
    IEditorInput input = getEditorInput();

    SaveAsDialog dialog = new SaveAsDialog(shell);

    IFile original = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null;
    if (original != null)
        dialog.setOriginalFile(original);

    dialog.create();

    if (documentProvider == null) {
        // editor has programmatically been  closed while the dialog was open
        return;
    }

    if (documentProvider.isDeleted(input) && original != null) {
        String message = MessageFormat.format(Messages.MCEditor_warning_save_delete,
                new Object[] { original.getName() });
        dialog.setErrorMessage(null);
        dialog.setMessage(message, IMessageProvider.WARNING);
    }

    if (dialog.open() == Window.CANCEL) {
        if (progressMonitor != null)
            progressMonitor.setCanceled(true);
        return;
    }

    IPath filePath = dialog.getResult();
    if (filePath == null) {
        if (progressMonitor != null)
            progressMonitor.setCanceled(true);
        return;
    }

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IFile file = workspace.getRoot().getFile(filePath);
    final IEditorInput newInput = new NonPersistableFileEditorInput(file);

    boolean success = false;
    try {

        documentProvider.aboutToChange(newInput);
        documentProvider.saveDocument(progressMonitor, newInput, documentProvider.getDocument(input), true);
        success = true;

    } catch (CoreException x) {
        IStatus status = x.getStatus();
        if (status == null || status.getSeverity() != IStatus.CANCEL) {
            String title = Messages.MCEditor_error_save_title;
            String msg = MessageFormat.format(Messages.MCEditor_error_save_message,
                    new Object[] { x.getMessage() });

            if (status != null) {
                switch (status.getSeverity()) {
                case IStatus.INFO:
                    MessageDialog.openInformation(shell, title, msg);
                    break;
                case IStatus.WARNING:
                    MessageDialog.openWarning(shell, title, msg);
                    break;
                default:
                    MessageDialog.openError(shell, title, msg);
                }
            } else {
                MessageDialog.openError(shell, title, msg);
            }
        }
    } finally {
        documentProvider.changed(newInput);
        if (success)
            setInput(newInput);
    }

    if (progressMonitor != null)
        progressMonitor.setCanceled(!success);
}

From source file:com.casmall.dts.manage.ui.auth.AuthMgtEditComposite.java

License:Open Source License

private boolean validate() {
    if (txtAuthKey.getText().trim().length() != 14) {
        MessageDialog.openWarning(getShell(), " ", " .");
        txtAuthKey.setFocus();//from   w  w  w  . j  ava  2  s . c  o  m
        return false;
    }
    if ("".equals(txtAuthNum.getText().trim())) {
        MessageDialog.openWarning(getShell(), "",
                "  .  .");
        txtAuthKey.setFocus();
        return false;
    }
    if ("".equals(txtCustNm.getText().trim())) {
        MessageDialog.openWarning(getShell(), "", " .");
        txtCustNm.setFocus();
        return false;
    }

    return true;
}

From source file:com.casmall.dts.manage.ui.auth.AuthMgtEditComposite.java

License:Open Source License

private void select() {
    ArrayList<TsAuthMgtDTO> list = null;
    try {// ww w. j  a v  a  2 s .com
        list = mgr.selectTsAuthMgt(dto);
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (list == null || list.size() == 0) {
        MessageDialog.openWarning(getShell(), "", "  .");
        return;
    }
    dto = list.get(0);
    this.txtAuthKey.setText(StringUtil.nullToBlank(dto.getAuth_key()));
    this.txtAuthNum.setText(StringUtil.nullToBlank(dto.getAuth_num()));
    this.txtCustNm.setText(StringUtil.nullToBlank(dto.getCst_nm()));
    this.txtCustTel.setText(StringUtil.nullToBlank(dto.getCst_tel()));
    this.txtNt.setText(StringUtil.nullToBlank(dto.getNt()));
    txtAuthKey.setFocus();
}