コード例 #1
0
void EditConfigurationDialog::RenameConfiguration(const wxString &oldName, const wxString &newName)
{
	ProjectSettingsPtr settings = ManagerST::Get()->GetProjectSettings(m_projectName);
	if(settings){
		BuildConfigPtr bldConf = settings->GetBuildConfiguration(oldName);
		if(bldConf){
			settings->RemoveConfiguration(oldName);
			bldConf->SetName(newName);
			settings->SetBuildConfiguration(bldConf);
			//save changes
			ManagerST::Get()->SetProjectSettings(m_projectName, settings);

			//update the control
			m_configurationsList->Clear();
			ProjectSettingsCookie cookie;
			BuildConfigPtr bldConf = settings->GetFirstBuildConfiguration(cookie);
			while(bldConf){
				m_configurationsList->Append(bldConf->GetName());
				bldConf = settings->GetNextBuildConfiguration(cookie);
			}
			if(m_configurationsList->GetCount()>0)
				m_configurationsList->SetSelection(0);
		}
	}
}
コード例 #2
0
ファイル: workspace.cpp プロジェクト: capturePointer/codelite
BuildConfigPtr clCxxWorkspace::GetProjBuildConf(const wxString& projectName, const wxString& confName) const
{
    BuildMatrixPtr matrix = GetBuildMatrix();
    if(!matrix) {
        return NULL;
    }

    wxString projConf(confName);

    if(projConf.IsEmpty()) {
        wxString workspaceConfig = matrix->GetSelectedConfigurationName();
        projConf = matrix->GetProjectSelectedConf(workspaceConfig, projectName);
    }

    // Get the project setting and retrieve the selected configuration
    wxString errMsg;
    ProjectPtr proj = FindProjectByName(projectName, errMsg);
    if(proj) {
        ProjectSettingsPtr settings = proj->GetSettings();
        if(settings) {
            return settings->GetBuildConfiguration(projConf, true);
        }
    }
    return NULL;
}
コード例 #3
0
void OutputPane::OnBuildWindowDClick(const wxString &line, int lineno)
{
	wxString fileName, strLineNumber;
	bool match = false;

	//get the selected compiler for the current line that was DClicked
	if(lineno >= (int)m_buildLineInfo.GetCount()){
		return;
	}

	//find the project selected build configuration for the workspace selected
	//configuration
	wxString projectName = m_buildLineInfo.Item(lineno);
	
	if(projectName.IsEmpty())
		return;
		
	BuildMatrixPtr matrix = ManagerST::Get()->GetWorkspaceBuildMatrix();
	wxString projecBuildConf = matrix->GetProjectSelectedConf(matrix->GetSelectedConfigurationName(), 
																				 projectName	);
	ProjectSettingsPtr settings = ManagerST::Get()->GetProject(projectName)->GetSettings();
	if(!settings)
	{
		return;
	}
	
	BuildConfigPtr  bldConf = settings->GetBuildConfiguration(projecBuildConf);
	if( !bldConf )
	{
		return;
	}
	
	wxString cmpType = bldConf->GetCompilerType();
	CompilerPtr cmp = BuildSettingsConfigST::Get()->GetCompiler(cmpType);
	if( !cmp )
	{
		return;
	}
	
	long idx;
	//try to match an error pattern to the line
	RegexProcessor re(cmp->GetErrPattern());
	cmp->GetErrFileNameIndex().ToLong(&idx);
	if(re.GetGroup(line, idx, fileName))
	{
		//we found the file name, get the line number
		cmp->GetErrLineNumberIndex().ToLong(&idx);
		re.GetGroup(line, idx, strLineNumber);
		match = true;
	}

	//try to match warning pattern
	if(!match)
	{
		RegexProcessor re(cmp->GetWarnPattern());
		cmp->GetWarnFileNameIndex().ToLong(&idx);
		if(re.GetGroup(line, idx, fileName))
		{
			//we found the file name, get the line number
			cmp->GetWarnLineNumberIndex().ToLong(&idx);
			re.GetGroup(line, idx, strLineNumber);
			match = true;
		}
	}

	if(match)
	{
		long lineNumber = -1;
		strLineNumber.ToLong(&lineNumber);

		// open the file in the editor
		// get the project name that is currently being built
		wxString projName(wxEmptyString);
		if(lineno < (int)m_buildLineInfo.GetCount())
		{
			projName = m_buildLineInfo.Item(lineno);
		}
		
		// if no project found, dont do anything
		if(projName.IsEmpty())
		{
			return;
		}

		DirSaver ds;
		ProjectPtr pro = ManagerST::Get()->GetProject(projName);
		::wxSetWorkingDirectory(pro->GetFileName().GetPath());
		wxFileName fn(fileName);
		fn.MakeAbsolute(pro->GetFileName().GetPath());

		ManagerST::Get()->OpenFile(fn.GetFullPath(), projName, lineNumber - 1 );
	}
}