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.dltk.freemarker.internal.ui.editor.validation.AbstractControlValidator.java

License:Open Source License

/**
 * @param status//  w  w w  .j a  va  2  s.c om
 * @return
 */
public static int getMessageType(IStatus status) {
    int severity = status.getSeverity();
    // Translate severity to the equivalent message provider type
    if (severity == IStatus.OK) {
        return IMessageProvider.NONE;
    } else if (severity == IStatus.ERROR) {
        return IMessageProvider.ERROR;
    } else if (severity == IStatus.WARNING) {
        return IMessageProvider.WARNING;
    } else if (severity == IStatus.INFO) {
        return IMessageProvider.INFORMATION;
    }
    // IStatus.CANCEL
    return IMessageProvider.NONE;
}

From source file:org.eclipse.dltk.mod.ui.wizards.ProjectWizardFirstPage.java

License:Open Source License

/**
 * @param path// w  w w . j  a  va 2 s  .c o m
 * @return
 */
public static Object[] validateNonExistingProjectPath(IPath path) {
    if (!path.toFile().exists()) {
        return new Object[] { NewWizardMessages.ScriptProjectWizardFirstPage_Unexist_Location_message,
                new Integer(IMessageProvider.WARNING) };

    }
    return null;
}

From source file:org.eclipse.e4.internal.tools.wizards.project.PluginContentPage.java

License:Open Source License

@Override
protected void validatePage() {
    String errorMessage = validateProperties();
    if (errorMessage == null && fGenerateActivator.getSelection()) {
        IStatus status = JavaConventions.validateJavaTypeName(fClassText.getText().trim(),
                PDEJavaHelper.getJavaSourceLevel(null), PDEJavaHelper.getJavaComplianceLevel(null));
        if (status.getSeverity() == IStatus.ERROR) {
            errorMessage = status.getMessage();
        } else if (status.getSeverity() == IStatus.WARNING) {
            setMessage(status.getMessage(), IMessageProvider.WARNING);
        }//  w  w w.  ja  va  2  s  . c  o m
    }
    if (errorMessage == null) {
        String eeid = fEEChoice.getText();
        if (fEEChoice.isEnabled()) {
            IExecutionEnvironment ee = VMUtil.getExecutionEnvironment(eeid);
            if (ee != null && ee.getCompatibleVMs().length == 0) {
                errorMessage = PDEUIMessages.NewProjectCreationPage_invalidEE;
            }
        }
    }
    setErrorMessage(errorMessage);
    setPageComplete(errorMessage == null);
}

From source file:org.eclipse.e4.tools.ui.designer.dialogs.ElementInitializeDialog.java

License:Open Source License

/**
 * In fact, severity of status is different from the type of messages.
 *//*  w ww  .  j a  va 2  s  .c om*/
protected void setMessage(IStatus status) {
    if (status == null || status.isOK()) {
        setMessage((String) null);
    } else {
        int severity = status.getSeverity();
        String message = status.getMessage();
        switch (severity) {
        case IStatus.ERROR:
            setMessage(message, IMessageProvider.ERROR);
            break;
        case IStatus.INFO:
            setMessage(message, IMessageProvider.INFORMATION);
            break;
        case IStatus.WARNING:
            setMessage(message, IMessageProvider.WARNING);
            break;
        default:
            setMessage((String) null);
            break;
        }
    }
    Button button = getButton(IDialogConstants.OK_ID);
    if (button != null && !button.isDisposed()) {
        button.setEnabled(status == null || status.getSeverity() != IStatus.ERROR);
    }
}

From source file:org.eclipse.ease.modules.modeling.ui.views.ModelRefactoringView.java

License:Open Source License

protected void handleGoto() {
    String theText = text.getText();
    frmNavigation.setMessage(null);/*from  w  w w  .  j a va 2 s . c om*/
    ISelection selec = comboViewer.getSelection();
    if (selec instanceof IStructuredSelection) {
        IStructuredSelection structured = (IStructuredSelection) selec;
        if (structured.getFirstElement() instanceof IMatcher) {
            IMatcher matcher = (IMatcher) structured.getFirstElement();
            Collection<EObject> toUse;
            try {
                toUse = matcher.getElements(theText, getCurrentEditor());
                toUse.remove(null);
                if (toUse.isEmpty()) {
                    if (frmNavigation.getMessage() == null) {
                        frmNavigation.setMessage(Messages.ModelRefactoringView_NO_ELEMENTS,
                                IMessageProvider.WARNING);
                    }
                }
                tableViewer_Search.setInput(toUse);
                frmNavigation.setMessage(toUse.size() + Messages.ModelRefactoringView_NB_ELEMENTS_FOUND,
                        IMessageProvider.INFORMATION);
            } catch (MatcherException e) {
                frmNavigation.setMessage(e.getMessage(), IMessageProvider.ERROR);
                e.printStackTrace();
            }

        }
    }

}

From source file:org.eclipse.edt.ide.ui.internal.property.pages.EGLProjectBuildPathPropertyPage.java

License:Open Source License

public void updateEGLPathStatus() {
    fEGLPathStatus.setOK();/*from   www. j  ava 2s. c  om*/

    List elements = fClassPathList.getElements();

    PPListElement entryMissing = null;
    int nEntriesMissing = 0;
    IEGLPathEntry[] entries = new IEGLPathEntry[elements.size()];

    for (int i = elements.size() - 1; i >= 0; i--) {
        PPListElement currElement = (PPListElement) elements.get(i);
        boolean isChecked = fClassPathList.isChecked(currElement);
        if (currElement.getEntryKind() == IEGLPathEntry.CPE_SOURCE) {
            if (!isChecked) {
                fClassPathList.setCheckedWithoutUpdate(currElement, true);
            }
        } else if (EGLSystemPathContaierInitializer
                .isValidEGLSystemPathContainerPath(currElement.getEGLPathEntry().getPath())) {
            if (isChecked) {
                fClassPathList.setCheckedWithoutUpdate(currElement, false);
            }
        } else {
            currElement.setExported(isChecked);
        }

        entries[i] = currElement.getEGLPathEntry();
        if (currElement.isMissing()) {
            nEntriesMissing++;
            if (entryMissing == null) {
                entryMissing = currElement;
            }
        }
    }

    if (nEntriesMissing > 0) {
        if (nEntriesMissing == 1) {
            fEGLPathStatus.setWarning(NewWizardMessages.bind(
                    NewWizardMessages.BuildPathsBlockWarningEntryMissing, entryMissing.getPath().toString())); //$NON-NLS-1$
        } else {
            fEGLPathStatus.setWarning(NewWizardMessages.bind(
                    NewWizardMessages.BuildPathsBlockWarningEntriesMissing, String.valueOf(nEntriesMissing))); //$NON-NLS-1$
        }
    }

    if (nEntriesMissing > 0) {
        if (nEntriesMissing == 1) {
            fEGLPathStatus.setWarning(NewWizardMessages.bind(
                    NewWizardMessages.BuildPathsBlockWarningEntryMissing, entryMissing.getPath().toString())); //$NON-NLS-1$
            setMessage(NewWizardMessages.bind(NewWizardMessages.BuildPathsBlockWarningEntryMissing,
                    entryMissing.getPath().toString()), IMessageProvider.WARNING);

        } else {
            fEGLPathStatus.setWarning(NewWizardMessages.bind(
                    NewWizardMessages.BuildPathsBlockWarningEntriesMissing, String.valueOf(nEntriesMissing))); //$NON-NLS-1$
            setMessage(NewWizardMessages.bind(NewWizardMessages.BuildPathsBlockWarningEntryMissing,
                    String.valueOf(nEntriesMissing)), IMessageProvider.WARNING);
        }
        setErrorMessage(null);
    }

    /*      if (fCurrJProject.hasClasspathCycle(entries)) {
             fClassPathStatus.setWarning(NewWizardMessages.getString("BuildPathsBlock.warning.CycleInClassPath")); //$NON-NLS-1$
          }
    */
    updateBuildPathStatus();

}

From source file:org.eclipse.egit.ui.internal.clone.SourceBranchPage.java

License:Open Source License

private void checkForEmptyRepo() {
    if (isSourceRepoEmpty()) {
        setErrorMessage(null);//from w w w  .  j  a  v a2  s  . c  o  m
        setMessage(UIText.SourceBranchPage_repoEmpty, IMessageProvider.WARNING);
        setPageComplete(true);
    }
}

From source file:org.eclipse.egit.ui.internal.dialogs.CommitMessageComponent.java

License:Open Source License

/**
 * Get the status of whether the commit operation should be enabled or
 * disabled.// ww w. j av  a  2 s .  c om
 * <p>
 * This method checks the current state of the widgets and must always be
 * called from the UI-thread.
 * <p>
 * The returned status includes a message and type denoting why committing
 * cannot be completed.
 *
 * @return non-null commit status
 */
public CommitStatus getStatus() {
    if (!commitAllowed)
        return new CommitStatus(cannotCommitMessage, IMessageProvider.ERROR);

    String authorValue = authorText.getText();
    if (authorValue.length() == 0 || RawParseUtils.parsePersonIdent(authorValue) == null)
        return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidAuthor, IMessageProvider.ERROR);

    String committerValue = committerText.getText();
    if (committerValue.length() == 0 || RawParseUtils.parsePersonIdent(committerValue) == null) {
        return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidCommitter, IMessageProvider.ERROR);
    }

    if (amending && amendingCommitInRemoteBranch)
        return new CommitStatus(UIText.CommitMessageComponent_AmendingCommitInRemoteBranch,
                IMessageProvider.WARNING);

    return CommitStatus.OK;
}

From source file:org.eclipse.egit.ui.internal.fetch.FetchDestinationPage.java

License:Open Source License

private void checkPage() {
    setMessage(null, IMessageProvider.WARNING);
    setErrorMessage(null);//  ww  w .  jav a  2  s  . co m
    setMessage(UIText.FetchDestinationPage_PageMessage);
    if (destinationText.getText().length() == 0) {
        setPageComplete(false);
        return;
    }
    boolean found = false;
    for (Ref ref : getRemoteRefs()) {
        if (ref.getName().equals(destinationText.getText()))
            found = true;
    }
    if (!found)
        setMessage(
                NLS.bind(UIText.FetchDestinationPage_TrackingBranchNotFoundMessage, destinationText.getText()),
                IMessageProvider.WARNING);
    setPageComplete(true);
}

From source file:org.eclipse.egit.ui.internal.fetch.FetchSourcePage.java

License:Open Source License

private void checkPage() {
    setMessage(null, IMessageProvider.WARNING);
    setErrorMessage(null);//from  ww  w.  j a v a2s .  co  m
    setMessage(UIText.FetchSourcePage_PageMessage);
    if (sourceText.getText().length() == 0) {
        setPageComplete(false);
        return;
    }
    boolean found = false;
    for (Ref ref : getRemoteRefs()) {
        if (ref.getName().equals(sourceText.getText()))
            found = true;
    }
    if (!found)
        setMessage(NLS.bind(UIText.FetchSourcePage_RefNotFoundMessage, sourceText.getText()),
                IMessageProvider.WARNING);
    setPageComplete(true);
}