Refine search
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); } } }
@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); } } };
public Result (URL queryFor, Library lib) { this.entry = queryFor; this.lib = lib; this.lib.addPropertyChangeListener(WeakListeners.propertyChange(this, this.lib)); }
@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 } };
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; }
List<FileObject> classpath = Arrays.asList(roots); List<String> libs = new LinkedList<String>(); for (Library library : LibraryManager.getDefault().getLibraries()) { List<java.net.URL> urls = library.getContent("classpath"); // NOI18N if (urls.size() > 0) { boolean contained = true; libs.add(library.getName()); if (rh.getProjectLibraryManager().getLibrary(libName) == null) { rh.copyLibrary(LibraryManager.getDefault().getLibrary(libName));
private static URL[] getLocaleRoots(Project project, String[] libNames) throws IOException { ArrayList<URL> list = new ArrayList<URL>(); for (String libName: libNames) { Library lib = LibraryManager.getDefault().getLibrary(libName); if (lib == null) { continue; } List<URL> ulist = lib.getContent("classpath"); // NOI18N for (URL url: ulist) { if (!"jar".equals(url.getProtocol())) { continue; } url = FileUtil.getArchiveFile(url); String name = url.getPath(); int index = name.lastIndexOf("/"); // exclude first slash: name = name.substring(1, index) + "/locale" + name.substring(index); // NOI18N File f = InstalledFileLocator.getDefault().locate(name, null, true); if (f != null) { list.add(FileUtil.getArchiveRoot(FileUtil.toFileObject(f)).getURL()); } } } return list.toArray(new URL[list.size()]); }
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; }
File mainPropertiesFile = helper.resolveFile(loc); try { LibraryManager man = LibraryManager.forLocation(Utilities.toURI(mainPropertiesFile).toURL()); Map<String, List<URI>> volumes = new HashMap<String, List<URI>>(); LibraryTypeProvider provider = LibrariesSupport.getLibraryTypeProvider(library.getType()); assert provider != null; for (String volume : provider.getSupportedVolumeTypes()) { List<URL> urls = library.getContent(volume); List<URI> newurls = new ArrayList<URI>(); for (URL url : urls) { if (man.getLibrary(library.getName())!=null) { errMsg = ERR_LibraryExists(library.getDisplayName()); } else { final String name = library.getName(); String displayName = library.getDisplayName(); if (name.equals(displayName)) { man.createURILibrary( library.getType(), name, displayName, library.getDescription(), volumes);
private String[] getLibrariesDN() { List<String> res = new ArrayList<String>(); for (String name : SUPPORTED_PU_LIBRARIES) { Library l = LibraryManager.getDefault().getLibrary(name); Logger.getLogger(SampleAppWizardExtraVisual.class.getName()).log(Level.FINE, "Name {0} has library {1}", new Object[]{name, l}); if (l != null) { res.add(l.getDisplayName()); dn2lib.put(l.getDisplayName(), l); } } return res.toArray(new String[0]); }
private synchronized static boolean addLibrary(String name, String libType, List<URL> libraryList, List<URL> docList, String displayName, String description) { LibraryManager lmgr = LibraryManager.getDefault(); Library lib = lmgr.getLibrary(name); List<URL> libList = lib.getContent(CLASSPATH_VOLUME); size = libList.size(); for (URL libUrl : libList) { Logger.getLogger("glassfish-javaee").log(Level.FINE, "libPath does not exist. Updating {0}", name); try { lmgr.removeLibrary(lib); } catch (IOException ex) { Logger.getLogger("glassfish-javaee").log(Level.INFO, ex.getLocalizedMessage(), ex); List<URL> libList = lib.getContent(JAVADOC_VOLUME); size = libList.size(); for (URL libUrl : libList) {
private void initLibraries(){ Library libraries[] = LibraryManager.getDefault().getLibraries(); Vector <String> items = new Vector(); jsfLibraries = new ArrayList(); for (int i = 0; i < libraries.length; i++) { if (libraries[i].getName().startsWith("JSF-") || libraries[i].getName().equals("jsf12")) { //NOI18N String displayName = libraries[i].getDisplayName(); items.add(displayName); jsfLibraries.add(libraries[i]); } } cbLibraries.setModel(new DefaultComboBoxModel(items)); if (items.size() == 0){ rbRegisteredLibrary.setEnabled(false); cbLibraries.setEnabled(false); rbNewLibrary.setSelected(true); panel.setLibrary(null); } else { rbRegisteredLibrary.setEnabled(true); rbRegisteredLibrary.setSelected(true); cbLibraries.setEnabled(true); } repaint(); }
public void run() { Library lib = refHelper.getProjectLibraryManager().getLibrary("CopyLibs"); if (lib == null) { try { refHelper.copyLibrary(LibraryManager.getDefault().getLibrary("CopyLibs")); // NOI18N } catch (IOException ex) { Exceptions.printStackTrace(ex); List<URL> roots = lib.getContent("classpath"); // NOI18N
/** * Remove an existing library definition * @param name Internal name of the existing library from which the library definition file name * will be derived. * @throws IOException if the library definition does not already exist */ public static void remove(String name) throws IOException { LibraryManager manager = LibraryManager.getDefault(); Library[] libs = manager.getLibraries(); for (int i = 0; i < libs.length; i++) { if (libs[i].getName().equals(name)) { manager.removeLibrary(libs[i]); return; } } } }
private String getSourceLevel (Library lib) { String slevel = sourceLevelCache.get(lib); if (slevel == null) { slevel = getSourceLevel(lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_CLASSPATH)); this.sourceLevelCache.put (lib,slevel); } return slevel == JDK_UNKNOWN ? null : slevel; }
/** * 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()]); }
final File libBaseFolder = new File(URI.create(location.toExternalForm())).getParentFile(); final Map<String, List<URI>> content = new HashMap<String, List<URI>>(); String[] volumes = LibrariesSupport.getLibraryTypeProvider(lib.getType()).getSupportedVolumeTypes(); for (String volume : volumes) { List<URI> volumeContent = new ArrayList<URI>(); for (URL origlibEntry : lib.getContent(volume)) { URL libEntry = origlibEntry; String jarFolder = null; "Library '{0}' contains entry ({1}) which does not exist. " // NOI18N + "This entry is ignored and will not be refernced from sharable " // NOI18N + "libraries.", new Object[]{lib.getDisplayName(), libEntry}); // NOI18N continue; final LibraryManager man = LibraryManager.forLocation(location); try { return ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Library>() {
public boolean accept(Library library) { return manager.getLibrary(library.getName()) == null; } }
@Override public int compare(Library l1, Library l2) { String name1 = l1.getName().toLowerCase(); String name2 = l2.getName().toLowerCase(); if (name1.equals(name2)) { return 0; } else if (name1.equals("junit")) { //NOI18N return -1; } else if (name2.equals("junit")) { //NOI18N return 1; } final String[] parts1 = name1.substring(5).split("_|\\W"); //NOI18N final String[] parts2 = name2.substring(5).split("_|\\W"); //NOI18N final int min = Math.min(parts1.length, parts2.length); for (int i = 0; i < min; i++) { int partCmp = parts1[i].compareTo(parts2[i]); if (partCmp != 0) { return partCmp; } } return parts2.length - parts1.length; } }
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; }