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.commons.ui.CommonUiUtil.java

License:Open Source License

public static void setMessage(DialogPage page, IStatus status) {
    String message = status.getMessage();
    switch (status.getSeverity()) {
    case IStatus.OK:
        page.setMessage(null, IMessageProvider.NONE);
        break;//from   w ww.j  ava 2 s . c  om
    case IStatus.INFO:
        page.setMessage(message, IMessageProvider.INFORMATION);
        break;
    case IStatus.WARNING:
        page.setMessage(message, IMessageProvider.WARNING);
        break;
    default:
        page.setMessage(message, IMessageProvider.ERROR);
        break;
    }
}

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.
 * //  ww  w . j a  v  a  2  s.co  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.builds.ui.editor.ChangesPart.java

License:Open Source License

private void open(IChangeArtifact changeArtifact) throws CoreException {
    final IResource resource = ScmCore.findResource(changeArtifact.getFile());
    if (resource == null) {
        getMessageManager().addMessage(ChangesPart.class.getName(),
                "The selected file is not available in the workspace", null, IMessageProvider.WARNING);
        return;/*from w  w  w  .j a v  a  2 s .c om*/
    }
    final ScmConnector connector = ScmCore.getConnector(resource);
    if (connector == null) {
        getMessageManager().addMessage(ChangesPart.class.getName(),
                "No extension available to open the selected file", null, IMessageProvider.WARNING);
        return;
    }

    final String prevRevision = changeArtifact.getPrevRevision();
    final String revision = (changeArtifact.getRevision() != null) ? changeArtifact.getRevision()
            : ((IChange) ((ChangeArtifact) changeArtifact).eContainer()).getRevision();
    if (revision == null) {
        getMessageManager().addMessage(ChangesPart.class.getName(),
                "Could not determine change revisions for the selected file", null, IMessageProvider.WARNING);
    }

    try {
        final AtomicReference<IFileRevision> left = new AtomicReference<IFileRevision>();
        final AtomicReference<IFileRevision> right = new AtomicReference<IFileRevision>();
        PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    ScmArtifact rightArtifact = connector.getArtifact(resource, revision);
                    right.set(rightArtifact.getFileRevision(monitor));

                    if (prevRevision != null) {
                        ScmArtifact leftArtifact = connector.getArtifact(resource, prevRevision);
                        left.set(leftArtifact.getFileRevision(monitor));
                    }
                    if (left.get() == null) {
                        try {
                            IFileRevision[] contributors = rightArtifact.getContributors(monitor);
                            if (contributors != null && contributors.length > 0) {
                                left.set(contributors[0]);
                            }
                        } catch (UnsupportedOperationException e) {
                            // ignore
                        }
                    }
                } catch (CoreException e) {
                    throw new InvocationTargetException(e);
                }
            }
        });
        if (right.get() != null) {
            getMessageManager().removeMessage(ChangesPart.class.getName());

            ScmUi.openCompareEditor(getPage().getSite().getPage(), left.get(), right.get());
        } else {
            getMessageManager().addMessage(ChangesPart.class.getName(),
                    "Could not determine change revisions for the selected file", null,
                    IMessageProvider.WARNING);
        }
    } catch (InvocationTargetException e) {
        StatusManager.getManager().handle(
                new Status(IStatus.ERROR, BuildsUiPlugin.ID_PLUGIN, "Unexpected error", e),
                StatusManager.SHOW | StatusManager.LOG);
    } catch (InterruptedException e) {
        // ignore
    }

}

From source file:org.eclipse.mylyn.internal.gerrit.ui.editor.PatchSetSection.java

License:Open Source License

private void doOpen(IReviewItemSet items, IFileItem item) {
    if (item.getBase() == null || item.getTarget() == null) {
        getTaskEditorPage().getEditor().setMessage("The selected file is not available, yet",
                IMessageProvider.WARNING);
        return;//from  ww  w  .j a v a  2 s.c om
    }

    GerritReviewBehavior behavior = new GerritReviewBehavior(getTask());
    CompareConfiguration configuration = new CompareConfiguration();
    CompareUI.openCompareEditor(new FileItemCompareEditorInput(configuration, item, behavior));
}

From source file:org.eclipse.mylyn.internal.gerrit.ui.factories.OpenFileUiFactory.java

License:Open Source License

@Override
public void execute() {
    //(The action is always available so isExecutable is never called from framework.)
    if (!isExecutable()) {
        handleExecutionStateError();/*from  ww  w. j a v  a 2  s.c  om*/
        return;
    }

    if (item.getBase() == null || item.getTarget() == null) {
        getEditor().setMessage(Messages.OpenFileUiFactory_File_not_available, IMessageProvider.WARNING);
        return;
    }

    GerritReviewBehavior behavior = new GerritReviewBehavior(getTask(), resolveGitRepository());
    CompareConfiguration configuration = new CompareConfiguration();
    GerritCompareUi.openFileComparisonEditor(configuration, item, behavior);
}

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
 * //from  ww w  . j  a v a2  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 updateHeaderControls() {
    if (taskData == null) {
        parentEditor.setMessage(/*from w w  w .  j  av a 2 s  .  co  m*/
                "Task data not available. Press synchronize button (right) to retrieve latest data.",
                IMessageProvider.WARNING, new HyperlinkAdapter() {
                    @Override
                    public void linkActivated(HyperlinkEvent e) {
                        if (synchronizeEditorAction != null) {
                            synchronizeEditorAction.run();
                        }
                    }
                });
    }
    getParentEditor().updateHeaderToolBar();
}

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

License:Open Source License

/**
 * @param naw//from  w w w. j  a  v a 2 s.c  o m
 *            wizard to attach dialog to.
 * @param message
 *            error to display or none if <code>null</code>
 */
private void openDialog(NewAttachmentWizard naw, String message) {
    editor.setGlobalBusy(true);
    NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(control.getShell(), naw, true);
    naw.setDialog(dialog);
    dialog.create();
    if (null != message) {
        dialog.setMessage(message, IMessageProvider.WARNING);
    }
    int result = dialog.open();
    if (result != Window.OK) {
        editor.setGlobalBusy(false);
    }
}

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

License:Open Source License

protected void attachFirstFile(String[] files) {
    if (files != null && files.length > 0) {
        File file = new File(files[0]);
        NewAttachmentWizardDialog dialog = EditorUtil.openNewAttachmentWizard(page, null,
                new FileTaskAttachmentSource(file));
        if (files.length > 1) {
            dialog.setMessage(//from  w  w w  .j a v  a  2s  .  c  om
                    Messages.TaskAttachmentDropListener_Note_that_only_the_first_file_dragged_will_be_attached,
                    IMessageProvider.WARNING);
        }
    }
}

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

License:Open Source License

public TaskDataImportWizardPage() {
    super("org.eclipse.mylyn.tasklist.importPage"); //$NON-NLS-1$
    setPageComplete(false);/*from  w  w  w . ja  v a2  s.  com*/
    setMessage(Messages.TaskDataImportWizardPage_Importing_overwrites_current_tasks_and_repositories,
            IMessageProvider.WARNING);
    setImageDescriptor(CommonImages.BANNER_IMPORT);
    setTitle(Messages.TaskDataImportWizardPage_Restore_tasks_from_history);
}