Пример #1
0
void CppCheckPlugin::OnCheckProjectItem(wxCommandEvent& e)
{
    if ( m_cppcheckProcess ) {
        wxLogMessage(_("CppCheckPlugin: CppCheck is currently busy please wait for it to complete the current check"));
        return;
    }

    ProjectPtr proj = FindSelectedProject();
    if ( !proj ) {
        return;
    }

    // retrieve complete list of source files of the workspace
    std::vector< wxFileName > tmpfiles;
    proj->GetFiles(tmpfiles, true);

    // only C/C++ files
    for (size_t i=0; i< tmpfiles.size(); i++) {
        if (FileExtManager::GetType(tmpfiles.at(i).GetFullPath()) == FileExtManager::TypeSourceC ||
            FileExtManager::GetType(tmpfiles.at(i).GetFullPath()) == FileExtManager::TypeSourceCpp) {
            m_filelist.Add(tmpfiles.at(i).GetFullPath());
        }
    }
        
    DoStartTest(proj);
}
Пример #2
0
void CppCheckPlugin::OnCheckWorkspaceItem(wxCommandEvent& e)
{
    if(m_cppcheckProcess) {
        clLogMessage(_("CppCheckPlugin: CppCheck is currently busy please wait for it to complete the current check"));
        return;
    }

    if(!m_mgr->GetWorkspace() || !m_mgr->IsWorkspaceOpen()) { return; }

    TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileView);
    if(item.m_itemType == ProjectItem::TypeWorkspace) {

        // retrieve complete list of source files of the workspace
        wxArrayString projects;
        wxString err_msg;
        std::vector<wxFileName> tmpfiles;
        m_mgr->GetWorkspace()->GetProjectList(projects);

        for(size_t i = 0; i < projects.GetCount(); i++) {
            ProjectPtr proj = m_mgr->GetWorkspace()->FindProjectByName(projects.Item(i), err_msg);
            if(proj) { proj->GetFilesAsVectorOfFileName(tmpfiles); }
        }

        // only C/C++ files
        for(size_t i = 0; i < tmpfiles.size(); i++) {
            if(FileExtManager::GetType(tmpfiles.at(i).GetFullPath()) == FileExtManager::TypeSourceC ||
               FileExtManager::GetType(tmpfiles.at(i).GetFullPath()) == FileExtManager::TypeSourceCpp) {
                m_filelist.Add(tmpfiles.at(i).GetFullPath());
            }
        }
    }
    DoStartTest();
}
Пример #3
0
void CppCheckPlugin::OnCheckFileEditorItem(wxCommandEvent& e)
{
    if(m_cppcheckProcess) {
        clLogMessage(_("CppCheckPlugin: CppCheck is currently busy please wait for it to complete the current check"));
        return;
    }

    ProjectPtr proj;
    IEditor* editor = m_mgr->GetActiveEditor();
    if(editor) {
        wxString projectName = editor->GetProjectName();
        if(!projectName.IsEmpty()) { proj = clCxxWorkspaceST::Get()->GetProject(projectName); }
        m_filelist.Add(editor->GetFileName().GetFullPath());
    }

    DoStartTest();
}
Пример #4
0
void CppCheckPlugin::OnCheckFileExplorerItem(wxCommandEvent& e)
{
    if ( m_cppcheckProcess ) {
        wxLogMessage(_("CppCheckPlugin: CppCheck is currently busy please wait for it to complete the current check"));
        return;
    }

    TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileExplorer);
    for(size_t i=0; i<item.m_paths.GetCount(); ++i) {
        if ( wxDir::Exists(item.m_paths.Item(i)) ) {
            // directory
            GetFileListFromDir( item.m_paths.Item(i) );
        } else {
            // filename
            m_filelist.Add( item.m_paths.Item(i) );
        }
    }
    DoStartTest();
}