Example usage for org.eclipse.jdt.core JavaCore COMPILER_TASK_PRIORITY_LOW

List of usage examples for org.eclipse.jdt.core JavaCore COMPILER_TASK_PRIORITY_LOW

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaCore COMPILER_TASK_PRIORITY_LOW.

Prototype

String COMPILER_TASK_PRIORITY_LOW

To view the source code for org.eclipse.jdt.core JavaCore COMPILER_TASK_PRIORITY_LOW.

Click Source Link

Document

Configurable option value for #COMPILER_TASK_PRIORITIES : .

Usage

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

License:Open Source License

protected void storeTasksFor(SourceFile sourceFile, CategorizedProblem[] tasks) throws CoreException {
    if (sourceFile == null || tasks == null || tasks.length == 0)
        return;/*from  ww  w  .  j a va  2s.c  o  m*/

    IResource resource = sourceFile.resource;
    for (int i = 0, l = tasks.length; i < l; i++) {
        CategorizedProblem task = tasks[i];
        if (task.getID() == IProblem.Task) {
            IMarker marker = resource.createMarker(IJavaModelMarker.TASK_MARKER);
            Integer priority = P_NORMAL;
            String compilerPriority = task.getArguments()[2];
            if (JavaCore.COMPILER_TASK_PRIORITY_HIGH.equals(compilerPriority))
                priority = P_HIGH;
            else if (JavaCore.COMPILER_TASK_PRIORITY_LOW.equals(compilerPriority))
                priority = P_LOW;

            String[] attributeNames = JAVA_TASK_MARKER_ATTRIBUTE_NAMES;
            int standardLength = attributeNames.length;
            String[] allNames = attributeNames;
            String[] extraAttributeNames = task.getExtraMarkerAttributeNames();
            int extraLength = extraAttributeNames == null ? 0 : extraAttributeNames.length;
            if (extraLength > 0) {
                allNames = new String[standardLength + extraLength];
                System.arraycopy(attributeNames, 0, allNames, 0, standardLength);
                System.arraycopy(extraAttributeNames, 0, allNames, standardLength, extraLength);
            }

            Object[] allValues = new Object[allNames.length];
            // standard attributes
            int index = 0;
            allValues[index++] = task.getMessage();
            allValues[index++] = priority;
            allValues[index++] = new Integer(task.getID());
            allValues[index++] = new Integer(task.getSourceStart());
            allValues[index++] = new Integer(task.getSourceEnd() + 1);
            allValues[index++] = new Integer(task.getSourceLineNumber());
            allValues[index++] = Boolean.FALSE;
            allValues[index++] = JavaBuilder.SOURCE_ID;
            // optional extra attributes
            if (extraLength > 0)
                System.arraycopy(task.getExtraMarkerAttributeValues(), 0, allValues, index, extraLength);

            marker.setAttributes(allNames, allValues);
        }
    }
}