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


Java PropertyUtils.tokenizePath方法代码示例

本文整理汇总了Java中org.netbeans.spi.project.support.ant.PropertyUtils.tokenizePath方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtils.tokenizePath方法的具体用法?Java PropertyUtils.tokenizePath怎么用?Java PropertyUtils.tokenizePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.spi.project.support.ant.PropertyUtils的用法示例。


在下文中一共展示了PropertyUtils.tokenizePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeFromPath

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
 * Removes the path entry from path.
 * @param path to remove the netry from
 * @param toRemove the entry to be rmeoved from the path
 * @return new path with removed entry
 */
@NonNull
public static String removeFromPath(@NonNull final String path, @NonNull final String toRemove) {
    Parameters.notNull("path", path);   //NOI18N
    Parameters.notNull("toRemove", toRemove); //NOI18N
    final StringBuilder sb = new StringBuilder();
    for (String entry : PropertyUtils.tokenizePath(path)) {
        if (toRemove.equals(entry)) {
            continue;
        }
        sb.append(entry);
        sb.append(':'); //NOI18N
    }
    return sb.length() == 0 ?
        sb.toString() :
        sb.substring(0, sb.length()-1);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:JFXProjectUtils.java

示例2: remove

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private void remove(@NonNull final AntProjectHelper helper) {
    final EditableProperties props = helper.getProperties (AntProjectHelper.PROJECT_PROPERTIES_PATH);
    String rawPath = props.getProperty (classPathId);
    if (rawPath != null) {
        final String[] pathElements = PropertyUtils.tokenizePath(rawPath);
        final List<String> result = new ArrayList<String>(pathElements.length);
        boolean changed = false;
        for (String pathElement : pathElements) {
            if (rawId.equals(pathElement)) {
                changed = true;
                continue;
            }
            result.add(pathElement + PATH_SEPARATOR_CHAR);
        }
        if (!result.isEmpty()) {
            final String last = result.get(result.size()-1);
            result.set(result.size()-1, last.substring(0, last.length()-1));
        }
        if (changed) {
            props.setProperty(classPathId, result.toArray(new String[result.size()]));
            helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ProfileProblemsProviderImpl.java

示例3: removeFromBuildProperties

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
 * Remove given value to given classpath-like Ant property.
 */
private static boolean removeFromBuildProperties(AntProjectHelper helper, String property, String referenceToRemove) {
    boolean result = true;
    EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
    String cp = ep.getProperty(property);
    String oldCp = cp;
    if (cp != null && referenceToRemove != null) {
        cp = cp.replace(referenceToRemove, ""); //NOI18N
    }
    if (cp.equals(oldCp)) {
        result = false;
    }
    String[] arr = PropertyUtils.tokenizePath(cp);
    for (int i = 0; i < arr.length - 1; i++) {
        arr[i] += ":"; // NOI18N
    }
    ep.setProperty(property, arr);
    if (referenceToRemove.startsWith("${file.reference.") && isLastReference(ep, CommonProjectUtils.getAntPropertyName(referenceToRemove))) { //NOI18N
        ep.remove(CommonProjectUtils.getAntPropertyName(referenceToRemove));
    }
    helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProjectFactorySupport.java

示例4: filterProbe

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private static String filterProbe (String v, final String probePath) {
    if (v != null) {
        final String[] pes = PropertyUtils.tokenizePath(v);
        final StringBuilder sb = new StringBuilder ();
        for (String pe : pes) {
            if (probePath != null ?  probePath.equals(pe) : (pe != null &&
            pe.endsWith("org-netbeans-modules-java-j2seplatform-probe.jar"))) { //NOI18N
                //Skeep
            }
            else {
                if (sb.length() > 0) {
                    sb.append(File.pathSeparatorChar);
                }
                sb.append(pe);
            }
        }
        v = sb.toString();
    }
    return v;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Util.java

示例5: loadProjects

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private Set<NbModuleProject> loadProjects() {
    Set<NbModuleProject> newProjects = new HashSet<NbModuleProject>();
    String modules = eval.getProperty("modules"); // NOI18N
    if (modules != null) {
        for (String piece : PropertyUtils.tokenizePath(modules)) {
            FileObject dir = helper.resolveFileObject(piece);
            if (dir != null) {
                try {
                    Project subp = ProjectManager.getDefault().findProject(dir);
                    if (subp != null && subp instanceof NbModuleProject) {
                        newProjects.add((NbModuleProject) subp);
                    }
                } catch (IOException e) {
                    Util.err.notify(ErrorManager.INFORMATIONAL, e);
                }
            }
        }
    }
    return Collections.unmodifiableSet(newProjects);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:SuiteSubprojectProviderImpl.java

示例6: getFilterTokens

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
 * Return a set of tokens that can be used to search for this dependency.
 * Per UI spec, includes lower-case versions of:
 * <ol>
 * <li>the code name base
 * <li>the localized display name
 * <li> the full path to the module JAR or any Class-Path extension
 * <li> the fully-qualified class name (use . for inner classes) of any class
 * contained in the module JAR or any Class-Path extension which is in an package
 * which would be made available to the depending module when using a specification version dependency
 * </ol>
 * Note that the last item means that this can behave differently according to the depending
 * module (according to whether or not it would be listed as a friend).
 * @param dependingModuleCNB the CNB of the module depending on this one
 */
public Set<String> getFilterTokens(String dependingModuleCNB) {
    boolean friend = me.isDeclaredAsFriend(dependingModuleCNB);
    Set<String> filterTokens = friend ? filterTokensFriend : filterTokensNotFriend;
    if (filterTokens == null) {
        filterTokens = new HashSet<String>();
        filterTokens.add(me.getCodeNameBase());
        filterTokens.add(me.getLocalizedName());
        filterTokens.add(me.getJarLocation().getAbsolutePath());
        String[] cpext = PropertyUtils.tokenizePath(me.getClassPathExtensions());
        filterTokens.addAll(Arrays.asList(cpext));
        if (friend) {
            for (String clazz : me.getPublicClassNames()) {
                filterTokens.add(clazz.replace('$', '.'));
            }
        }
        if (friend) {
            filterTokensFriend = filterTokens;
        } else {
            filterTokensNotFriend = filterTokens;
        }
    }
    return filterTokens;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:ModuleDependency.java

示例7: getPublicClassNames

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public synchronized Set<String> getPublicClassNames() {
    if (publicClassNames == null) {
        try {
            publicClassNames = computePublicClassNamesInMainModule();
            String[] cpext = PropertyUtils.tokenizePath(getClassPathExtensions());
            for (int i = 0; i < cpext.length; i++) {
                File ext = new File(cpext[i]);
                if (!ext.isFile()) {
                    Logger.getLogger(AbstractEntry.class.getName()).log(Level.FINE,
                            "Could not find Class-Path extension {0} of {1}", new Object[] {ext, this});
                    continue;
                }
                scanJarForPublicClassNames(publicClassNames, ext);
            }
        } catch (IOException e) {
            publicClassNames = Collections.emptySet();
            Util.err.annotate(e, ErrorManager.UNKNOWN, "While scanning for public classes in " + this, null, null, null); // NOI18N
            Util.err.notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return publicClassNames;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:AbstractEntry.java

示例8: createClasspath

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
 * Create a classpath from a &lt;classpath&gt; element.
 */
private List<URL> createClasspath(
        final Element classpathEl,
        final Function<URL,Collection<URL>> translate) {
    String cp = XMLUtil.findText(classpathEl);
    if (cp == null) {
        cp = "";
    }
    String cpEval = evaluator.evaluate(cp);
    if (cpEval == null) {
        return Collections.emptyList();
    }
    final String[] path = PropertyUtils.tokenizePath(cpEval);
    final List<URL> res = new ArrayList<>();
    for (String pathElement : path) {
        res.addAll(translate.apply(createClasspathEntry(pathElement)));
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:Classpaths.java

示例9: translate

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private String translate(String classpath) {
        StringBuilder cp = new StringBuilder();
        boolean first = true;
        boolean disableSources = Boolean.valueOf(getProject().getProperty("maven.disableSources"));
        
        for (String path : PropertyUtils.tokenizePath(classpath)) {
            File[] files = translateEntry(path, disableSources);

            if (files.length == 0) {
                //TODO: log
//                LOG.log(Level.FINE, "cannot translate {0} to file", e.getURL().toExternalForm());
                continue;
            }

            for (File f : files) {
                if (!first) {
                    cp.append(File.pathSeparatorChar);
                }

                cp.append(f.getAbsolutePath());
                first = false;
            }
        }

        return cp.toString();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:TranslateClassPath.java

示例10: testAddRemoveRoot

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void testAddRemoveRoot () throws Exception {
    final FileObject rootFolder = this.scratch.createFolder("Root");
    final FileObject jarFile = TestFileUtils.writeZipFile(scratch, "archive.jar", "Test.properties:");
    final FileObject jarRoot = FileUtil.getArchiveRoot(jarFile);
    ProjectClassPathModifier.addRoots (new URL[] {rootFolder.toURL()}, this.src, ClassPath.COMPILE);
    String cp = this.eval.getProperty("javac.classpath");
    assertNotNull (cp);
    String[] cpRoots = PropertyUtils.tokenizePath (cp);
    assertNotNull (cpRoots);
    assertEquals(1,cpRoots.length);
    assertEquals(rootFolder,this.helper.resolveFileObject(cpRoots[0]));
    ProjectClassPathModifier.removeRoots (new URL[] {rootFolder.toURL()},this.src, ClassPath.COMPILE);
    cp = this.eval.getProperty("javac.classpath");
    assertNotNull (cp);
    cpRoots = PropertyUtils.tokenizePath (cp);
    assertNotNull (cpRoots);
    assertEquals(0,cpRoots.length);
    ProjectClassPathModifier.addRoots(new URL[] {jarRoot.toURL()},this.test,ClassPath.EXECUTE);
    cp = this.eval.getProperty("run.test.classpath");
    assertNotNull (cp);
    cpRoots = PropertyUtils.tokenizePath (cp);
    assertNotNull (cpRoots);
    assertEquals(5,cpRoots.length);
    assertEquals(this.helper.resolveFileObject(cpRoots[4]),jarFile);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:J2SEProjectClassPathModifierTest.java

示例11: testAddRemoveLibrary

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void testAddRemoveLibrary () throws Exception {
    LibraryProvider lp = Lookup.getDefault().lookup(LibraryProvider.class);
    assertNotNull (lp);
    LibraryImplementation[] impls = lp.getLibraries();
    assertNotNull (impls);
    assertEquals(1,impls.length);
    FileObject libRoot = this.scratch.createFolder("libRoot");
    impls[0].setContent("classpath",Collections.singletonList(libRoot.toURL()));
    Library[] libs =LibraryManager.getDefault().getLibraries();
    assertNotNull (libs);
    assertEquals(1,libs.length);
    ProjectClassPathModifier.addLibraries(libs, this.src, ClassPath.COMPILE);
    String cp = this.eval.getProperty("javac.classpath");
    assertNotNull (cp);
    String[] cpRoots = PropertyUtils.tokenizePath (cp);
    assertNotNull (cpRoots);
    assertEquals(1,cpRoots.length);
    assertEquals("${libs.Test.classpath}",cpRoots[0]);    //There is no build.properties filled, the libraries are not resolved
    ProjectClassPathModifier.removeLibraries(libs,this.src, ClassPath.COMPILE);
    cp = this.eval.getProperty("javac.classpath");
    assertNotNull (cp);
    cpRoots = PropertyUtils.tokenizePath (cp);
    assertNotNull (cpRoots);
    assertEquals(0,cpRoots.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:J2SEProjectClassPathModifierTest.java

示例12: testClassPathExtenderCompatibility

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void testClassPathExtenderCompatibility () throws Exception {
    final FileObject rootFolder = this.scratch.createFolder("Root");
    final FileObject jarFile = TestFileUtils.writeZipFile(scratch, "archive.jar", "Test.properties:");
    org.netbeans.spi.java.project.classpath.ProjectClassPathExtender extender =
            prj.getLookup().lookup(org.netbeans.spi.java.project.classpath.ProjectClassPathExtender.class);
    assertNotNull (extender);
    extender.addArchiveFile(rootFolder);
    extender.addArchiveFile(jarFile);
    String cp = this.eval.getProperty("javac.classpath");
    assertNotNull (cp);
    String[] cpRoots = PropertyUtils.tokenizePath (cp);
    assertNotNull (cpRoots);
    assertEquals(2,cpRoots.length);
    assertEquals(rootFolder,this.helper.resolveFileObject(cpRoots[0]));
    assertEquals(jarFile,this.helper.resolveFileObject(cpRoots[1]));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:J2SEProjectClassPathModifierTest.java

示例13: addToBuildProperties

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
 * Add given value to given classpath-like Ant property.
 */
private static void addToBuildProperties(AntProjectHelper helper, String property, String valueToAppend) {
    EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
    String cp = ep.getProperty(property);
    if (cp == null) {
        cp = ""; //NOI18N
    } else {
        cp += ":"; //NOI18N
    }
    cp += valueToAppend;
    String[] arr = PropertyUtils.tokenizePath(cp);
    for (int i = 0; i < arr.length - 1; i++) {
        arr[i] += ":"; //NOI18N
    }
    ep.setProperty(property, arr);
    helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ProjectFactorySupport.java

示例14: addPathFromProjectEvaluated

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private void addPathFromProjectEvaluated(List<PathResourceImplementation> entries, String path) {
    if (path != null) {
        for (String piece : PropertyUtils.tokenizePath(path)) {
            URL url = FileUtil.urlForArchiveOrDir(project.getHelper().resolveFile(piece));
            if (url != null) { // #135292
                entries.add(ClassPathSupport.createResource(url));
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ClassPathProviderImpl.java

示例15: findModulesInSuite

import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private static File[] findModulesInSuite(File root, PropertyEvaluator eval) throws IOException {
    String modulesS = eval.getProperty("modules"); // NOI18N
    if (modulesS == null) {
        modulesS = ""; // NOI18N
    }
    String[] modulesA = PropertyUtils.tokenizePath(modulesS);
    File[] modules = new File[modulesA.length];
    for (int i = 0; i < modulesA.length; i++) {
        modules[i] = PropertyUtils.resolveFile(root, modulesA[i]);
    }
    return modules;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ModuleList.java


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