public static boolean isSpringLibrary(Library library) { if (!"j2se".equals(library.getType())) { //NOI18N return false; } return containsClass(library, SPRING_CLASS_NAME); }
public static boolean isSpringWebMVCLibrary(Library library) { if (!"j2se".equals(library.getType())) { //NOI18N return false; } return containsClass(library, SPRING_WEBMVC_CLASS_NAME); }
private Library getJAXRPCLibrary(LibraryManager libraryManager) { for (Library library : libraryManager.getLibraries()) { if (library.getType().equals("j2se")) { // NOI18N if (library.getName().equals("jaxrpc16")) { // NOI18N return library; } } } return null; }
/** * Gets array of all libraries of type "j2se". * @return array of all J2SE libraries */ public static Library[] getJavaLibraries() { List<Library> libraries = new LinkedList<Library>(); for (Library library : LibraryManager.getDefault().getLibraries()) { if (!"j2se".equals(library.getType())) { //NOI18N continue; } else { libraries.add(library); } } return libraries.toArray(new Library[libraries.size()]); }
@Override public boolean accept(Library library) { if ("javascript".equals(library.getType())) { //NOI18N return false; } try { library.getContent("classpath"); //NOI18N } catch (IllegalArgumentException ex) { return false; } return !library.getName().matches("jstl11|jaxrpc16|Spring|jaxws20|jaxb20|struts|jsf"); // NOI18N } };
public void initItem(ClassPathSupport.Item item) { if (item.getType() != ClassPathSupport.Item.TYPE_LIBRARY || !item.getLibrary().getType().equals(J2eePlatform.LIBRARY_TYPE)) { item.setAdditionalProperty(ClassPathSupportCallbackImpl.INCLUDE_IN_DEPLOYMENT, "true"); } } };
public void initItem(Item item) { if (item.getType() != ClassPathSupport.Item.TYPE_LIBRARY || !item.getLibrary().getType().equals(J2eePlatform.LIBRARY_TYPE)) { item.setAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT, "/"); //NOI18N } }
public void initItem(ClassPathSupport.Item item) { if (item.getType() != ClassPathSupport.Item.TYPE_LIBRARY || !item.getLibrary().getType().equals(J2eePlatform.LIBRARY_TYPE)) { item.setAdditionalProperty(ClassPathSupportCallbackImpl.INCLUDE_IN_DEPLOYMENT, "true"); } } };
private static void searchJsfLibraries() { for (Library library : LibraryManager.getDefault().getLibraries()) { // non j2se libraries if (!"j2se".equals(library.getType())) { //NOI18N continue; } // statically excluded libraries if (EXCLUDE_FROM_REGISTERED_LIBS.contains(library.getName())) { continue; } List<URL> content = library.getContent("classpath"); //NOI18N try { Boolean foundJsfLibrary = ClasspathUtil.containsClass(content, JSF_SEEKING_MAP); if (foundJsfLibrary != null && foundJsfLibrary) { JSF_LIBRARIES_CACHE.add(library); } } catch (IOException exception) { LOG.log(Level.INFO, "", exception); } } }
private ClassPath[] findClassPathOrNull(FileObject file, String type, Library lib) { if (lib.getType().equals(J2SELibraryTypeProvider.LIBRARY_TYPE)) { List<URL> resources = lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_SRC); ClassPath sourcePath = ClassPathSupport.createClassPath(resources.toArray(new URL[resources.size()])); FileObject root = sourcePath.findOwnerRoot(file); if (root != null) { setLastUsedLibrary(root, lib); if (ClassPath.SOURCE.equals(type)) { return new ClassPath[] {sourcePath}; } else if (ClassPath.COMPILE.equals(type)) { resources = lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_CLASSPATH); return new ClassPath[] {ClassPathSupport.createClassPath(resources.toArray(new URL[resources.size()]))}; } else if (ClassPath.BOOT.equals(type)) { return new ClassPath[] {ScalaPlatformManager.getDefault().getDefaultPlatform().getBootstrapLibraries()}; } else { return new ClassPath[] {null}; } } } return null; }
public SourceForBinaryQuery.Result findSourceRoots2 (URL binaryRoot) { SourceForBinaryQuery.Result res = cache.get(binaryRoot); if (res != null) { return res; } boolean isNormalizedURL = isNormalizedURL(binaryRoot); for (LibraryManager mgr : LibraryManager.getOpenManagers()) { for (Library lib : mgr.getLibraries()) { if (lib.getType().equals(J2SELibraryTypeProvider.LIBRARY_TYPE)) { for (URL entry : lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_CLASSPATH)) { URL normalizedEntry = entry; if (isNormalizedURL) { normalizedEntry = getNormalizedURL(normalizedEntry); } if (binaryRoot.equals(normalizedEntry)) { res = new Result(entry, lib); cache.put(binaryRoot, res); return res; } } } } } return null; }
Library[] libs = lm.getLibraries(); for (int i=0; i< libs.length; i++) { String type = libs[i].getType (); if (ComponentLibraryTypeProvider.LIBRARY_TYPE.equalsIgnoreCase(type)) {
@Override public void run() { // copy existing contents final String type = library.getType(); final String name = library.getName(); final String displayName = library.getDisplayName(); final String desc = library.getDescription(); Map<String, List<URI>> content = new HashMap<String, List<URI>>(); content.put("classpath", library.getURIContent("classpath")); //NOI18N content.put("src", library.getURIContent("src")); //NOI18N content.put("javadoc", library.getURIContent("javadoc")); //NOI18N // include references to maven-pom artifacts content.put("maven-pom", poms); //NOI18N try { LibraryManager.getDefault().removeLibrary(library); LibraryManager.getDefault().createURILibrary(type, name, displayName, desc, content); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } catch (IllegalArgumentException iae) { Exceptions.printStackTrace(iae); } } };
@org.netbeans.api.annotations.common.SuppressWarnings(value="DMI_BLOCKING_METHODS_ON_URL", justification="File URLs only") public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoot) { SourceForBinaryQueryImplementation2.Result res = cache.get(binaryRoot); if (res != null) { return res; } boolean isNormalizedURL = isNormalizedURL(binaryRoot); for (LibraryManager mgr : LibraryManager.getOpenManagers()) { for (Library lib : mgr.getLibraries()) { if (lib.getType().equals(ServerLibraryTypeProvider.LIBRARY_TYPE)) { for (String type : CLASSPATH_VOLUMES) { for (URL entry : lib.getContent(type)) { URL normalizedEntry = entry; if (isNormalizedURL) { normalizedEntry = getNormalizedURL(normalizedEntry); } if (binaryRoot.equals(normalizedEntry)) { res = new Result(entry, lib); cache.put(binaryRoot, res); return res; } } } } } } return null; }
public String getSourceLevel(org.openide.filesystems.FileObject javaFile) { Library ll = this.isLastUsed (javaFile); if (ll != null) { return getSourceLevel (ll); } for (LibraryManager mgr : LibraryManager.getOpenManagers()) { for (Library lib : mgr.getLibraries()) { if (!lib.getType().equals(J2SELibraryTypeProvider.LIBRARY_TYPE)) { continue; } List<URL> sourceRoots = lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_SRC); if (sourceRoots.isEmpty()) { continue; } ClassPath cp = ClassPathSupport.createClassPath(sourceRoots.toArray(new URL[sourceRoots.size()])); FileObject root = cp.findOwnerRoot(javaFile); if (root != null) { setLastUsedRoot(root, lib); return getSourceLevel(lib); } } } return null; }
public void initItem(ClassPathSupport.Item item) { switch (item.getType()) { case ClassPathSupport.Item.TYPE_JAR: item.setAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT, item.getResolvedFile().isDirectory() ? ClassPathSupportCallbackImpl.PATH_IN_WAR_DIR : ClassPathSupportCallbackImpl.PATH_IN_WAR_LIB); break; case ClassPathSupport.Item.TYPE_LIBRARY: if (item.getLibrary().getType().equals(J2eePlatform.LIBRARY_TYPE)) { break; } item.setAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT, Utils.isLibraryDirectoryBased(item) ? ClassPathSupportCallbackImpl.PATH_IN_WAR_DIR : ClassPathSupportCallbackImpl.PATH_IN_WAR_LIB); break; default: item.setAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT, ClassPathSupportCallbackImpl.PATH_IN_WAR_LIB); } } };
for (LibraryManager mgr : LibraryManager.getOpenManagers()) { for (Library lib : mgr.getLibraries()) { if (!lib.getType().equals(J2SELibraryTypeProvider.LIBRARY_TYPE)) { continue;
if (val instanceof Library) { Library lib = (Library) val; String type = lib.getType(); LibraryTypeProvider provider = LibrariesSupport.getLibraryTypeProvider(type); assert provider != null;
for (LibraryManager mgr : LibraryManager.getOpenManagers()) { for (Library lib : mgr.getLibraries()) { if (!lib.getType().equals(ServerLibraryTypeProvider.LIBRARY_TYPE)) { continue;
if (!"j2se".equals(library.getType())) {//NOI18N