Search in sources :

Example 1 with SpecfileVisitor

use of org.eclipse.linuxtools.internal.rpm.core.SpecfileVisitor in project linuxtools by eclipse.

the class RPMProject method getSpecFile.

/**
 * Returns the .spec file of this project.
 *
 * @return The .spec file or null if one is not found.
 */
public IResource getSpecFile() {
    IContainer specsFolder = getConfiguration().getSpecsFolder();
    IResource file = null;
    SpecfileVisitor specVisitor = new SpecfileVisitor();
    try {
        specsFolder.accept(specVisitor);
        List<IResource> installedSpecs = specVisitor.getSpecFiles();
        if (installedSpecs.size() > 0) {
            file = installedSpecs.get(0);
        }
    } catch (CoreException e) {
    // ignore, failed to find .spec file.
    }
    return file;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) SpecfileVisitor(org.eclipse.linuxtools.internal.rpm.core.SpecfileVisitor) IContainer(org.eclipse.core.resources.IContainer) IResource(org.eclipse.core.resources.IResource)

Aggregations

IContainer (org.eclipse.core.resources.IContainer)1 IResource (org.eclipse.core.resources.IResource)1 CoreException (org.eclipse.core.runtime.CoreException)1 SpecfileVisitor (org.eclipse.linuxtools.internal.rpm.core.SpecfileVisitor)1