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


Java ClassPath.SOURCE属性代码示例

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


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

示例1: findClassPath

@Override
@CheckForNull
public ClassPath findClassPath(FileObject file, String type) {
    final FileObject root = srcRoot;
    if (root != null && (root.equals(file) || FileUtil.isParentOf(root, file))) {
        switch (type) {
            case ClassPath.BOOT:
                return getBootCp();
            case ClassPath.SOURCE:
                return getSrcCp(root);
            case ClassPath.COMPILE:
                return getCompileCp();
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:BinaryUsagesTest.java

示例2: findClassPath

@Override
public synchronized ClassPath findClassPath(
        final FileObject file,
        final String type) {
    if (root != null && file != null && (root.equals(file) || FileUtil.isParentOf(root, file))) {
        switch (type) {
            case ClassPath.BOOT:
                return cps[0];
            case ClassPath.COMPILE:
                return cps[1];
            case ClassPath.SOURCE:
                return cps[2];
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:JShellSourcePathTest.java

示例3: findClassPath

public ClassPath findClassPath(FileObject file, String type) {
    try {
    if (ClassPath.BOOT == type || JavaClassPathConstants.MODULE_BOOT_PATH.equals(type)) {
        return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0]));
    }
    
    if (ClassPath.SOURCE == type) {
        return ClassPathSupport.createClassPath(new FileObject[] {
            sourceRoot
        });
    }
    
    if (ClassPath.COMPILE == type) {
        return ClassPathSupport.createClassPath(classPathElements);
    }
    
    if (ClassPath.EXECUTE == type) {
        return ClassPathSupport.createClassPath(new FileObject[] {
            buildRoot
        });
    }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SourceUtilsTestUtil.java

示例4: findClassPath

@Override
public ClassPath findClassPath(
        FileObject file,
        String type) {
    for (FileObject srcRoot : srcPath.getRoots()) {
        if (srcRoot.equals(file) || FileUtil.isParentOf(srcRoot, file)) {
            if (type == ClassPath.SOURCE) {
                return srcPath;
            } else if (type == ClassPath.BOOT) {
                return bootPath;
            } else if (type == ClassPath.COMPILE) {
                return compilePath;
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:JavaOperationsImplTest.java

示例5: findClassPath

public ClassPath findClassPath(FileObject file, String type) {
    try {
    if (ClassPath.BOOT == type) {
        // XXX simpler to use JavaPlatformManager.getDefault().getDefaultPlatform().getBootstrapLibraries()
        return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0]));
    }

    if (ClassPath.SOURCE == type) {
        return sourcePath;
    }

    if (ClassPath.COMPILE == type) {
        return compileClassPath;
    }

    if (ClassPath.EXECUTE == type) {
        return ClassPathSupport.createClassPath(new FileObject[] {
            buildRoot
        });
    }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:HintTest.java

示例6: translate

@NonNull
private static URL[] translate(@NonNull final URL root, @NonNull final String[] cpType) {
    final SourceForBinaryQuery.Result2 res = SourceForBinaryQuery.findSourceRoots2(root);
    FileObject[] roots;
    if (res.preferSources() && (roots = res.getRoots()).length > 0) {
        cpType[0] = ClassPath.SOURCE;
        return asURLs(roots);
    }
    return new URL[] {root};
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:JavaTypeProvider.java

示例7: findClassPath

public ClassPath findClassPath(final FileObject file, final String type) {
    final FileObject[] roots = sourcePath.getRoots();
    for (FileObject root : roots) {
        if (root.equals(file) || FileUtil.isParentOf(root, file)) {
            if (type == ClassPath.SOURCE) {
                return sourcePath;
            }
            if (type == ClassPath.COMPILE) {
                return compilePath;
            }
            if (type == ClassPath.BOOT) {
                return bootPath;
            }
        }
    }
    if (libSrc2.equals(file) || FileUtil.isParentOf(libSrc2, file)) {
        if (type == ClassPath.SOURCE) {
            return ClassPathSupport.createClassPath(new FileObject[]{libSrc2});
        }
        if (type == ClassPath.COMPILE) {
            return ClassPathSupport.createClassPath(new URL[0]);
        }
        if (type == ClassPath.BOOT) {
            return bootPath;
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:JavaTypeProviderTest.java

示例8: findClassPath

@Override
public ClassPath findClassPath(FileObject file, String type) {
    final FileObject _root = root;
    if (_root != null && (_root.equals(file) || FileUtil.isParentOf(_root, file))) {
        switch (type) {
            case ClassPath.SOURCE:
                return ClassPathSupport.createClassPath(_root);
            case ClassPath.COMPILE:
                return ClassPath.EMPTY;
            case ClassPath.BOOT:
                return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")); //NOI18N
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:SourceAnalyzerTest.java

示例9: findClassPath

public ClassPath findClassPath(final FileObject file, final String type) {
    final FileObject[] roots = sourcePath.getRoots();
    for (FileObject root : roots) {
        if (root.equals(file) || FileUtil.isParentOf(root, file)) {
            if (type == ClassPath.SOURCE) {
                return sourcePath;
            }
            if (type == ClassPath.COMPILE) {
                return compilePath;
            }
            if (type == ClassPath.BOOT) {
                return bootPath;
            }
        }
    }
    if (libSrc2.equals(file) || FileUtil.isParentOf(libSrc2, file)) {
        if (type == ClassPath.SOURCE) {
                return ClassPathSupport.createClassPath(new FileObject[]{libSrc2});
            }
            if (type == ClassPath.COMPILE) {
                return ClassPathSupport.createClassPath(new URL[0]);
            }
            if (type == ClassPath.BOOT) {
                return bootPath;
            }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:IndexerTransactionTest.java

示例10: setUp

protected void setUp() throws Exception {
    JavaSourceTaskFactory.SYNCHRONOUS_EVENTS = true;
    cpp = new ClassPathProvider() {
        public ClassPath findClassPath(FileObject file, String type) {
            if (type == ClassPath.SOURCE)
                return ClassPathSupport.createClassPath(new FileObject[] {FileUtil.toFileObject(getDataDir())});
                if (type == ClassPath.COMPILE)
                    return ClassPathSupport.createClassPath(new FileObject[0]);
                if (type == ClassPath.BOOT)
                    return createBootPath();
                return null;
        }
    };
    SourceUtilsTestUtil.setLookup(new Object[] {
        JavaDataLoader.getLoader(JavaDataLoader.class),
        cpp
    }, this.getClass().getClassLoader());


    jstf = new JavaSourceTaskFactoryImplImpl();
    JavaSourceTaskFactory.ACCESSOR2 = new AccessorImpl();
    testDir = SourceUtilsTestUtil.makeScratchDir(this);
    testFile1 = testDir.createData("test1.java");
    testFile2 = testDir.createData("test2.java");
    task1 = new DummyCancellableTask<CompilationInfo>();
    task2 = new DummyCancellableTask<CompilationInfo>();

    file2Task.put(testFile1, task1);
    file2Task.put(testFile2, task2);

    assertNotNull(JavaSource.forFileObject(testFile1));
    assertNotNull(JavaSource.forFileObject(testFile2));

    assertEquals(2, file2Task.size());

    JavaSourceTaskFactoryManager.register();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:JavaSourceTaskFactoryTest.java

示例11: setUp

@Override
protected void setUp() throws Exception {
    ClassPathProvider cpp = new ClassPathProvider() {
        public ClassPath findClassPath(FileObject file, String type) {
            if (type == ClassPath.SOURCE)
                return ClassPathSupport.createClassPath(getSourcePath());
                if (type == ClassPath.COMPILE)
                    return ClassPathSupport.createClassPath(new FileObject[0]);
                if (type == ClassPath.BOOT)
                    return createClassPath(System.getProperty("sun.boot.class.path"));
                return null;
        }
    };
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);
    SourceLevelQueryImplementation slq = new SourceLevelQueryImplementation() {
        @Override public String getSourceLevel(FileObject javaFile) {
            return GeneratorTestMDRCompat.this.getSourceLevel();
        }
    };
    SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/source/resources/layer.xml"}, new Object[] {loader, cpp});
    MockMimeLookup.setInstances(MimePath.get("text/x-java"), new Reindenter.Factory());
    
    TestUtil.setupEditorMockServices();
    JEditorPane.registerEditorKitForContentType("text/x-java", "org.netbeans.modules.editor.java.JavaKit");
    File cacheFolder = new File(getWorkDir(), "var/cache/index");
    cacheFolder.mkdirs();
    IndexUtil.setCacheFolder(cacheFolder);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:GeneratorTestMDRCompat.java

示例12: findClassPath

@Override
public ClassPath findClassPath(FileObject file, String type) {
    JShellEnvironment jshe = ShellRegistry.get().getOwnerEnvironment(file);
    if (jshe == null) {
        return null;
    }
    ShellSession ss = jshe.getSession();
    if (ss == null) {
        return null;
    }
    ClasspathInfo cpi = ss.getClasspathInfo();
    if (cpi == null) {
        return null;
    }
    switch (type) {
        case JavaClassPathConstants.MODULE_BOOT_PATH:
            return cpi.getClassPath(PathKind.MODULE_BOOT);
            
        case JavaClassPathConstants.MODULE_COMPILE_PATH:
            return cpi.getClassPath(PathKind.MODULE_COMPILE);
            
        case JavaClassPathConstants.MODULE_CLASS_PATH:
            return cpi.getClassPath(PathKind.MODULE_CLASS);
            
        case JavaClassPathConstants.MODULE_SOURCE_PATH:
            return cpi.getClassPath(PathKind.MODULE_SOURCE);
            
        case ClassPath.COMPILE:
            return cpi.getClassPath(PathKind.COMPILE);
        case ClassPath.SOURCE:
            return cpi.getClassPath(PathKind.SOURCE);
        case ClassPath.BOOT:
            return cpi.getClassPath(PathKind.BOOT);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:ShellClasspathProvider.java

示例13: findClassPath

public ClassPath findClassPath(FileObject file, String type) {
    try {
        FileObject root = findRoot(file);

        if (root == null) {
            return null;
        }
        
        if (ClassPath.BOOT == type) {
            return ClassPathSupport.createClassPath(SourceUtilsTestUtil.getBootClassPath().toArray(new URL[0]));
        }

        if (ClassPath.SOURCE == type) {
            return ClassPathSupport.createClassPath(new FileObject[] {
                root
            });
        }

        if (ClassPath.COMPILE == type) {
            return root2ClassPath.get(root);
        }

        if (ClassPath.EXECUTE == type) {
            return ClassPathSupport.createProxyClassPath(
                    root2ClassPath.get(root),
                    ClassPathSupport.createClassPath(new FileObject[] {
                        root2BuildRoot.get(root)
                    })
                   );
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:ComputeOverridersTest.java

示例14: findClassPath

public ClassPath findClassPath(FileObject file, String type) {
    try {
        if (type == ClassPath.SOURCE) {
            return createSourcePath(FileUtil.toFileObject(getWorkDir()));
        } else if (type == ClassPath.BOOT) {
            return createBootClassPath();
        }
    } catch (IOException ioe) {
        //Skeep it
    }
    return ClassPathSupport.createClassPath(Collections.<PathResourceImplementation>emptyList());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:UiUtilsTest.java

示例15: findClassPath

@Override
public ClassPath findClassPath(FileObject file, String type) {
    FileObject srcRoot = FileUtil.getArchiveFile(file);
    if (srcRoot != null) {
        GradleAndroidClassPathProvider provider = backReferenceMap.get(srcRoot);
        if (provider != null) {
            switch (type) {
                case ClassPath.SOURCE:

                    ClassPath classPath = cache.get(srcRoot);
                    if (classPath == null) {
                        ClassPath srcClassPath = ClassPathSupport.createClassPath(FileUtil.getArchiveRoot(srcRoot));
                        GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[]{srcClassPath});
                        classPath = ClassPathSupport.createProxyClassPath(srcClassPath);
                        cache.put(srcRoot, classPath);
                    }
                    return classPath;
                case ClassPath.BOOT:
                    return provider.getClassPath(ClassPath.BOOT);
                case ClassPath.COMPILE:
                    return provider.getClassPath(ClassPath.COMPILE);

            }
        }
    }
    return null;
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:27,代码来源:AutoAndroidGradleSourceForBinaryQuery.java


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