本文整理汇总了Java中org.openide.filesystems.FileUtil.isArchiveArtifact方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.isArchiveArtifact方法的具体用法?Java FileUtil.isArchiveArtifact怎么用?Java FileUtil.isArchiveArtifact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileUtil
的用法示例。
在下文中一共展示了FileUtil.isArchiveArtifact方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterArtefact
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private static Collection<? extends URL> filterArtefact(
final boolean archive,
@NonNull final URL... urls) {
final Collection<URL> res = new ArrayList<>(urls.length);
for (URL url : urls) {
if ((archive && FileUtil.isArchiveArtifact(url)) ||
(!archive && !FileUtil.isArchiveArtifact(url))) {
res.add(url);
break;
}
}
if (res.isEmpty()) {
Collections.addAll(res, urls);
}
return res;
}
示例2: apply
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
public Boolean apply(@NonNull final URL url) {
final URL aurl = FileUtil.isArchiveArtifact(url) ?
FileUtil.getArchiveFile(url) :
url;
if (Optional.ofNullable(includeProp)
.map((p) -> getDir(p))
.map((fo) -> Objects.equals(fo.toURL(),aurl))
.orElse(Boolean.FALSE)) {
return Boolean.TRUE;
}
if(Optional.ofNullable(excludeProp)
.map((p) -> getDir(p))
.map((fo) -> Objects.equals(fo.toURL(),aurl))
.orElse(Boolean.FALSE)) {
return Boolean.FALSE;
}
return null;
}
示例3: findSourceRoots2
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
public Result findSourceRoots2(@NonNull URL binaryRoot) {
boolean archive = false;
if (FileUtil.isArchiveArtifact(binaryRoot)) {
binaryRoot = FileUtil.getArchiveFile(binaryRoot);
archive = true;
}
R res = null;
try {
URI artefact = binaryRoot.toURI();
res = cache.get(artefact);
if (res == null) {
res = createResult(artefact, archive, modules, binaryProperties);
if (res == null) {
res = createResult(artefact, archive, testModules, testBinaryProperties);
}
R prev = cache.get(artefact);
if (prev != null) {
res = prev;
} else if (res != null) {
prev = cache.putIfAbsent(artefact, res);
if (prev != null) {
res = prev;
}
}
}
} catch (URISyntaxException e) {
LOG.log(
Level.WARNING,
"Invalid URI: {0}", //NOI18N
binaryRoot.toExternalForm());
}
return res;
}
示例4: findJavadoc
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
public JavadocForBinaryQuery.Result findJavadoc(URL binaryRoot) {
boolean archive = false;
if (FileUtil.isArchiveArtifact(binaryRoot)) {
binaryRoot = FileUtil.getArchiveFile(binaryRoot);
archive = true;
}
R res = null;
try {
URI artefact = binaryRoot.toURI();
res = cache.get(artefact);
if (res == null) {
res = createResult(artefact, archive, modules, binaryProperties);
R prev = cache.get(artefact);
if (prev != null) {
res = prev;
} else if (res != null) {
prev = cache.putIfAbsent(artefact, res);
if (prev != null) {
res = prev;
}
}
}
} catch (URISyntaxException e) {
LOG.log(
Level.WARNING,
"Invalid URI: {0}", //NOI18N
binaryRoot.toExternalForm());
}
return res;
}
示例5: removeArchives
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private static URL[] removeArchives(@NonNull final URL... orig) {
final List<URL> res = new ArrayList<>(orig.length);
for (URL url : orig) {
if (!FileUtil.isArchiveArtifact(url)) {
res.add(url);
}
}
return res.isEmpty() ?
orig :
res.toArray(new URL[res.size()]);
}
示例6: getOwner
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
/**
* Find the project, if any, which "owns" the given URI.
* @param uri the URI to the file (generally on disk); must be absolute and not opaque (though {@code jar}-protocol URIs are unwrapped as a convenience)
* @return a project which contains it, or null if there is no known project containing it
* @throws IllegalArgumentException if the URI is relative or opaque
*/
public static Project getOwner(URI uri) {
try {
URL url = uri.toURL();
if (FileUtil.isArchiveArtifact(url)) {
url = FileUtil.getArchiveFile(url);
if (url != null) {
uri = url.toURI();
}
}
} catch (MalformedURLException | URISyntaxException e) {
LOG.log(Level.INFO, null, e);
}
if (!uri.isAbsolute() || uri.isOpaque()) {
throw new IllegalArgumentException("Bad URI: " + uri); // NOI18N
}
for (FileOwnerQueryImplementation q : getInstances()) {
Project p = q.getOwner(uri);
if (p != null) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "getOwner({0}) -> {1} from {2}", new Object[] {uri, p, q});
}
return p == UNOWNED ? null : p;
}
}
LOG.log(Level.FINE, "getOwner({0}) -> nil", uri);
return null;
}
示例7: findProjectRoots
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public static FileObject findProjectRoots(Project project, List<URL> urls) {
if (project == null) {
return null;
}
FileObject ret = null;
Set<URL> knownURLs = new HashSet<>();
for (SourceGroup sg : org.netbeans.api.project.ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)) {
if (org.netbeans.modules.jshell.project.ShellProjectUtils.isNormalRoot(sg)) {
if (urls != null) {
URL u = URLMapper.findURL(sg.getRootFolder(), URLMapper.INTERNAL);
BinaryForSourceQuery.Result r = BinaryForSourceQuery.findBinaryRoots(u);
for (URL ru : r.getRoots()) {
// ignore JARs, prefer output folder:
if (FileUtil.isArchiveArtifact(ru)) {
continue;
}
if (knownURLs.add(ru)) {
urls.add(ru);
}
}
}
if (ret == null) {
ret = sg.getRootFolder();
}
}
}
return ret;
}