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

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

Introduction

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

Prototype

int ERROR

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

Click Source Link

Document

Constant for an error message (value 3).

Usage

From source file:org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage.java

License:Open Source License

@Override
public boolean canValidate() {
    // need to invoke isPageComplete() to trigger message update
    return isPageComplete() && (getMessage() == null || getMessageType() != IMessageProvider.ERROR);
}

From source file:org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage.java

License:Open Source License

@Override
public boolean isPageComplete() {
    if (descriptorFile != null) {
        String descriptorFilePath = descriptorFile.getText();
        if (descriptorFilePath != null && !descriptorFilePath.equals("")) { //$NON-NLS-1$
            File testFile = new File(descriptorFilePath);
            if (!testFile.exists()) {
                setMessage(Messages.BugzillaRepositorySettingsPage_DescriptorFileNotExists,
                        IMessageProvider.ERROR);
                return false;
            }/*  w  w w  . j av a  2s.c  o  m*/
        }
    }
    return super.isPageComplete();
}

From source file:org.eclipse.mylyn.internal.bugzilla.ui.wizard.BugzillaProductPage.java

License:Open Source License

/**
 * Applies the status to the status line of a dialog page.
 * /* w ww .j  a  v a  2  s  . c  o m*/
 * @param status
 *            The status to apply to the status line
 */
protected void applyToStatusLine(IStatus status) {
    String message = status.getMessage();
    if (message.length() == 0) {
        message = null;
    }
    switch (status.getSeverity()) {
    case IStatus.OK:
        setErrorMessage(null);
        setMessage(message);
        break;
    case IStatus.WARNING:
        setErrorMessage(null);
        setMessage(message, IMessageProvider.WARNING);
        break;
    case IStatus.INFO:
        setErrorMessage(null);
        setMessage(message, IMessageProvider.INFORMATION);
        break;
    default:
        setErrorMessage(null);
        setMessage(message, IMessageProvider.ERROR);
        break;
    }
}

From source file:org.eclipse.mylyn.internal.github.ui.gist.GistRepositorySettingsPage.java

License:Open Source License

/**
 * @see org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage#canValidate()
 *//*from w  ww.j  av a 2  s .  c  o m*/
public boolean canValidate() {
    return isPageComplete() && (getMessage() == null || getMessageType() != IMessageProvider.ERROR);
}

From source file:org.eclipse.mylyn.internal.github.ui.issue.IssueTaskEditorPage.java

License:Open Source License

@Override
public void doSubmit() {
    if (!checkCanSubmit(IMessageProvider.ERROR))
        return;
    super.doSubmit();
}

From source file:org.eclipse.mylyn.internal.jira.ui.wizards.JiraNamedFilterPage.java

License:Open Source License

/**
 * Called by the download job when the filters have been downloaded
 * /*w w w . j  av a  2  s.  c o  m*/
 * @param status
 */
public void displayFilters(NamedFilter[] filters, IStatus status) {
    if (!status.isOK()) {
        setMessage(status.getMessage(), IMessageProvider.ERROR);
    }

    filterList.removeAll();

    if (filters.length == 0) {
        filterList.setEnabled(false);
        filterList.add(Messages.JiraNamedFilterPage_No_filters_found);
        filterList.deselectAll();

        if (status.isOK()) {
            setMessage(Messages.JiraNamedFilterPage_No_saved_filters_found, IMessageProvider.WARNING);
        }
        setPageComplete(false);
        return;
    }

    int n = 0;
    for (int i = 0; i < filters.length; i++) {
        filterList.add(filters[i].getName());
        if (filters[i].getId().equals(workingCopy.getId())) {
            n = i;
        }
    }

    filterList.select(n);
    filterList.showSelection();
    filterList.setEnabled(buttonSaved.getSelection());
    setPageComplete(status.isOK());
}

From source file:org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractRepositoryTaskEditor.java

License:Open Source License

private void previewWiki(final Browser browser, String sourceText) {
    final class PreviewWikiJob extends Job {
        private final String sourceText;

        private String htmlText;

        private IStatus jobStatus;

        public PreviewWikiJob(String sourceText) {
            super("Formatting Wiki Text");

            if (sourceText == null) {
                throw new IllegalArgumentException("source text must not be null");
            }/*from w  w  w .  j  a  v a 2s .  c o m*/

            this.sourceText = sourceText;
        }

        @Override
        protected IStatus run(IProgressMonitor monitor) {
            AbstractRenderingEngine htmlRenderingEngine = getRenderingEngine();
            if (htmlRenderingEngine == null) {
                jobStatus = new RepositoryStatus(repository, IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
                        RepositoryStatus.ERROR_INTERNAL, "The repository does not support HTML preview.");
                return Status.OK_STATUS;
            }

            jobStatus = Status.OK_STATUS;
            try {
                htmlText = htmlRenderingEngine.renderAsHtml(repository, sourceText, monitor);
            } catch (CoreException e) {
                jobStatus = e.getStatus();
            }
            return Status.OK_STATUS;
        }

        public String getHtmlText() {
            return htmlText;
        }

        public IStatus getStatus() {
            return jobStatus;
        }

    }

    final PreviewWikiJob job = new PreviewWikiJob(sourceText);

    job.addJobChangeListener(new JobChangeAdapter() {

        @Override
        public void done(final IJobChangeEvent event) {
            if (!form.isDisposed()) {
                if (job.getStatus().isOK()) {
                    getPartControl().getDisplay().asyncExec(new Runnable() {
                        public void run() {
                            AbstractRepositoryTaskEditor.this.setText(browser, job.getHtmlText());
                            parentEditor.setMessage(null, IMessageProvider.NONE);
                        }
                    });
                } else {
                    getPartControl().getDisplay().asyncExec(new Runnable() {
                        public void run() {
                            parentEditor.setMessage(job.getStatus().getMessage(), IMessageProvider.ERROR);
                        }
                    });
                }
            }
            super.done(event);
        }
    });

    job.setUser(true);
    job.schedule();
}

From source file:org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractRepositoryTaskEditor.java

License:Open Source License

protected IStatus handleSubmitError(final CoreException exception) {
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        public void run() {
            if (form != null && !form.isDisposed()) {
                if (exception.getStatus().getCode() == RepositoryStatus.ERROR_IO) {
                    parentEditor.setMessage(ERROR_NOCONNECTIVITY, IMessageProvider.ERROR);
                    StatusHandler.log(exception.getStatus());
                } else if (exception.getStatus().getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) {
                    TasksUiInternal.displayStatus("Comment required", exception.getStatus());
                    if (!getManagedForm().getForm().isDisposed() && newCommentTextViewer != null
                            && !newCommentTextViewer.getControl().isDisposed()) {
                        newCommentTextViewer.getControl().setFocus();
                    }//from w  w  w . jav a  2 s .co m
                } else if (exception.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
                    if (TasksUiUtil.openEditRepositoryWizard(repository) == MessageDialog.OK) {
                        submitToRepository();
                        return;
                    }
                } else {
                    TasksUiInternal.displayStatus("Submit failed", exception.getStatus());
                }
                setGlobalBusy(false);
            }
        }

    });
    return Status.OK_STATUS;
}

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  ww  w . j a va  2s .c om
    setMessage(validity.getMessage(), messageError);
}

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

License:Open Source License

private void updateMessage() {
    if (!reviewConsumer.getStatus().isOK()) {
        getTaskEditor().setMessage(/*from   ww  w  . j av a 2s .  c o  m*/
                org.eclipse.mylyn.internal.tasks.ui.editors.Messages.AbstractTaskEditorPage_Error_opening_task,
                IMessageProvider.ERROR, new HyperlinkAdapter() {
                    @Override
                    public void linkActivated(HyperlinkEvent event) {
                        TasksUiInternal.displayStatus(
                                org.eclipse.mylyn.internal.tasks.ui.editors.Messages.AbstractTaskEditorPage_Open_failed,
                                reviewConsumer.getStatus());
                    }
                });
    }
}