当前位置: 首页>>代码示例>>Java>>正文


Java FileUtil.isArchiveArtifact方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ModuleClassPaths.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ClassPathProviderImpl.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:MultiModuleSourceForBinaryQueryImpl.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:MultiModuleJavadocForBinaryQueryImpl.java

示例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()]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ProjectRunnerImpl.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:FileOwnerQuery.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ShellProjectUtils.java


注:本文中的org.openide.filesystems.FileUtil.isArchiveArtifact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。