本文整理汇总了Java中org.netbeans.api.java.classpath.ClassPath.COMPILE属性的典型用法代码示例。如果您正苦于以下问题:Java ClassPath.COMPILE属性的具体用法?Java ClassPath.COMPILE怎么用?Java ClassPath.COMPILE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.netbeans.api.java.classpath.ClassPath
的用法示例。
在下文中一共展示了ClassPath.COMPILE属性的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;
}
示例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;
}
示例3: 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;
}
示例4: 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;
}
示例5: addArtifacts
private void addArtifacts (AntArtifactItem[] artifactItems) {
final FileObject[] roots = this.sources.get();
if (roots.length == 0) {
return;
}
final FileObject projectSourcesArtifact = roots[0];
AntArtifact[] artifacts = new AntArtifact[artifactItems.length];
URI[] artifactURIs = new URI[artifactItems.length];
for (int i = 0; i < artifactItems.length; i++) {
artifacts[i] = artifactItems[i].getArtifact();
artifactURIs[i] = artifactItems[i].getArtifactURI();
}
try {
final FileObject moduleInfo = findModuleInfo(roots);
final String cpType = moduleInfo != null ?
JavaClassPathConstants.MODULE_COMPILE_PATH :
ClassPath.COMPILE;
ProjectClassPathModifier.addAntArtifacts(artifacts, artifactURIs,
projectSourcesArtifact, cpType);
DefaultProjectModulesModifier.extendModuleInfo(moduleInfo, Arrays.asList(toURLs(artifactItems)));
} catch (IOException ioe) {
Exceptions.printStackTrace(ioe);
} catch (UnsupportedOperationException e) {
handlePCPMUnsupported(sources, e);
}
}
示例6: addLibraries
private void addLibraries (Library[] libraries) {
final FileObject[] roots = this.sources.get();
if (roots.length == 0) {
return;
}
final FileObject projectSourcesArtifact = roots[0];
try {
final FileObject moduleInfo = findModuleInfo(roots);
final String cpType = moduleInfo != null ?
JavaClassPathConstants.MODULE_COMPILE_PATH :
ClassPath.COMPILE;
ProjectClassPathModifier.addLibraries(libraries,
projectSourcesArtifact, cpType);
DefaultProjectModulesModifier.extendModuleInfo(moduleInfo, Arrays.asList(toURLs(libraries)));
} catch (IOException ioe) {
Exceptions.printStackTrace(ioe);
} catch (UnsupportedOperationException e) {
handlePCPMUnsupported(sources, e);
}
}
示例7: findSource
@CheckForNull
private static FileObject findSource(
@NonNull final FileObject file,
@NonNull final ElementHandle<?> elementHandle) {
FileObject owner = null;
for (String id : new String[] {
ClassPath.EXECUTE,
ClassPath.COMPILE,
ClassPath.BOOT}) {
final ClassPath cp = ClassPath.getClassPath(file, id);
if (cp != null) {
owner = cp.findOwnerRoot(file);
if (owner != null) {
break;
}
}
}
return owner == null ?
owner :
SourceUtils.getFile(
elementHandle,
ClasspathInfo.create(
ClassPathSupport.createClassPath(owner),
ClassPath.EMPTY,
ClassPath.EMPTY));
}
示例8: 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;
}
示例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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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();
}
示例13: 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);
}
示例14: getExtensibleClassPathTypes
@Override
public String[] getExtensibleClassPathTypes(SourceGroup arg0) {
return new String[] {
ClassPath.COMPILE,
ClassPath.EXECUTE,
JavaClassPathConstants.COMPILE_ONLY,
JavaClassPathConstants.MODULE_COMPILE_PATH,
JavaClassPathConstants.MODULE_EXECUTE_PATH,
JavaClassPathConstants.PROCESSOR_PATH
};
}
示例15: getExtensibleClassPathTypes
@Override
public String[] getExtensibleClassPathTypes (SourceGroup sg) {
return new String[] {
ClassPath.COMPILE,
ClassPath.EXECUTE,
ClassPathSupport.ENDORSED,
JavaClassPathConstants.PROCESSOR_PATH,
JavaClassPathConstants.MODULE_COMPILE_PATH,
JavaClassPathConstants.MODULE_EXECUTE_PATH,
};
}