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

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

Introduction

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

Prototype

int WARNING

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

Click Source Link

Document

Constant for a warning message (value 2).

Usage

From source file:org.eclipse.mylyn.internal.web.tasks.WebQueryWizardPage.java

License:Open Source License

void updatePreviewTable(List<TaskMapper> queryHits, MultiStatus queryStatus) {
    previewTable.setInput(queryHits);/* w w w  . jav  a2s.c  om*/

    if (queryStatus.isOK()) {
        setMessage(null, IMessageProvider.WARNING);
    } else {
        StringBuffer sb = new StringBuffer();
        for (IStatus status : queryStatus.getChildren()) {
            sb.append(status.getMessage()).append("\n"); //$NON-NLS-1$
        }
        setMessage(sb.toString(), IMessageProvider.WARNING);
    }
}

From source file:org.eclipse.mylyn.reviews.connector.ui.EmfRepositorySettingsPage.java

License:Open Source License

protected void updateMessage() {
    int messageError = IMessageProvider.INFORMATION;
    if (validity.getSeverity() == IStatus.WARNING) {
        messageError = IMessageProvider.WARNING;
    } else if (validity.getSeverity() == IStatus.ERROR) {
        messageError = IMessageProvider.ERROR;
    }//from   w w  w.  j  av  a  2  s.co m
    setMessage(validity.getMessage(), messageError);
}

From source file:org.eclipse.mylyn.reviews.ui.spi.editor.AbstractReviewTaskEditorPage.java

License:Open Source License

private void checkIfModelIsCached() {
    AbstractRemoteEditFactoryProvider factoryProvider = (AbstractRemoteEditFactoryProvider) getFactoryProvider();
    String reviewPath = factoryProvider.getDataLocator()
            .getFilePath(factoryProvider.getContainerSegment(), "Review", getTask().getTaskId(), "reviews") //$NON-NLS-1$ //$NON-NLS-2$
            .toOSString();/*from ww  w .ja va2 s.c  om*/
    if (!new File(reviewPath).exists()) {
        getTaskEditor().setMessage(
                org.eclipse.mylyn.internal.tasks.ui.editors.Messages.AbstractTaskEditorPage_Synchronize_to_retrieve_task_data,
                IMessageProvider.WARNING, new HyperlinkAdapter() {
                    @Override
                    public void linkActivated(HyperlinkEvent e) {
                        SynchronizeEditorAction synchronizeEditorAction = new SynchronizeEditorAction();
                        synchronizeEditorAction.selectionChanged(new StructuredSelection(getTaskEditor()));
                        if (synchronizeEditorAction != null) {
                            synchronizeEditorAction.run();
                        }
                    }
                });
    }
}

From source file:org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage.java

License:Open Source License

private void updateHeaderMessage() {
    if (taskData == null) {
        getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Synchronize_to_retrieve_task_data,
                IMessageProvider.WARNING, new HyperlinkAdapter() {
                    @Override// w w  w . j a  v  a 2s .c  o m
                    public void linkActivated(HyperlinkEvent e) {
                        if (synchronizeEditorAction != null) {
                            synchronizeEditorAction.run();
                        }
                    }
                });
    }
    if (getTaskEditor().getMessage() == null
            && TasksUiPlugin.getTaskList().getTask(task.getRepositoryUrl(), task.getTaskId()) == null) {
        getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Add_task_to_tasklist,
                IMessageProvider.INFORMATION, new NotInTaskListListener());
    }
}

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage.java

License:Open Source License

@Override
public boolean isPageComplete() {
    // reset error message to maintain backward compatibility: bug 288892
    setErrorMessage(null);//ww  w  .  ja v a2  s  .  co m

    String queryTitle = getQueryTitle();
    if (queryTitle == null || queryTitle.equals("")) { //$NON-NLS-1$
        setMessage(Messages.AbstractRepositoryQueryPage_Please_specify_a_title_for_the_query);
        return false;
    } else {
        Set<RepositoryQuery> queries = TasksUiInternal.getTaskList().getQueries();
        Set<AbstractTaskCategory> categories = TasksUiInternal.getTaskList().getCategories();
        String oldSummary = null;
        if (query != null) {
            oldSummary = query.getSummary();
        }
        if (oldSummary == null || !queryTitle.equals(oldSummary)) {
            for (AbstractTaskCategory category : categories) {
                if (queryTitle.equals(category.getSummary())) {
                    setMessage(Messages.AbstractRepositoryQueryPage_A_category_with_this_name_already_exists,
                            IMessageProvider.ERROR);
                    return false;
                }
            }
            for (RepositoryQuery repositoryQuery : queries) {
                if (query == null || !query.equals(repositoryQuery)) {
                    if (queryTitle.equals(repositoryQuery.getSummary()) && repositoryQuery.getRepositoryUrl()
                            .equals(getTaskRepository().getRepositoryUrl())) {
                        setMessage(Messages.AbstractRepositoryQueryPage_A_query_with_this_name_already_exists,
                                IMessageProvider.WARNING);
                        return true;
                    }
                }
            }
        }
    }
    setMessage(null);
    return true;
}

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java

License:Open Source License

/**
 * @since 2.0//from  w  w  w  .  ja  va 2 s .  co m
 */
protected void applyValidatorResult(Validator validator) {
    IStatus status = validator.getStatus();
    String message = status.getMessage();
    if (message == null || message.length() == 0) {
        message = null;
    }
    switch (status.getSeverity()) {
    case IStatus.OK:
        if (status == Status.OK_STATUS) {
            if (getUserName().length() > 0) {
                message = Messages.AbstractRepositorySettingsPage_Authentication_credentials_are_valid;
            } else {
                message = Messages.AbstractRepositorySettingsPage_Repository_is_valid;
            }
        }
        setMessage(message, IMessageProvider.INFORMATION);
        break;
    case IStatus.INFO:
        setMessage(message, IMessageProvider.INFORMATION);
        break;
    case IStatus.WARNING:
        setMessage(message, IMessageProvider.WARNING);
        break;
    default:
        setMessage(message, IMessageProvider.ERROR);
        break;
    }
    setErrorMessage(null);

    isValid = status.getSeverity() == IStatus.OK || status.getSeverity() == IStatus.INFO;
}

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractTaskRepositoryPage.java

License:Open Source License

/**
 * Apply the results of validation to the page. The implementation finds the most {@link IStatus#getSeverity()
 * severe} status and {@link #setMessage(String, int) applies the message} to the page.
 * //from  w w w . ja va 2s .com
 * @param status
 *            the status of the validation, or null
 */
private void applyValidationResult(IStatus status) {
    if (status == null || status.isOK()) {
        setMessage(null, IMessageProvider.INFORMATION);
        setErrorMessage(null);
    } else {
        // find the most severe status
        int messageType;
        switch (status.getSeverity()) {
        case IStatus.OK:
        case IStatus.INFO:
            messageType = IMessageProvider.INFORMATION;
            break;
        case IStatus.WARNING:
            messageType = IMessageProvider.WARNING;
            break;
        case IStatus.ERROR:
        default:
            messageType = IMessageProvider.ERROR;
            break;
        }
        setErrorMessage(null);
        setMessage(status.getMessage(), messageType);
    }
}

From source file:org.eclipse.ocl.examples.emf.validation.debug.ui.wizards.ExportValidationResultsFileWizardPage.java

License:Open Source License

private boolean validateGroup() {
    boolean valid = true;
    ResourceAndContainerGroup group = getGroup();
    if (!group.areAllValuesValid()) {
        // if blank name then fail silently
        int problemType = group.getProblemType();
        String problemMessage = group.getProblemMessage();
        if (problemType == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
                || problemType == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
            setMessage(problemMessage);/*from   w ww  . j  av a2s  . c o m*/
            setErrorMessage(null);
        } else {
            setErrorMessage(problemMessage);
        }
        valid = false;
    }

    String resourceName = group.getResource();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IStatus result = workspace.validateName(resourceName, IResource.FILE);
    if (!result.isOK()) {
        setErrorMessage(result.getMessage());
        return false;
    }

    if (!resourceName.endsWith('.' + expectedExtension)) {
        setErrorMessage(NLS.bind(ValidationDebugMessages.NewWizardPage_wrongExtension, expectedExtension));
        return false;
    }

    if (group.getAllowExistingResources()) {
        String problemMessage = NLS.bind(ValidationDebugMessages.NewWizardPage_nameExists,
                getNewExportedFileName());
        IPath resourcePath = group.getContainerFullPath().append(getNewExportedFileName());
        IWorkspaceRoot root = workspace.getRoot();
        if (root.getFolder(resourcePath).exists()) {
            setErrorMessage(problemMessage);
            valid = false;
        }
        if (root.getFile(resourcePath).exists()) {
            setMessage(problemMessage, IMessageProvider.WARNING);
        }
    }

    if (isFilteredByParent()) {
        setMessage(ValidationDebugMessages.NewWizardPage_resourceWillBeFilteredWarning, IMessageProvider.ERROR);
        valid = false;
    }
    return valid;
}

From source file:org.eclipse.ocl.examples.emf.validation.validity.ui.wizards.ExportValidationResultsFileWizardPage.java

License:Open Source License

private boolean validateGroup() {
    boolean valid = true;
    ResourceAndContainerGroup group = getGroup();
    if (!group.areAllValuesValid()) {
        // if blank name then fail silently
        int problemType = group.getProblemType();
        String problemMessage = group.getProblemMessage();
        if (problemType == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
                || problemType == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
            setMessage(problemMessage);/*w  w w.j a v  a 2  s . co  m*/
            setErrorMessage(null);
        } else {
            setErrorMessage(problemMessage);
        }
        valid = false;
    }

    String resourceName = group.getResource();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IStatus result = workspace.validateName(resourceName, IResource.FILE);
    if (!result.isOK()) {
        setErrorMessage(result.getMessage());
        return false;
    }

    if (!resourceName.endsWith('.' + expectedExtension)) {
        setErrorMessage(NLS.bind(ValidityUIMessages.NewWizardPage_wrongExtension, expectedExtension));
        return false;
    }

    if (group.getAllowExistingResources()) {
        String problemMessage = NLS.bind(ValidityUIMessages.NewWizardPage_nameExists, getNewExportedFileName());
        IPath resourcePath = group.getContainerFullPath().append(getNewExportedFileName());
        IWorkspaceRoot root = workspace.getRoot();
        if (root.getFolder(resourcePath).exists()) {
            setErrorMessage(problemMessage);
            valid = false;
        }
        if (root.getFile(resourcePath).exists()) {
            setMessage(problemMessage, IMessageProvider.WARNING);
        }
    }

    if (isFilteredByParent()) {
        setMessage(ValidityUIMessages.NewWizardPage_resourceWillBeFilteredWarning, IMessageProvider.ERROR);
        valid = false;
    }
    return valid;
}

From source file:org.eclipse.ocl.examples.xtext.base.ui.wizards.AbstractFileDialog.java

License:Open Source License

public boolean validateGroup() {
    boolean valid = true;
    ResourceAndContainerGroup group = getGroup();
    if (!group.areAllValuesValid()) {
        // if blank name then fail silently
        int problemType = group.getProblemType();
        String problemMessage = group.getProblemMessage();
        if (problemType == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
                || problemType == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
            wizardPage.setMessage(problemMessage);
            wizardPage.setErrorMessage(null);
        } else {/*from   ww  w  . jav  a2s.co m*/
            wizardPage.setErrorMessage(problemMessage);
        }
        valid = false;
    }

    String resourceName = group.getResource();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IStatus result = workspace.validateName(resourceName, IResource.FILE);
    if (!result.isOK()) {
        wizardPage.setErrorMessage(result.getMessage());
        return false;
    }

    if (group.getAllowExistingResources()) {
        String problemMessage = NLS.bind(BaseUIMessages.NewWizardPage_nameExists, getFileName());
        IPath resourcePath = group.getContainerFullPath().append(getFileName());
        IWorkspaceRoot root = workspace.getRoot();
        if (root.getFolder(resourcePath).exists()) {
            wizardPage.setErrorMessage(problemMessage);
            valid = false;
        }
        if (root.getFile(resourcePath).exists()) {
            wizardPage.setMessage(problemMessage, IMessageProvider.WARNING);
        }
    }

    if (isFilteredByParent()) {
        wizardPage.setMessage(BaseUIMessages.NewWizardPage_resourceWillBeFilteredWarning,
                IMessageProvider.ERROR);
        valid = false;
    }
    return valid;
}