|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.project.ant; import java.io.File; import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.Project; import org.netbeans.api.project.ant.AntArtifact; import org.netbeans.spi.project.ant.AntArtifactProvider; import org.netbeans.spi.project.ant.AntArtifactQueryImplementation; /** * Standard implementation of {@link AntArtifactQueryImplementation} which uses * {@link AntArtifactProvider}. * @author Jesse Glick */ public class StandardAntArtifactQueryImpl implements AntArtifactQueryImplementation { /** Default constructor for lookup. */ public StandardAntArtifactQueryImpl() {} public AntArtifact findArtifact(File file) { Project p = FileOwnerQuery.getOwner(file.toURI()); if (p == null) { return null; } AntArtifactProvider prov = (AntArtifactProvider)p.getLookup().lookup(AntArtifactProvider.class); if (prov == null) { return null; } AntArtifact[] artifacts = prov.getBuildArtifacts(); for (int i = 0; i < artifacts.length; i++) { File testFile = new File(artifacts[i].getScriptLocation().toURI().resolve(artifacts[i].getArtifactLocation())); if (file.equals(testFile)) { return artifacts[i]; } } return null; } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.