internal void UpdateFolderBuildAction(JavaFolderNode folderNode, FolderBuildAction buildAction) { string existingBuildAction = folderNode.ItemNode.ItemName; if (string.IsNullOrEmpty(existingBuildAction)) { existingBuildAction = FolderBuildAction.Folder.ToString(); } if (string.Equals(existingBuildAction, buildAction.ToString())) { return; } if (buildAction == FolderBuildAction.Folder && !folderNode.ItemNode.IsVirtual && folderNode.ItemNode.Item.DirectMetadataCount == 0) { // remove <Folder /> elements from the project as long as they don't have any direct metadata (xml child elements) ProjectElement updatedElement = new ProjectElement(this, null, true); updatedElement.Rename(folderNode.ItemNode.Item.EvaluatedInclude); updatedElement.SetMetadata(ProjectFileConstants.Name, folderNode.ItemNode.Item.EvaluatedInclude); ProjectElement oldElement = folderNode.ItemNode; folderNode.ItemNode = updatedElement; oldElement.RemoveFromProjectFile(); } else if (!folderNode.ItemNode.IsVirtual) { folderNode.ItemNode.ItemName = buildAction.ToString(); } else { ProjectElement updatedElement = AddFolderToMSBuild(folderNode.VirtualNodeName, buildAction.ToString()); folderNode.ItemNode = updatedElement; } folderNode.Redraw(UIHierarchyElements.Icon); }