private static Element createLibraryElement(AntProjectHelper antProjectHelper, Document doc, String pathItem, Item item) { Element libraryElement = doc.createElementNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, TAG_LIBRARY); Element webFile = doc.createElementNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, TAG_FILE); libraryElement.appendChild(webFile); webFile.appendChild(doc.createTextNode("${" + pathItem + "}")); if (item.getAdditionalProperty(PATH_IN_DEPLOYMENT) != null) { Element pathInWar = doc.createElementNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, TAG_PATH_IN_WAR); pathInWar.appendChild(doc.createTextNode(item.getAdditionalProperty(PATH_IN_DEPLOYMENT))); libraryElement.appendChild(pathInWar); } AntProjectUtil.updateDirsAttributeInCPSItem(item, libraryElement); return libraryElement; }
private Boolean getShowItemAsIncludedInDeployment(ClassPathSupport.Item item) { Boolean result = Boolean.valueOf("true".equals(item.getAdditionalProperty(ClassPathSupportCallbackImpl.INCLUDE_IN_DEPLOYMENT))); return result; } }
private Boolean getShowItemAsIncludedInDeployment(ClassPathSupport.Item item) { return Boolean.valueOf("true".equals(item.getAdditionalProperty(ClassPathSupportCallbackImpl.INCLUDE_IN_DEPLOYMENT))); } }
/** * Updates the project helper with the list of classpath items which are to be * included in deployment. */ private static void putIncludedLibraries(List<Item> classpath, AntProjectHelper antProjectHelper, String includedLibrariesElement) { assert antProjectHelper != null; assert includedLibrariesElement != null; Element data = antProjectHelper.getPrimaryConfigurationData( true ); NodeList libs = data.getElementsByTagNameNS( AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE, includedLibrariesElement ); while ( libs.getLength() > 0 ) { Node n = libs.item( 0 ); n.getParentNode().removeChild( n ); } Document doc = data.getOwnerDocument(); //find a correcponding classpath item for the library for (ClassPathSupport.Item item : classpath) { if("true".equals(item.getAdditionalProperty(INCLUDE_IN_DEPLOYMENT))) { // NOI18N data.appendChild(createLibraryElement(antProjectHelper, doc, item, includedLibrariesElement)); } } antProjectHelper.putPrimaryConfigurationData( data, true ); }
/** * Updates the project helper with the list of classpath items which are to be * included in deployment. */ private static void putIncludedLibraries(List<ClassPathSupport.Item> classpath, AntProjectHelper antProjectHelper, String includedLibrariesElement ) { assert antProjectHelper != null; assert includedLibrariesElement != null; Element data = antProjectHelper.getPrimaryConfigurationData( true ); NodeList libs = data.getElementsByTagNameNS( EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, includedLibrariesElement ); while ( libs.getLength() > 0 ) { Node n = libs.item( 0 ); n.getParentNode().removeChild( n ); } Document doc = data.getOwnerDocument(); for (ClassPathSupport.Item item : classpath) { if("true".equals(item.getAdditionalProperty(INCLUDE_IN_DEPLOYMENT))) { // NOI18N XMLUtil.appendChildElement(data, createLibraryElement(antProjectHelper, doc, item, includedLibrariesElement), ejbjarElemOrder); } } antProjectHelper.putPrimaryConfigurationData( data, true ); }
@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; }
@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; }
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); }
public Object getValueAt(int row, int column) { if (column == 0) { return getItem(row); } else { return getItem(row).getAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT); } }
public Object getValueAt(int row, int column) { if (column == 0) { return getItem(row); } else { String pathInWar = getItem(row).getAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT); return (ClassPathSupportCallbackImpl.PATH_IN_WAR_LIB.equals(pathInWar) || ClassPathSupportCallbackImpl.PATH_IN_WAR_DIR.equals(pathInWar)) ? Boolean.TRUE : Boolean.FALSE; } }