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


Java ClassPath.contains方法代码示例

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


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

示例1: importButtonActionPerformed

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed
    File[] files = selectedExternalFile != null ?
        files = new File[] { selectedExternalFile } : null;
    FileObject srcFile = propertyEditor.getSourceFile();
    ImportImageWizard.lastDirectoryUsed = getFileChooserDir();
    FileObject[] imported = new ImportImageWizard(files, selectedPackage, srcFile).show();
    lastDirectoryUsed = ImportImageWizard.lastDirectoryUsed;
    FileObject fo = imported != null && imported.length > 0 ?  imported[0] : null;
    if (fo != null) {
        ClassPath cp = ClassPath.getClassPath(srcFile, ClassPath.SOURCE);
        if (cp.contains(fo)) {
            setPackageRoot(cp.findOwnerRoot(fo));
            selectedPackage = null; // to be sure it is refreshed
            setPackage(fo.getParent());
            setPackageFile(fo);
            classPathRadio.setSelected(true);
            updateValue();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CustomIconEditor.java

示例2: getImplementorsRecursive

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
private static Collection<FileObject> getImplementorsRecursive(ClassIndex idx, ClasspathInfo cpInfo, TypeElement el, AtomicBoolean cancel) {
    Set<?> implementorsAsHandles = RefactoringUtils.getImplementorsAsHandles(idx, cpInfo, el, cancel);

    if(cancel != null && cancel.get()) {
        return Collections.<FileObject>emptySet();
    }
    @SuppressWarnings("unchecked")
    Collection<FileObject> set = SourceUtilsEx.getFiles((Collection<ElementHandle<? extends Element>>) implementorsAsHandles, cpInfo, cancel);

    // filter out files that are not on source path
    ClassPath source = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE);
    Collection<FileObject> set2 = new ArrayList<>(set.size());
    for (FileObject fo : set) {
        if (source.contains(fo)) {
            set2.add(fo);
        }
        if(cancel != null && cancel.get()) {
            return Collections.<FileObject>emptySet();
        }
    }
    return set2;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:JavaWhereUsedQueryPlugin.java

示例3: getCustomEditor

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
/** Overrides superclass method.
 * @return <code>ResourceBundlePanel</code> fed with <code>FormI18nString</code> value. */
public Component getCustomEditor() {
    FormI18nString formI18nString;
    Object value = getValue();
    if (value instanceof FormI18nString) {
        formI18nString = new FormI18nString((FormI18nString)value);
    }
    else {
        formI18nString = createFormI18nString();
        if (value instanceof String)
            formI18nString.setValue((String)value);
        DataObject lastResource = I18nUtil.getOptions().getLastResource2(sourceDataObject);
        if (lastResource != null) {
            FileObject sourceFile = sourceDataObject.getPrimaryFile();
            FileObject bundleFile = lastResource.getPrimaryFile();
            ClassPath sourceClassPath = ClassPath.getClassPath(
                                            sourceFile, ClassPath.SOURCE);
            if (sourceClassPath.contains(bundleFile)) {
                formI18nString.getSupport().getResourceHolder().setResource(
                        lastResource);
            }
        }
    }
    return new CustomEditor(formI18nString, getProject(), sourceDataObject.getPrimaryFile());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:FormI18nStringEditor.java

示例4: setExternalAsCPFile

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
/**
 * Tries to find given file on classpath and set it as selected classpath file.
 * @return true if the file is on classpath
 */
private boolean setExternalAsCPFile(File file) {
    FileObject fo = FileUtil.toFileObject(file);
    if (fo != null) {
        ClassPath cp = ClassPath.getClassPath(propertyEditor.getSourceFile(), ClassPath.SOURCE);
        if (cp.contains(fo)) {
            setPackageRoot(cp.findOwnerRoot(fo));
            setPackage(fo.getParent());
            setPackageFile(fo);
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CustomIconEditor.java

示例5: addRecursivelly

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
private static void addRecursivelly(FileObject top, List<FileObject> into, Set<String> sourceIds, ClassPath sourceCP, SourceGroup sg, AtomicBoolean cancel) {
    List<FileObject> todo = new LinkedList<FileObject>();
    Iterator<String> sIDIter = sourceIds.iterator();
    
    while (sourceCP == null && sIDIter.hasNext()) {
        if (cancel.get()) return;
        sourceCP = ClassPath.getClassPath(top, sIDIter.next());
    }

    todo.add(top);

    while (!todo.isEmpty()) {
        if (cancel.get()) return;
        
        FileObject current = todo.remove(0);

        if (!VisibilityQuery.getDefault().isVisible(current)) continue;
        if (sourceCP != null && !sourceCP.contains(current)) continue;
        if (sg != null && !sg.contains(current)) continue;

        if (current.isData()) {
            into.add(current);
        }

        todo.addAll(Arrays.asList(current.getChildren()));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:GlobalFormatAction.java

示例6: packageRename

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
private void packageRename(FileObject originalPkgFile) {
    FormEditorSupport fes = getFormEditorSupport();
    if (fes.isOpened()) {
        fes.closeFormEditor();
    }
    String oldName = refInfo.getOldName(originalPkgFile);
    String newName = refInfo.getNewName();
    if (refInfo.getChangeType() == RefactoringInfo.ChangeType.FOLDER_RENAME) {
        // determine full package name for renamed folder
        ClassPath cp = ClassPath.getClassPath(originalPkgFile, ClassPath.SOURCE);
        FileObject parent = originalPkgFile.getParent();
        if (cp != null && cp.contains(parent)) {
            String parentPkgName = cp.getResourceName(parent, '.', false);
            if (parentPkgName != null && parentPkgName.length() > 0) {
                oldName = parentPkgName + "." + oldName; // NOI18N
                newName = parentPkgName + "." + newName; // NOI18N
            }
        }
    }
    if (replaceClassOrPkgName(new String[] { oldName },
                              new String[] { newName },
                              true)
            && !isGuardedCodeChanging()) {
        // some package references in resource were changed in the form file
        // (not class names since no change in guarded code came from java
        // refactoring) and because no component has changed we can load the
        // form and regenerate to get the new resource names into code
        updateForm(true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:FormRefactoringUpdate.java

示例7: hasModuleInfo

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
public static boolean hasModuleInfo(@NonNull final SourceRoots roots) {
    ClassPath scp = null;
    for (FileObject root : roots.getRoots()) {
        FileObject mInfo = J2SEModularProjectUtil.getModuleInfo(root);
        if (mInfo != null) {
            if (scp == null) {
                scp = ClassPath.getClassPath(root, ClassPath.SOURCE);
            }
            if (scp.contains(mInfo)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:J2SEModularProjectUtil.java

示例8: hasModuleInfo

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
public static boolean hasModuleInfo(@NonNull final SourceRoots roots) {
    ClassPath scp = null;
    for (FileObject root : roots.getRoots()) {
        FileObject mInfo = J2SEProjectUtil.getModuleInfo(root);
        if (mInfo != null) {
            if (scp == null) {
                scp = ClassPath.getClassPath(root, ClassPath.SOURCE);
            }
            if (scp.contains(mInfo)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:J2SEProjectUtil.java

示例9: addArchivesToProject

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
public static void addArchivesToProject(Project project, FileObject targetSource,
        List<FileObject> jars, String classPathType) {
    if (targetSource == null) {
        targetSource = getSourceRoot(project);
    }
    ClassPath classPath = ClassPath.getClassPath(targetSource, classPathType);
    if (classPath != null) {  //hack for PHP
        try {
            FileObject wsClientsSubDir = getWebServiceClientLibraryDir(project);
            ArrayList<URL> archiveJars = new ArrayList<URL>();
            for (FileObject jarFO : jars) {
                try {
                    FileObject destJar = wsClientsSubDir.getFileObject(jarFO.getNameExt());
                    if (destJar == null) {
                        destJar = FileUtil.copyFile(jarFO, wsClientsSubDir, jarFO.getName());
                    }
                    if (classPath.contains(destJar)) {
                        continue;
                    }
                    archiveJars.add(new URL(destJar.getURL().toExternalForm() + "/")); // NOI18N

                } catch (IOException ex) {
                    Exceptions.printStackTrace(ex);
                }
                URL[] archiveURLs = archiveJars.toArray(new URL[archiveJars.size()]);
                ProjectClassPathModifier.addRoots(archiveURLs, targetSource, classPathType);
            }

        } catch (IOException ioe) {
            Exceptions.printStackTrace(ioe);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:LibrariesHelper.java

示例10: setDefaultResource

import org.netbeans.api.java.classpath.ClassPath; //导入方法依赖的package包/类
public void setDefaultResource(DataObject dataObject) {
        if (dataObject != null) {
            // look for peer Bundle.properties
            FileObject fo = dataObject.getPrimaryFile();
            ClassPath cp = ClassPath.getClassPath(fo, ClassPath.SOURCE);

            if (cp != null) {
                FileObject folder = cp.findResource(cp.getResourceName(fo.getParent()));

                while (folder != null && cp.contains(folder)) {
                
                    String rn = cp.getResourceName(folder) + "/Bundle.properties"; // NOI18N
                
                    FileObject peer = cp.findResource(rn);
                    if (peer == null) {
                        //Try to find any properties file
                        Enumeration<? extends FileObject> data = Enumerations.filter(folder.getData(false), new Enumerations.Processor(){
                            public Object process(Object obj, Collection alwaysNull) {
                                if (obj instanceof FileObject &&
                                        "properties".equals( ((FileObject)obj).getExt())){ //NOI18N
                                    return obj;
                                } else {
                                    return null;
                                }
                            }
                        });
                        if (data.hasMoreElements()) {
                            peer = data.nextElement();
                        }
                    }
                    if (peer != null) {
                        try {
                            DataObject peerDataObject = DataObject.find(peer);
//                          ((ResourcePanel)resourcePanel).setResource(peerDataObject);
                            propertyPanel.setResource(peerDataObject);
                            return;
                        } catch (IOException ex) {
                            // no default resource
                        }
                    }
                    folder = folder.getParent();
                }
            }
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:I18nPanel.java


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