void PHPWorkspaceView::DoAddFolderFiles(const wxString& project, const wxString& folder, const wxTreeItemId& folderTreeItemId, wxStringSet_t* filesAdded) { PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(project); CHECK_PTR_RET(pProject); PHPFolder::Ptr_t pFolder = pProject->Folder(folder); CHECK_PTR_RET(pFolder); wxArrayString files; pFolder->GetFiles(files, pProject->GetFilename().GetPath()); files.Sort(); for(size_t i = 0; i < files.GetCount(); ++i) { wxFileName fn(files.Item(i)); // create the user data ItemData* itemData = new ItemData(ItemData::Kind_File); itemData->SetFile(fn.GetFullPath()); itemData->SetFolderPath(folder); itemData->SetProjectName(project); int imgId = DoGetItemImgIdx(fn.GetFullName()); m_treeCtrlView->AppendItem(folderTreeItemId, fn.GetFullName(), imgId, imgId, itemData); if(filesAdded) { filesAdded->insert(fn.GetFullPath()); } } }
void PHPWorkspaceView::DoAddFolder(const wxTreeItemId& parent, PHPFolder::Ptr_t folder, PHPProject::Ptr_t project) { // add the folder itself ItemData* itemData = new ItemData(ItemData::Kind_Folder); itemData->SetFolderPath(folder->GetPathRelativeToProject()); itemData->SetProjectName(project->GetName()); itemData->SetFolderName(folder->GetName()); // display name wxTreeItemId folderItem = EnsureFolderExists( DoGetProjectItem(project->GetName()), folder->GetPathRelativeToProject(), project->GetName()); // Get list of folders const PHPFolder::List_t& children = folder->GetChildren(); PHPFolder::List_t::const_iterator iter = children.begin(); for(; iter != children.end(); ++iter) { DoAddFolder(folderItem, *iter, project); } wxArrayString folderFiles; folder->GetFiles(folderFiles, project->GetFilename().GetPath(), 0); // Add the files for(size_t i = 0; i < folderFiles.GetCount(); ++i) { ItemData* itemData = new ItemData(ItemData::Kind_File); itemData->SetFile(folderFiles.Item(i)); itemData->SetProjectName(project->GetName()); itemData->SetFolderPath(folder->GetPathRelativeToProject()); int imgId = DoGetItemImgIdx(folderFiles.Item(i)); m_treeCtrlView->AppendItem(folderItem, wxFileName(folderFiles.Item(i)).GetFullName(), imgId, imgId, itemData); } }
void PHPFolder::DeleteChildFolder(const wxString& name, const wxString& projectPath, bool notify) { PHPFolder::Ptr_t folder = Folder(name); CHECK_PTR_RET(folder); wxArrayString files; folder->GetFiles(files, projectPath); // iter is valid (otherwise, folder would have been NULL) PHPFolder::List_t::iterator iter = std::find_if(m_children.begin(), m_children.end(), PHPFolder::CompareByName(name)); m_children.erase(iter); if(notify) { DoNotifyFilesRemoved(files); } }