Java Code Examples for org.netbeans.spi.java.classpath.support.ClassPathSupport#createClassPathImplementation()
The following examples show how to use
org.netbeans.spi.java.classpath.support.ClassPathSupport#createClassPathImplementation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryMavenCPProvider.java From netbeans with Apache License 2.0 | 6 votes |
private ClassPathImplementation createCompileCPI(MavenProject project, File binary) { List<PathResourceImplementation> items = new ArrayList<PathResourceImplementation>(); //according to jglick this could be posisble to leave out on compilation CP.. items.add(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(binary))); if (project != null) { for (Artifact s : project.getCompileArtifacts()) { File file = s.getFile(); if (file == null) continue; URL u = FileUtil.urlForArchiveOrDir(file); if(u != null) { items.add(ClassPathSupport.createResource(u)); } else { LOG.log(Level.FINE, "Could not retrieve URL for artifact file {0}", new Object[] {file}); // NOI18N } } } return ClassPathSupport.createClassPathImplementation(items); }
Example 2
Source File: JShellSourcePathTest.java From netbeans with Apache License 2.0 | 5 votes |
private void init(final FileObject workDir) throws IOException { src = FileUtil.createFolder( workDir, "src"); //NOI18N sourcesImpl = ClassPathSupport.createClassPathImplementation( Collections.singletonList(ClassPathSupport.createResource(src.toURL()))); sources = ClassPathFactory.createClassPath(sourcesImpl); boot = JavaPlatform.getDefault().getBootstrapLibraries(); compile = ClassPath.EMPTY; final MockClassPathProvider cpp = Lookup.getDefault().lookup(MockClassPathProvider.class); if (cpp == null) { throw new IllegalStateException("No ClasspathProvider"); //NOI18N } cpp.setUp(src, boot, compile, sources); }
Example 3
Source File: SourcePathTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testSourcePath () throws Exception { final File wd = this.getWorkDir(); final File cache = new File (wd,"cache"); //NOI18N cache.mkdir(); TestUtilities.setCacheFolder(cache); final File r1 = new File (wd,"root1"); //NOI18N r1.mkdir(); final File r2 = new File (wd,"root2"); //NOI18N r2.mkdir(); final ClassPathImplementation baseImpl = ClassPathSupport.createClassPathImplementation( Arrays.asList(new PathResourceImplementation[] { ClassPathSupport.createResource(Utilities.toURI(r1).toURL()), ClassPathSupport.createResource(Utilities.toURI(r2).toURL()) })); final ClassPath base = ClassPathFactory.createClassPath(baseImpl); final ClassPath sp1 = ClassPathFactory.createClassPath(SourcePath.filtered(baseImpl, true)); assertEquals (base,sp1); final ClassPath sp2 = ClassPathFactory.createClassPath(SourcePath.filtered(baseImpl, false)); assertTrue (sp2.entries().isEmpty()); ensureRootValid(base.entries().get(0).getURL()); assertEquals(1,sp2.entries().size()); assertEquals(base.entries().get(0).getURL(), sp2.entries().get(0).getURL()); ensureRootValid(base.entries().get(1).getURL()); assertEquals (base,sp2); final ClassPath sp3 = ClassPathFactory.createClassPath(SourcePath.filtered(baseImpl, false)); assertEquals (base,sp3); }
Example 4
Source File: RepositoryMavenCPProvider.java From netbeans with Apache License 2.0 | 5 votes |
private ClassPathImplementation createExecuteCPI(MavenProject project, File binary) { List<PathResourceImplementation> items = new ArrayList<PathResourceImplementation>(); items.add(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(binary))); if (project != null) { for (Artifact s : project.getRuntimeArtifacts()) { if (s.getFile() == null) continue; items.add(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(s.getFile()))); } } return ClassPathSupport.createClassPathImplementation(items); }
Example 5
Source File: RepositoryMavenCPProvider.java From netbeans with Apache License 2.0 | 4 votes |
private ClassPathImplementation createSourceCPI(File sourceFile) { return ClassPathSupport.createClassPathImplementation(Collections.singletonList(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(sourceFile)))); }