if ( ((ClassPathSupport.Item)it.next()).isBroken() ) { broken = true; break;
private List<ClassPathSupport.Item> filterBrokenLibraryItems(List<ClassPathSupport.Item> items) { List<ClassPathSupport.Item> toRemove = new LinkedList<ClassPathSupport.Item>(); Collection<? extends BrokenLibraryRefFilter> filters = null; for (ClassPathSupport.Item item : items) { if (!item.isBroken() || item.getType() != ClassPathSupport.Item.TYPE_LIBRARY) { continue; } String libraryName = ClassPathSupport.getLibraryNameFromReference(item.getReference()); LOGGER.log(Level.FINE, "Broken reference to library: " + libraryName); if (filters == null) { // initializing the filters lazily because usually they will not be needed anyway // (most projects have no broken references) filters = createFilters(WebProject.this); } for (BrokenLibraryRefFilter filter : filters) { if (filter.removeLibraryReference(libraryName)) { LOGGER.log(Level.FINE, "Will remove broken reference to library " + libraryName + " because of filter " + filter.getClass().getName()); toRemove.add(item); break; } } } return toRemove; }
if ( ((ClassPathSupport.Item)it.next()).isBroken() ) { broken = true; break;
Collection<File> files = new ArrayList<File>(); if (!item.isBroken()) { if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { path = artifactItem.getDescription().getPathInDeployment();
if ( ((ClassPathSupport.Item)it.next()).isBroken() ) { broken = true; break;
if ( ((ClassPathSupport.Item)it.next()).isBroken() ) { broken = true; break;
@Override public List<ArtifactCopyOnSaveSupport.Item> getArtifacts() { final AntProjectHelper helper = getAntProjectHelper(); ClassPathSupport cs = new ClassPathSupport(evaluator(), getReferenceHelper(), helper, getUpdateHelper(), new ClassPathSupportCallbackImpl(helper)); List<ArtifactCopyOnSaveSupport.Item> result = new ArrayList<ArtifactCopyOnSaveSupport.Item>(); for (ClassPathSupport.Item item : cs.itemsList( helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH).getProperty(ProjectProperties.JAVAC_CLASSPATH), ClassPathSupportCallbackImpl.ELEMENT_INCLUDED_LIBRARIES)) { if (!item.isBroken() && (item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT || item.getType() == ClassPathSupport.Item.TYPE_LIBRARY || item.getType() == ClassPathSupport.Item.TYPE_LIBRARY)) { String included = item.getAdditionalProperty(ClassPathSupportCallbackImpl.INCLUDE_IN_DEPLOYMENT); String dirs = item.getAdditionalProperty(AntProjectConstants.DESTINATION_DIRECTORY); if (Boolean.parseBoolean(included)) { result.add(new Item(item, new ItemDescription("", RelocationType.fromString(dirs)))); } } } return result; }
@Override public List<ArtifactCopyOnSaveSupport.Item> getArtifacts() { final AntProjectHelper helper = getAntProjectHelper(); ClassPathSupport cs = new ClassPathSupport(evaluator(), getReferenceHelper(), helper, getUpdateHelper(), new ClassPathSupportCallbackImpl(helper)); List<ArtifactCopyOnSaveSupport.Item> result = new ArrayList<ArtifactCopyOnSaveSupport.Item>(); for (ClassPathSupport.Item item : cs.itemsList( helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH).getProperty(ProjectProperties.JAVAC_CLASSPATH), WebProjectProperties.TAG_WEB_MODULE_LIBRARIES)) { if (!item.isBroken() && (item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT || item.getType() == ClassPathSupport.Item.TYPE_LIBRARY || item.getType() == ClassPathSupport.Item.TYPE_JAR)) { String path = item.getAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT); String dirs = item.getAdditionalProperty(AntProjectConstants.DESTINATION_DIRECTORY); if (path != null) { result.add(new Item(item, new ItemDescription(path, RelocationType.fromString(dirs)))); } } } return result; }
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()); } } } }
public static void updateDirsAttributeInCPSItem(org.netbeans.modules.java.api.common.classpath.ClassPathSupport.Item item, Element element) { String dirs = item.getAdditionalProperty(AntProjectConstants.DESTINATION_DIRECTORY); if (dirs == null) { dirs = AntProjectConstants.DESTINATION_DIRECTORY_LIB; if (item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT && !item.isBroken()) { if (item.getArtifact() != null && item.getArtifact().getProject() != null && item.getArtifact().getProject().getLookup().lookup(J2eeModuleProvider.class) != null) { dirs = AntProjectConstants.DESTINATION_DIRECTORY_ROOT; } } } element.setAttribute("dirs", dirs); }