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.baremetalstudios.mapleide.actions.OpenFileAction.java

License:Open Source License

@Override
public void run() {
    File file = queryFile();// w  ww  .  j  a  va2  s  . c  om
    if (file != null) {
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(file.getPath()));
        if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) {
            IWorkbenchPage page = fWindow.getActivePage();
            try {
                IDE.openEditorOnFileStore(page, fileStore);
            } catch (PartInitException e) {
                e.printStackTrace();
            }
        }
    } else {
        MessageDialog.openWarning(fWindow.getShell(), "Problem", "File is 'null'");
    }
}

From source file:com.bluexml.side.Class.modeler.ClazzPlugin.java

License:Open Source License

/**
 * Display a dialog box with the specified level
 * /*from  w  ww.j  a v  a2  s .c o m*/
 * @param title title dialog box
 * @param message message displayed
 * @param level message level
 * @_generated
 */
public static void displayDialog(final String title, final String message, 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.Class.modeler.diagram.dialogs.AspectEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from w w  w.  j a  v a  2  s  .  co  m
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(ASPECT_NAME, aspectNameTxt.getText());
        data.put(ASPECT_TITLE, aspectTitleTxt.getText());
        data.put(ASPECT_DESCRIPTION, aspectDescriptionTxt.getText());
        data.put(ASPECT_LAYOUT, ((Text) layout).getText());
        super.okPressed();
    } catch (Exception e) {
        ClazzPlugin.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.Class.modeler.diagram.dialogs.AttributeEditDialog.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<String, Object>();
    try {
        data.put(PROPERTY_NAME, propertyNameTxt.getText());
        data.put(PROPERTY_VALUELIST, valueList.getSelection());
        data.put(PROPERTY_TYPE, typeChooser.getSelection());
        // data.put(PROPERTY_VISIBILITY, visibilityChooser.getSelection());
        dataConstraints = MetaInfoHelper.getDataStructure(drawConstraints);
        data.put(PROPERTY_CONSTRAINTS, dataConstraints);
        data.put(PROPERTY_DOCUMENTATION, ((Text) documentation).getText());
        data.put(PROPERTY_TITLE, ((Text) propertyTitleTxt).getText());
        data.put(PROPERTY_DESCRIPTION, ((Text) propertyDescriptionTxt).getText());
        data.put(PROPERTY_UNIQUE, unique.getSelection());
        super.okPressed();
    } catch (Exception e) {
        ClazzPlugin.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.Class.modeler.diagram.dialogs.ClazzEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from w  w  w .j  av  a 2s  .co m
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(CLASSE_NAME, classeNameTxt.getText());
        data.put(CLASSE_TITLE, classeTitleTxt.getText());
        data.put(CLASSE_DESCRIPTION, classeDescriptionTxt.getText());
        //         data.put(CLASSE_VIEW, ((Text) view).getText());

        //         data.put(CLASSE_LAYOUT, ((Text) layout).getText());
        //         ConstraintsDataStructure dataConstraints = MetaInfoHelper.getDataStructure(drawConstraints);
        //         data.put(CLASSE_METAINFO, dataConstraints);
        data.put(CLASSE_ISABSTRACT, checkIsAbstractBt.getSelection());
        data.put(CLASSE_DOCUMENTATION, documentation.getText());
        data.put(CLASSE_ISDEPRECATED, checkIsDeprecatedBt.getSelection());

        // Refresh order aspects
        //         classe.getAspects().clear();
        //         for (TableItem ti : table.getItems()) {
        //            classe.getAspects().add((Aspect) ti.getData());
        //         }
        super.okPressed();
    } catch (Exception e) {
        // TODO change this with a validation listener that disable the ok
        // button until the widgets are valid
        ClazzPlugin.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.Class.modeler.diagram.dialogs.EnumerationEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * /*from  w w w .  j  ava2  s.co m*/
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(ENUMERATION_NAME, EnumerationNameTxt.getText());
        data.put(ENUMERATION_LITERALS, inputParameters.getData());
        //         data.put(ENUMERATION_ISDYNAMIC, checkIsDynamicBt.getSelection());
        super.okPressed();
    } catch (Exception e) {
        ClazzPlugin.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.HavePortletEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * /*from ww w  . j  a v a  2 s.c  o  m*/
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        List<PositionObject> listPos = inputPosition.getData().getData();
        for (PositionObject positionObject : listPos) {
            if (positionObject.getColumnId().equals("") || positionObject.getLayoutId().equals("")) {
                throw new Exception("Not valide please check Page and Layout Elements ...");
            }
        }
        data.put(HAVEPORTLET_Position, inputPosition.getData());
        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.InstanciatePortletTypeEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from  w  w w .j  av  a  2s.c  o  m
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(INSTANCIATEPORTLETTYPE_instances, inputInstances.getData());
        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.IsChildPageEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from  w w  w. java 2s. c om
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(ISCHILDPAGE_Inherit, inherit.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.PageEditDialog.java

License:Open Source License

/**
 * Save the values before the widgets are disposed
 * //from www .  j  a v  a2s.c  om
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
protected void okPressed() {
    data = new HashMap();
    try {
        data.put(PAGE_ID, pageId.getText());
        data.put(PAGE_DESCRIPTION, pageDescription.getText());
        data.put(PAGE_TITLE, pageTitle.getText());
        data.put(PAGE_POSITION, pagePos.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.");
    }
}