Example usage for org.eclipse.jface.dialogs IMessageProvider NONE

List of usage examples for org.eclipse.jface.dialogs IMessageProvider NONE

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider NONE.

Prototype

int NONE

To view the source code for org.eclipse.jface.dialogs IMessageProvider NONE.

Click Source Link

Document

Constant for a regular message (value 0).

Usage

From source file:org.springsource.ide.eclipse.commons.livexp.ui.PreferencePageWithSections.java

License:Open Source License

public void gotValue(LiveExpression<ValidationResult> exp, ValidationResult status) {
    Display.getDefault().asyncExec(() -> {
        setErrorMessage(null);/*  www  .  j a  va 2s  .co m*/
        setMessage(null);
        if (status.isOk()) {
        } else if (status.status == IStatus.ERROR) {
            setErrorMessage(status.msg);
        } else if (status.status == IStatus.WARNING) {
            setMessage(status.msg, IMessageProvider.WARNING);
        } else if (status.status == IStatus.INFO) {
            setMessage(status.msg, IMessageProvider.INFORMATION);
        } else {
            setMessage(status.msg, IMessageProvider.NONE);
        }
    });
}

From source file:org.springsource.ide.eclipse.commons.livexp.ui.WizardPageWithSections.java

License:Open Source License

public void gotValue(LiveExpression<ValidationResult> exp, ValidationResult status) {
    setErrorMessage(null);//w w  w .j  av  a2s  . c om
    setMessage(null);
    if (status.isOk()) {
    } else if (status.status == IStatus.ERROR) {
        setErrorMessage(status.msg);
    } else if (status.status == IStatus.WARNING) {
        setMessage(status.msg, IMessageProvider.WARNING);
    } else if (status.status == IStatus.INFO) {
        setMessage(status.msg, IMessageProvider.INFORMATION);
    } else {
        setMessage(status.msg, IMessageProvider.NONE);
    }
    setPageComplete(status.isOk());
}

From source file:org.springsource.ide.eclipse.gradle.ui.PreferencePageWithSections.java

License:Open Source License

public void gotValue(LiveExpression<ValidationResult> exp, ValidationResult status) {
    setErrorMessage(null);//from ww w . j av a  2  s.c  o m
    setMessage(null);
    if (status.isOk()) {
    } else if (status.status == IStatus.ERROR) {
        setErrorMessage(status.msg);
    } else if (status.status == IStatus.WARNING) {
        setMessage(status.msg, IMessageProvider.WARNING);
    } else if (status.status == IStatus.INFO) {
        setMessage(status.msg, IMessageProvider.INFORMATION);
    } else {
        setMessage(status.msg, IMessageProvider.NONE);
    }
}

From source file:org.svenk.redmine.ui.editor.RedmineTaskEditorPage.java

License:Open Source License

public RedmineTaskEditorPage(TaskEditor editor) {
    super(editor, RedmineCorePlugin.REPOSITORY_KIND);

    setNeedsPrivateSection(true);/*  w w w . j  a  v a2  s .co m*/
    setNeedsSubmitButton(true);

    STATUS_LISTENER = new IRedmineAttributeChangedListener() {
        public void attributeChanged(ITask task, TaskAttribute attribute) {
            if (getTask() == task) {
                if (attribute.getId().equals(RedmineAttribute.STATUS_CHG.getTaskKey())) {
                    TaskDataModel model = getModel();
                    TaskAttribute modelAttribute = model.getTaskData().getRoot()
                            .getAttribute(attribute.getId());

                    if (!modelAttribute.getValue().equals(attribute.getValue())) {
                        modelAttribute.setValue(attribute.getValue());
                        model.attributeChanged(modelAttribute);

                    }
                }
            }
        }
    };

    MODEL_LISTENER = new TaskDataModelListener() {
        @Override
        public void attributeChanged(TaskDataModelEvent event) {
            RedmineTaskDataValidatorResult result = validator.validateTaskAttribute(getModel().getTaskData(),
                    event.getTaskAttribute());
            if (result.hasErrors()) {
                getTaskEditor().setMessage(result.getFirstErrorMessage(), IMessageProvider.WARNING);
            } else {
                getTaskEditor().setMessage("", IMessageProvider.NONE); //$NON-NLS-1$
            }

            TaskAttribute changedAttribute = event.getTaskAttribute();
            if (changedAttribute.getId().equals(RedmineAttribute.STATUS_CHG.getTaskKey())) {
                TaskDataModel model = event.getModel();
                TaskAttribute markasOperation = model.getTaskData().getRoot()
                        .getAttribute(TaskAttribute.PREFIX_OPERATION + RedmineOperation.markas.toString());
                if (markasOperation != null) {
                    TaskAttribute operation = model.getTaskData().getRoot()
                            .getAttribute(TaskAttribute.OPERATION);
                    model.getTaskData().getAttributeMapper().setValue(operation,
                            RedmineOperation.markas.toString());
                    model.attributeChanged(operation);

                    if (statusChangeEditor != null) {
                        Control control = statusChangeEditor.getControl();
                        if (control != null && control instanceof CCombo) {
                            Listener[] listeners = control.getListeners(SWT.Selection);
                            if (listeners != null && listeners.length == 2) {
                                Event e = new Event();
                                e.widget = control;
                                e.type = SWT.Selection;
                                /*
                                 * Excpected listeners:
                                 * 0: AttributeEditor
                                 * 1: ActionButton
                                 */
                                listeners[1].handleEvent(e);
                            }
                        }
                    }
                }
            }

            if (changedAttribute.getId().equals(RedmineAttribute.TRACKER.getTaskKey())) {
                try {
                    refreshCustomFields(Integer.parseInt(changedAttribute.getValue()));
                    TaskAttribute rootAttribute = changedAttribute.getTaskData().getRoot();

                    //remove old CutomFields from Form and Map
                    for (TaskAttribute attribute : new ArrayList<TaskAttribute>(attributeEditors.keySet())) {
                        if (attribute.getId().startsWith(IRedmineConstants.TASK_KEY_PREFIX_TICKET_CF)) {
                            attributeEditors.get(attribute).getLabelControl().dispose();
                            attributeEditors.get(attribute).getControl().dispose();
                            attributeEditors.remove(attribute);
                        }
                    }

                    //create and add new CustomFields
                    Composite parent = trackerEditor.getControl().getParent();
                    RedmineAttributePartLayoutHelper layoutHelper = new RedmineAttributePartLayoutHelper(
                            parent);

                    for (RedmineCustomField cf : customFields.values()) {
                        TaskAttribute cfAttribute = rootAttribute
                                .getAttribute(IRedmineConstants.TASK_KEY_PREFIX_TICKET_CF + cf.getId());
                        if (cfAttribute != null) {
                            AbstractAttributeEditor cfEditor = getAttributeEditorFactory()
                                    .createEditor(cfAttribute.getMetaData().getType(), cfAttribute);

                            cfEditor.createLabelControl(parent, getManagedForm().getToolkit());
                            cfEditor.createControl(parent, getManagedForm().getToolkit());
                            layoutHelper.setLayoutData(cfEditor);

                            getAttributeEditorToolkit().adapt(cfEditor);
                            attributeEditors.put(cfAttribute, cfEditor);
                        }
                    }

                    parent.layout();

                } catch (NumberFormatException e) {
                    StatusHandler.fail(RedmineCorePlugin.toStatus(e, null,
                            Messages.RedmineTaskEditorPage_INVALID_TRACKER_ID_MSG_WITH_PARAM,
                            changedAttribute.getValue()));
                }
            }
        }
    };

}

From source file:org.svenk.redmine.ui.editor.RedmineTaskEditorPage.java

License:Open Source License

@Override
public void doSubmit() {
    TaskAttribute attribute = getModel().getTaskData().getRoot()
            .getMappedAttribute(RedmineAttribute.SUMMARY.getTaskKey());
    if (attribute != null && attribute.getValue().trim().length() == 0) {
        getTaskEditor().setMessage(Messages.RedmineTaskEditorPage_MISSING_SUBJECT_MSG, IMessageProvider.ERROR);
        AbstractTaskEditorPart part = getPart(ID_PART_SUMMARY);
        if (part != null) {
            part.setFocus();/*from w w w.  j  av  a2s .c  o m*/
        }
        return;
    }

    attribute = getModel().getTaskData().getRoot()
            .getMappedAttribute(RedmineAttribute.DESCRIPTION.getTaskKey());
    if (attribute != null && attribute.getValue().trim().length() == 0) {
        getTaskEditor().setMessage(Messages.RedmineTaskEditorPage_MISSING_DESCRIPTION_MSG,
                IMessageProvider.ERROR);
        AbstractTaskEditorPart part = getPart(ID_PART_DESCRIPTION);
        if (part != null) {
            part.setFocus();
        }
        return;
    }

    RedmineTaskDataValidatorResult result = validator.validateTaskData(getModel().getTaskData());
    if (result.hasErrors()) {
        getTaskEditor().setMessage(result.getFirstErrorMessage(), IMessageProvider.ERROR);
        return;
    }

    getTaskEditor().setMessage("", IMessageProvider.NONE); //$NON-NLS-1$
    super.doSubmit();
}

From source file:org.universaal.tools.configurationEditor.dialogs.AttributeDialog.java

License:Apache License

public void create() {

    super.create();

    // Set the title
    setTitle("Add attribute");

    // Set the message
    setMessage("Add an attribute to the validator", IMessageProvider.NONE);

}

From source file:org.universaal.tools.configurationEditor.dialogs.CategoryDialog.java

License:Apache License

public void create() {

    super.create();

    // Set the title
    setTitle("Add category");

    // Set the message
    setMessage("Add a category to the configuration", IMessageProvider.NONE);

}

From source file:org.universaal.tools.configurationEditor.dialogs.MapConfigItemDialog.java

License:Apache License

public void create() {

    super.create();

    // Set the title
    setTitle("Add mapConfigItem");

    // Set the message
    setMessage("Add a mapConfigItem to the selected category", IMessageProvider.NONE);

    options = new LinkedList<String>();

}

From source file:org.universaal.tools.configurationEditor.dialogs.OptionDialog.java

License:Apache License

public void create() {

    super.create();

    // Set the title
    setTitle("Add option");

    // Set the message
    setMessage("Add an option to the mapConfigItem", IMessageProvider.NONE);

}

From source file:org.universaal.tools.configurationEditor.dialogs.SimpleConfigItemDialog.java

License:Apache License

public void create() {

    super.create();

    // Set the title
    setTitle("Add simpleConfigItem");

    // Set the message
    setMessage("Add a simpleConfigItem to the selected category", IMessageProvider.NONE);

}