Package org.bndtools.builder

Source Code of org.bndtools.builder.BndtoolsMarkerResolutionGenerator

package org.bndtools.builder;

import java.util.List;

import org.bndtools.build.api.BuildErrorDetailsHandler;
import org.bndtools.build.api.BuildErrorDetailsHandlers;
import org.eclipse.core.resources.IMarker;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
import org.eclipse.ui.IMarkerResolutionGenerator2;

public class BndtoolsMarkerResolutionGenerator implements IMarkerResolutionGenerator, IMarkerResolutionGenerator2 {

    public boolean hasResolutions(IMarker marker) {
        boolean attrib = marker.getAttribute(BuildErrorDetailsHandler.PROP_HAS_RESOLUTIONS, false);
        return attrib;
    }

    public IMarkerResolution[] getResolutions(IMarker marker) {
        String type = marker.getAttribute("$bndType", (String) null);
        if (type == null)
            return new IMarkerResolution[0];

        BuildErrorDetailsHandler handler = BuildErrorDetailsHandlers.INSTANCE.findHandler(type);
        if (handler == null)
            return new IMarkerResolution[0];

        List<IMarkerResolution> resolutions = handler.getResolutions(marker);
        return resolutions != null ? resolutions.toArray(new IMarkerResolution[resolutions.size()]) : new IMarkerResolution[0];
    }

}
TOP

Related Classes of org.bndtools.builder.BndtoolsMarkerResolutionGenerator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.