Example usage for org.eclipse.jdt.core.compiler IProblem ImportRelated

List of usage examples for org.eclipse.jdt.core.compiler IProblem ImportRelated

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.compiler IProblem ImportRelated.

Prototype

int ImportRelated

To view the source code for org.eclipse.jdt.core.compiler IProblem ImportRelated.

Click Source Link

Usage

From source file:astview.ProblemNode.java

License:Open Source License

private String getErrorLabel() {
    int id = fProblem.getID();
    StringBuffer buf = new StringBuffer();

    if ((id & IProblem.TypeRelated) != 0) {
        buf.append("TypeRelated + "); //$NON-NLS-1$
    }//from  w ww.  j  ava  2s . c om
    if ((id & IProblem.FieldRelated) != 0) {
        buf.append("FieldRelated + "); //$NON-NLS-1$
    }
    if ((id & IProblem.ConstructorRelated) != 0) {
        buf.append("ConstructorRelated + "); //$NON-NLS-1$
    }
    if ((id & IProblem.MethodRelated) != 0) {
        buf.append("MethodRelated + "); //$NON-NLS-1$
    }
    if ((id & IProblem.ImportRelated) != 0) {
        buf.append("ImportRelated + "); //$NON-NLS-1$
    }
    if ((id & IProblem.Internal) != 0) {
        buf.append("Internal + "); //$NON-NLS-1$
    }
    if ((id & IProblem.Syntax) != 0) {
        buf.append("Syntax + "); //$NON-NLS-1$
    }
    if ((id & IProblem.Javadoc) != 0) {
        buf.append("Javadoc + "); //$NON-NLS-1$
    }
    buf.append(id & IProblem.IgnoreCategoriesMask);

    buf.append(" = 0x").append(Integer.toHexString(id)).append(" = ").append(id);

    return buf.toString();
}

From source file:com.google.devtools.j2cpp.J2ObjC.java

License:Open Source License

private static List<IProblem> getCompilationErrors(CompilationUnit unit) {
    List<IProblem> errors = Lists.newArrayList();
    for (IProblem problem : unit.getProblems()) {
        if (problem.isError()) {
            if (((problem.getID() & IProblem.ImportRelated) > 0) && Options.ignoreMissingImports()) {
                continue;
            } else {
                errors.add(problem);//from w  w w.  jav  a2s .c o m
            }
        }
    }
    return errors;
}

From source file:fromastview.ProblemNode.java

License:Open Source License

private String getErrorLabel() {
    int id = fProblem.getID();
    StringBuffer buf = new StringBuffer();

    if ((id & IProblem.TypeRelated) != 0) {
        buf.append("TypeRelated + ");
    }/*from www . jav  a  2 s  . c om*/
    if ((id & IProblem.FieldRelated) != 0) {
        buf.append("FieldRelated + ");
    }
    if ((id & IProblem.ConstructorRelated) != 0) {
        buf.append("ConstructorRelated + ");
    }
    if ((id & IProblem.MethodRelated) != 0) {
        buf.append("MethodRelated + ");
    }
    if ((id & IProblem.ImportRelated) != 0) {
        buf.append("ImportRelated + ");
    }
    if ((id & IProblem.Internal) != 0) {
        buf.append("Internal + ");
    }
    if ((id & IProblem.Syntax) != 0) {
        buf.append("Syntax + ");
    }
    if ((id & IProblem.Javadoc) != 0) {
        buf.append("Javadoc + ");
    }
    buf.append(id & IProblem.IgnoreCategoriesMask);

    buf.append(" = 0x").append(Integer.toHexString(id)).append(" = ").append(id);

    return buf.toString();
}

From source file:org.jboss.tools.arquillian.core.internal.compiler.ArquillianCompilationParticipant.java

License:Open Source License

private void storeProblem(CategorizedProblem problem, IFile resource) throws CoreException {
    if ((problem.getID() & IProblem.TypeRelated) == 0 && (problem.getID() & IProblem.ImportRelated) == 0) {
        // ignore
        return;//from   w  ww . j av a  2s  .co  m
    }
    String typePreference = ArquillianUtility
            .getPreference(ArquillianConstants.TYPE_IS_NOT_INCLUDED_IN_ANY_DEPLOYMENT, resource.getProject());
    String importPreference = ArquillianUtility
            .getPreference(ArquillianConstants.IMPORT_IS_NOT_INCLUDED_IN_ANY_DEPLOYMENT, resource.getProject());

    if (JavaCore.IGNORE.equals(typePreference) && JavaCore.IGNORE.equals(importPreference)) {
        return;
    }
    int id = problem.getID();
    if (id != IProblem.IsClassPathCorrect && id != IProblem.UndefinedType && id != IProblem.ImportNotFound) {
        // ignore
        return;
    }

    IMarker marker = resource.createMarker(ArquillianConstants.MARKER_CLASS_ID);
    String[] attributeNames = AbstractImageBuilder.JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES;
    int standardLength = attributeNames.length;
    String[] allNames = attributeNames;
    int managedLength = 1;
    String[] extraAttributeNames = problem.getExtraMarkerAttributeNames();
    int extraLength = extraAttributeNames == null ? 0 : extraAttributeNames.length;
    if (managedLength > 0 || extraLength > 0) {
        allNames = new String[standardLength + managedLength + extraLength + 1];
        System.arraycopy(attributeNames, 0, allNames, 0, standardLength);
        if (managedLength > 0)
            allNames[standardLength] = IMarker.SOURCE_ID;
        System.arraycopy(extraAttributeNames, 0, allNames, standardLength + managedLength, extraLength);
    }

    allNames[allNames.length - 1] = ArquillianConstants.MARKER_CLASS_NAME;

    Object[] allValues = new Object[allNames.length];
    // standard attributes
    int index = 0;
    String[] arguments = problem.getArguments();
    String message = "Arquillian: " + problem.getMessage();
    Integer severity = null;
    if (arguments != null && arguments.length > 0) {
        if (id == IProblem.IsClassPathCorrect) {
            // Pb(324) The type org.jboss.tools.examples.service.MemberRegistration cannot be resolved. It is indirectly referenced from required .class files
            message = "Arquillian: The " + arguments[0]
                    + " type is not  included in any deployment. It is indirectly referenced from required .class files";
            severity = ArquillianUtility.getSeverity(typePreference);
        } else if (id == IProblem.UndefinedType) {
            // Pb(2) MemberRegistration cannot be resolved to a type
            message = "Arquillian: The " + arguments[0] + " type is not  included in any deployment.";
            severity = ArquillianUtility.getSeverity(typePreference);
        } else if (id == IProblem.ImportNotFound) {
            // Pb(390) The import org.jboss.tools.examples.service.MemberRegistration cannot be resolved
            message = "Arquillian: The " + arguments[0] + " import is not  included in any deployment.";
            severity = ArquillianUtility.getSeverity(importPreference);
        }
        allValues[allNames.length - 1] = arguments[0];
    }
    if (severity == null) {
        return;
    }
    allValues[index++] = message; // message
    allValues[index++] = severity;

    allValues[index++] = new Integer(problem.getID()); // ID
    allValues[index++] = new Integer(problem.getSourceStart()); // start
    int end = problem.getSourceEnd();
    allValues[index++] = new Integer(end > 0 ? end + 1 : end); // end
    allValues[index++] = new Integer(problem.getSourceLineNumber()); // line
    allValues[index++] = Util.getProblemArgumentsForMarker(problem.getArguments()); // arguments
    allValues[index++] = new Integer(problem.getCategoryID()); // category ID

    allValues[index++] = ArquillianConstants.SOURCE_ID;

    // optional extra attributes
    if (extraLength > 0)
        System.arraycopy(problem.getExtraMarkerAttributeValues(), 0, allValues, index, extraLength);

    marker.setAttributes(allNames, allValues);
}