Search in sources :

Example 1 with BundleActivatorError

use of aQute.bnd.osgi.Verifier.BundleActivatorError in project bndtools by bndtools.

the class BundleActivatorErrorHandler method generateMarkerData.

@Override
public List<MarkerData> generateMarkerData(IProject project, Project model, Location location) throws Exception {
    List<MarkerData> result = new ArrayList<MarkerData>();
    BundleActivatorError baError = (BundleActivatorError) location.details;
    IJavaProject javaProject = JavaCore.create(project);
    Map<String, Object> attribs = createMessageMarkerAttributes(baError, location.message);
    // Eclipse line numbers are 1 indexed
    attribs.put(IMarker.LINE_NUMBER, location.line + 1);
    // Add a marker to the bnd file on the BundleActivator line
    result.add(new MarkerData(getDefaultResource(project), attribs, false));
    MarkerData md;
    switch(baError.errorType) {
        case NO_SUITABLE_CONSTRUCTOR:
            md = createMethodMarkerData(javaProject, baError.activatorClassName, "<init>", "()V", createMessageMarkerAttributes(baError, location.message), false);
            if (md != null) {
                result.add(md);
                break;
            }
        // $FALL-THROUGH$
        case IS_INTERFACE:
        case IS_ABSTRACT:
        case NOT_PUBLIC:
        case NOT_AN_ACTIVATOR:
        case DEFAULT_PACKAGE:
        case IS_IMPORTED:
            md = createTypeMarkerData(javaProject, baError.activatorClassName, createMessageMarkerAttributes(baError, location.message), false);
            if (md != null)
                result.add(md);
            break;
        case NOT_ACCESSIBLE:
        default:
            // No file to mark
            break;
    }
    return result;
}
Also used : MarkerData(org.bndtools.build.api.MarkerData) IJavaProject(org.eclipse.jdt.core.IJavaProject) BundleActivatorError(aQute.bnd.osgi.Verifier.BundleActivatorError) ArrayList(java.util.ArrayList)

Aggregations

BundleActivatorError (aQute.bnd.osgi.Verifier.BundleActivatorError)1 ArrayList (java.util.ArrayList)1 MarkerData (org.bndtools.build.api.MarkerData)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1