Java Code Examples for org.netbeans.api.java.classpath.ClassPath#EXECUTE
The following examples show how to use
org.netbeans.api.java.classpath.ClassPath#EXECUTE .
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: OpenAction.java From netbeans with Apache License 2.0 | 6 votes |
@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)); }
Example 2
Source File: ScriptClassPathProvider.java From netbeans with Apache License 2.0 | 6 votes |
@Override public ClassPath findClassPath(FileObject fo, String type) { if ("classpath/html5".equals(type)) { return null; } boolean isGradle = "gradle".equals(fo.getExt()); if (fo.isFolder() && (FileUtil.toFile(fo) != null)) { isGradle = GradleProjects.testForProject(FileUtil.toFile(fo)); } if (isGradle) { switch (type) { case ClassPath.BOOT: return BOOT_CP; case ClassPath.SOURCE: return SOURCE_CP; case ClassPath.COMPILE: return GRADLE_CP; case ClassPath.EXECUTE: return GRADLE_CP; } } return null; }
Example 3
Source File: GlobalClassPathProviderImpl.java From netbeans with Apache License 2.0 | 6 votes |
private ClassPath getClassPath(String type, boolean excludeTests) { int index = type2Index(type, excludeTests); if (index < 0) return null; ClassPath cp = cache[index]; if (cp == null) { switch (type) { case ClassPath.BOOT: cp = createClassPath(new BootClassPathImpl(project)); break; case ClassPath.SOURCE: cp = createClassPath(new GradleGlobalClassPathImpl.ProjectSourceClassPathImpl(project, excludeTests)); break; case ClassPath.COMPILE: cp = createClassPath(new GradleGlobalClassPathImpl.ProjectCompileClassPathImpl(project, excludeTests)); break; case ClassPath.EXECUTE: cp = createClassPath(new GradleGlobalClassPathImpl.ProjectRuntimeClassPathImpl(project, excludeTests)); break; } cache[index] = cp; } return cp; }
Example 4
Source File: GlobalClassPathProviderImpl.java From netbeans with Apache License 2.0 | 6 votes |
private static int type2Index(String type, boolean excludeTests) { int index; switch (type) { case ClassPath.BOOT: index = BOOT; break; case ClassPath.SOURCE: index = SOURCE; break; case ClassPath.COMPILE: index = COMPILE; break; case ClassPath.EXECUTE: index = RUNTIME; break; default: index = -1; } return (index >= 0) && excludeTests ? index + 1 : index; }
Example 5
Source File: HintTestBase.java From netbeans with Apache License 2.0 | 6 votes |
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; }
Example 6
Source File: JaxRsStackSupportImpl.java From netbeans with Apache License 2.0 | 6 votes |
private void removeLibraries(Project project, Collection<URL> urls) { if ( urls.size() >0 ){ SourceGroup[] sourceGroups = ProjectUtils.getSources(project).getSourceGroups( JavaProjectConstants.SOURCES_TYPE_JAVA); if (sourceGroups == null || sourceGroups.length < 1) { return; } FileObject sourceRoot = sourceGroups[0].getRootFolder(); String[] classPathTypes = new String[]{ ClassPath.COMPILE , ClassPath.EXECUTE }; for (String type : classPathTypes) { try { ProjectClassPathModifier.removeRoots(urls.toArray( new URL[ urls.size()]), sourceRoot, type); } catch(UnsupportedOperationException ex) { Logger.getLogger( JaxRsStackSupportImpl.class.getName() ). log (Level.INFO, null , ex ); } catch( IOException e ){ Logger.getLogger( JaxRsStackSupportImpl.class.getName() ). log(Level.INFO, null , e ); } } } }
Example 7
Source File: SourceUtilsTestUtil.java From netbeans with Apache License 2.0 | 5 votes |
public ClassPath findClassPath(FileObject file, String type) { try { if (ClassPath.BOOT == type) { return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0])); } if (JavaClassPathConstants.MODULE_BOOT_PATH == type) { return BootClassPathUtil.getModuleBootPath(); } if (ClassPath.SOURCE == type) { return sourcePath; } 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; }
Example 8
Source File: CPExtender.java From netbeans with Apache License 2.0 | 5 votes |
@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 }; }
Example 9
Source File: ClassPathModifier.java From netbeans with Apache License 2.0 | 5 votes |
@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, }; }
Example 10
Source File: ComputeOverridersTest.java From netbeans with Apache License 2.0 | 5 votes |
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; }
Example 11
Source File: HintTest.java From netbeans with Apache License 2.0 | 5 votes |
public ClassPath findClassPath(FileObject file, String type) { try { if (ClassPath.BOOT == type) { return BootClassPathUtil.getBootClassPath(); } if (JavaClassPathConstants.MODULE_BOOT_PATH == type) { return BootClassPathUtil.getModuleBootPath(); } 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; }
Example 12
Source File: IdeJaxRsSupportImpl.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void removeJaxRsLibraries( Project project ) { List<Library> libraries = new ArrayList<Library>(2); Library swdpLibrary = LibraryManager.getDefault().getLibrary(SWDP_LIBRARY); if (swdpLibrary != null) { libraries.add( swdpLibrary ); } Library restapiLibrary = LibraryManager.getDefault().getLibrary(RESTAPI_LIBRARY); if (restapiLibrary != null) { libraries.add( restapiLibrary ); } SourceGroup[] sgs = ProjectUtils.getSources(project).getSourceGroups( JavaProjectConstants.SOURCES_TYPE_JAVA); FileObject sourceRoot = sgs[0].getRootFolder(); String[] classPathTypes = new String[]{ ClassPath.COMPILE , ClassPath.EXECUTE }; for (String type : classPathTypes) { try { ProjectClassPathModifier.removeLibraries(libraries.toArray( new Library[ libraries.size()]), sourceRoot, type); } catch(UnsupportedOperationException ex) { Logger.getLogger( IdeJaxRsSupportImpl.class.getName() ).log( Level.INFO, null , ex ); } catch( IOException e ){ Logger.getLogger( IdeJaxRsSupportImpl.class.getName() ).log( Level.INFO, null , e ); } } }
Example 13
Source File: MultiModuleClassPathProvider.java From netbeans with Apache License 2.0 | 4 votes |
@Override public String[] getPropertyName (SourceGroup sg, String type) { FileObject root = sg.getRootFolder(); final Owner fOwner = getOwner(root); if (fOwner == null) { return null; } else if (fOwner.isTest()) { switch (type) { case ClassPath.COMPILE: return testJavacClassPath; case ClassPath.EXECUTE: return testExecuteClassPath; case JavaClassPathConstants.PROCESSOR_PATH: return testProcessorClassPath; case JavaClassPathConstants.MODULE_COMPILE_PATH: return testModulePath; case JavaClassPathConstants.MODULE_PROCESSOR_PATH: return testProcessorModulePath; case JavaClassPathConstants.MODULE_EXECUTE_PATH: return testExecuteModulePath; default: return null; } } else { switch (type) { case ClassPath.COMPILE: return javacClassPath; case ClassPath.EXECUTE: return executeClassPath; case JavaClassPathConstants.PROCESSOR_PATH: return processorClassPath; case JavaClassPathConstants.MODULE_COMPILE_PATH: return modulePath; case JavaClassPathConstants.MODULE_PROCESSOR_PATH: return processorModulePath; case JavaClassPathConstants.MODULE_EXECUTE_PATH: return executeModulePath; default: return null; } } }
Example 14
Source File: ClassPathProviderImpl.java From netbeans with Apache License 2.0 | 4 votes |
@Override public String[] getPropertyName (SourceGroup sg, String type) { if (ClassPathSupport.ENDORSED.equals(type)) { return endorsedClasspath; } FileObject root = sg.getRootFolder(); FileObject[] path = getPrimarySrcPath(); for (int i=0; i<path.length; i++) { if (root.equals(path[i])) { switch (type) { case ClassPath.COMPILE: return javacClasspath; case ClassPath.EXECUTE: return runClasspath; case JavaClassPathConstants.PROCESSOR_PATH: return processorClasspath; case JavaClassPathConstants.MODULE_COMPILE_PATH: return modulePath; case JavaClassPathConstants.MODULE_EXECUTE_PATH: return moduleExecutePath; case JavaClassPathConstants.MODULE_PROCESSOR_PATH: return processorModulePath; default: return null; } } } path = getTestSrcDir(); for (int i=0; i<path.length; i++) { if (root.equals(path[i])) { switch (type) { case ClassPath.COMPILE: return javacTestClasspath; case ClassPath.EXECUTE: return runTestClasspath; case JavaClassPathConstants.PROCESSOR_PATH: return processorTestClasspath; case JavaClassPathConstants.MODULE_COMPILE_PATH: return testModulePath; case JavaClassPathConstants.MODULE_EXECUTE_PATH: return moduleExecutePath; case JavaClassPathConstants.MODULE_PROCESSOR_PATH: return processorTestModulepath; default: return null; } } } return null; }