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 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; }
@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 static Library findJSTLibrary() { // see Issue #169105 - first try "pure" JSTL, if there isn't any then bundled JSTL will suffice for (Library library : getJavaLibraries()) { if (library.getName().startsWith("jstl")) { return library; } } return getLibrary(JSTL_CLASS_NAME); }
public static String createListOfJsLibraries(List<SelectedLibrary> libs) { StringBuilder sb = new StringBuilder(200); List<SelectedLibrary> selectedLibraries = libs; for (SelectedLibrary lib : selectedLibraries) { if (lib.isDefault()) { continue; } if (sb.length() > 0) { sb.append("|"); // NOI18N } JavaScriptLibrarySelectionPanel.LibraryVersion libraryVersion = lib.getLibraryVersion(); assert libraryVersion != null; sb.append(libraryVersion.getLibrary().getName()); } return sb.toString(); }
OCL ocl = OCL.newInstance(new PivotEnvironmentFactory()); OCLHelper helper = ocl.createOCLHelper(EXTLibraryPackage.Literals.LIBRARY); ExpressionInOCL invariant = helper.createInvariant( "books->forAll(b1, b2 | b1 <> b2 implies b1.title <> b2.title)"); ExpressionInOCL query = helper.createQuery( "books->collect(b : Book | b.category)->asSet()"); // create a Query to evaluate our query expression Query queryEval = ocl.createQuery(query); // create another to check our constraint Query constraintEval = ocl.createQuery(invariant); List<Library> libraries = getLibraries(); // hypothetical source of libraries // only print the set of book categories for valid libraries for (Library next : libraries) { if (constraintEval.check(next)) { // the OCL result type of our query expression is Set(BookCategory) @SuppressWarnings("unchecked") Set<BookCategory> categories = (Set<BookCategory>) queryEval.evaluate(next); System.out.printf("%s: %s%n", next.getName(), categories); } }
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(); }
int length = jsfLibraries.size(); for (int i = 0; i < length; i++) { if(jsfLibraries.get(i).getName().equals(name)){ message = NbBundle.getMessage(JSFConfigurationPanelVisual.class, "MSG_VersionAlreadyExist");
/** * 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; } } } }
protected void readFromDataModel() { libraryNameVale.setText(this.data.getLibrary().getName()); libraryDisplayNameValue.setText(this.data.getLibrary().getDisplayName()); checkValidity(getTemporaryDataModel()); }
private void selectLibrary(Collection<Library> libraries) { Node root = explorer.getRootContext(); List<Node> selection = new ArrayList<Node>(); for (Library lib : libraries) { String[] path = {lib.getManager().getDisplayName(), lib.getName()}; try { Node node = NodeOp.findPath(root, path); if (node != null) { selection.add(node); } } catch (NodeNotFoundException e) { //Ignore it } } try { explorer.setSelectedNodes(selection.toArray(new Node[selection.size()])); } catch (PropertyVetoException e) { //Ignore it } }
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 static void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private static void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private static void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
@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); } } };
LibraryNode (@NonNull final Library lib) { super(Children.LEAF, Lookups.singleton(lib)); setName(lib.getName()); setDisplayName(lib.getDisplayName()); setShortDescription(lib.getDescription()); setIconBaseWithExtension("org/netbeans/modules/project/libraries/resources/libraries.gif"); // NOI18N }
project.getOriginalMavenProject(), model, result[1], true); if (reposit != null) { reposit.setId(library.getName()); reposit.setLayout(result[0]); reposit.setName("Repository for library " + library);