Example usage for org.eclipse.jdt.internal.core.util Messages build_foundHeader

List of usage examples for org.eclipse.jdt.internal.core.util Messages build_foundHeader

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.util Messages build_foundHeader.

Prototype

String build_foundHeader

To view the source code for org.eclipse.jdt.internal.core.util Messages build_foundHeader.

Click Source Link

Usage

From source file:net.sf.j2s.core.builder.BuildNotifier.java

License:Open Source License

/**
 * Returns a string describing the problems.
 *//*from w  w w . j  a  va2 s . c  o  m*/
protected String problemsMessage() {
    int numNew = this.newErrorCount + this.newWarningCount;
    int numFixed = this.fixedErrorCount + this.fixedWarningCount;
    if (numNew == 0 && numFixed == 0)
        return ""; //$NON-NLS-1$

    boolean displayBoth = numNew > 0 && numFixed > 0;
    StringBuffer buffer = new StringBuffer();
    buffer.append('(');
    if (numNew > 0) {
        // (Found x errors + y warnings)
        buffer.append(Messages.build_foundHeader);
        buffer.append(' ');
        if (displayBoth || this.newErrorCount > 0) {
            if (this.newErrorCount == 1)
                buffer.append(Messages.build_oneError);
            else
                buffer.append(Messages.bind(Messages.build_multipleErrors, String.valueOf(this.newErrorCount)));
            if (displayBoth || this.newWarningCount > 0)
                buffer.append(" + "); //$NON-NLS-1$
        }
        if (displayBoth || this.newWarningCount > 0) {
            if (this.newWarningCount == 1)
                buffer.append(Messages.build_oneWarning);
            else
                buffer.append(
                        Messages.bind(Messages.build_multipleWarnings, String.valueOf(this.newWarningCount)));
        }
        if (numFixed > 0)
            buffer.append(", "); //$NON-NLS-1$
    }
    if (numFixed > 0) {
        // (Fixed x errors + y warnings) or (Found x errors + y warnings, Fixed x + y)
        buffer.append(Messages.build_fixedHeader);
        buffer.append(' ');
        if (displayBoth) {
            buffer.append(String.valueOf(this.fixedErrorCount));
            buffer.append(" + "); //$NON-NLS-1$
            buffer.append(String.valueOf(this.fixedWarningCount));
        } else {
            if (this.fixedErrorCount > 0) {
                if (this.fixedErrorCount == 1)
                    buffer.append(Messages.build_oneError);
                else
                    buffer.append(
                            Messages.bind(Messages.build_multipleErrors, String.valueOf(this.fixedErrorCount)));
                if (this.fixedWarningCount > 0)
                    buffer.append(" + "); //$NON-NLS-1$
            }
            if (this.fixedWarningCount > 0) {
                if (this.fixedWarningCount == 1)
                    buffer.append(Messages.build_oneWarning);
                else
                    buffer.append(Messages.bind(Messages.build_multipleWarnings,
                            String.valueOf(this.fixedWarningCount)));
            }
        }
    }
    buffer.append(')');
    return buffer.toString();
}