本文整理汇总了C++中ProjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ProjectPtr类的具体用法?C++ ProjectPtr怎么用?C++ ProjectPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK_COND_RET
void CMakePlugin::OnWorkspaceContextMenu(clContextMenuEvent& event)
{
event.Skip();
CHECK_COND_RET(clCxxWorkspaceST::Get()->IsOpen());
ProjectPtr p = clCxxWorkspaceST::Get()->GetActiveProject();
CHECK_COND_RET(p);
BuildConfigPtr buildConf = p->GetBuildConfiguration();
CHECK_COND_RET(buildConf);
CHECK_COND_RET(buildConf->GetBuilder()->GetName() == "CMake");
// The active project is using CMake builder
// Add our context menu
wxMenu* menu = event.GetMenu();
CHECK_PTR_RET(menu);
wxFileName workspaceFile = clCxxWorkspaceST::Get()->GetFileName();
workspaceFile.SetFullName(CMAKELISTS_FILE);
menu->InsertSeparator(0);
if(workspaceFile.FileExists()) {
wxMenuItem* item = new wxMenuItem(NULL, XRCID("cmake_open_active_project_cmake"), _("Open CMakeLists.txt"));
item->SetBitmap(m_mgr->GetStdIcons()->LoadBitmap("cmake"));
menu->Insert(0, item);
}
menu->Insert(0, XRCID("cmake_export_active_project"), _("Export CMakeLists.txt"));
menu->Bind(wxEVT_MENU, &CMakePlugin::OnOpenCMakeLists, this, XRCID("cmake_open_active_project_cmake"));
menu->Bind(wxEVT_MENU, &CMakePlugin::OnExportCMakeLists, this, XRCID("cmake_export_active_project"));
}
示例2: util_update_obj_property_grid
void CMainFrame::OnFileOpenProject()
{
using namespace engine;
util_update_obj_property_grid(GameObjectPtr());
util_update_object_view(GameObjectPtr());
CFileDialog dlg(TRUE,
L"gp",
NULL,
OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
L"Game Project Files (*.gp)|*.gp||");
if(IDOK != dlg.DoModal())
{
return;
}
ProjectPtr pProject = Project::Instance();
pProject->Close();
CString file = dlg.GetPathName();
if(pProject->Load(file) == false)
{
MessageBox(L"Fialed to load project.", L"error", MB_ICONERROR);
pProject->Close();
return;
}
util_update_object_view(pProject->Root());
}
示例3: CheckProject
void MemCheckPlugin::CheckProject(const wxString& projectName)
{
if(m_terminal.IsRunning()) {
::wxMessageBox(_("Another instance is already running. Please stop it before executing another one"),
"CodeLite",
wxICON_WARNING | wxCENTER | wxOK);
return;
}
wxString errMsg;
ProjectPtr project = m_mgr->GetWorkspace()->FindProjectByName(projectName, errMsg);
wxString path = project->GetFileName().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
wxString wd;
wxString command = m_mgr->GetProjectExecutionCommand(projectName, wd);
DirSaver ds;
EnvSetter envGuard(m_mgr->GetEnv());
wxSetWorkingDirectory(path);
wxSetWorkingDirectory(wd);
m_mgr->AppendOutputTabText(kOutputTab_Output, _("Launching MemCheck...\n"));
m_mgr->AppendOutputTabText(kOutputTab_Output,
wxString() << _("Working directory is set to: ") << ::wxGetCwd() << "\n");
m_mgr->AppendOutputTabText(kOutputTab_Output,
wxString() << "MemCheck command: " << m_memcheckProcessor->GetExecutionCommand(command)
<< "\n");
wxString cmd = m_memcheckProcessor->GetExecutionCommand(command);
m_terminal.ExecuteConsole(cmd, "", true, wxString::Format("MemCheck: %s", projectName));
}
示例4: tkz
bool clCxxWorkspace::AddNewFile(const wxString& vdFullPath, const wxString& fileName, wxString& errMsg)
{
wxStringTokenizer tkz(vdFullPath, wxT(":"));
// We should have at least 2 tokens:
// project:virtual directory
if(tkz.CountTokens() < 2)
return false;
wxString projName = tkz.GetNextToken();
wxString fixedPath;
// Construct new path excluding the first token
size_t count = tkz.CountTokens();
for(size_t i = 0; i < count - 1; i++) {
fixedPath += tkz.GetNextToken();
fixedPath += wxT(":");
}
fixedPath += tkz.GetNextToken();
ProjectPtr proj = FindProjectByName(projName, errMsg);
if(!proj) {
errMsg = wxT("No such project");
return false;
}
return proj->AddFile(fileName, fixedPath);
}
示例5: wxUnusedVar
wxString QMakePlugin::DoGetBuildCommand(const wxString& project, const wxString& config, bool projectOnly)
{
wxUnusedVar(config);
wxString errMsg;
ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg);
if(!p) { return wxEmptyString; }
BuildConfigPtr bldConf = clCxxWorkspaceST::Get()->GetProjBuildConf(project, config);
wxString cmd;
wxString projectMakefile;
projectMakefile << p->GetName() << ".mk";
::WrapWithQuotes(projectMakefile);
projectMakefile.Replace("\\", "/");
if(!projectOnly) {
// part of a greater makefile, use $(MAKE)
cmd << wxT("@cd \"") << p->GetFileName().GetPath() << wxT("\" && ");
cmd << "$(MAKE) -f " << projectMakefile;
} else {
// project only
cmd = bldConf->GetCompiler()->GetTool("MAKE");
if(!cmd.Contains("-f")) { cmd << " -f "; }
cmd << " " << projectMakefile;
}
return cmd;
}
示例6: wxASSERT
void
CMakeProjectMenu::OnMakeDirty(wxCommandEvent& event)
{
// Get settings
const CMakeProjectSettings* settings = m_plugin->GetSelectedProjectSettings();
// Event shouldn't be called when project is not enabled
wxASSERT(settings && settings->enabled);
// This function just touch .cmake_dirty file
ProjectPtr project = m_plugin->GetSelectedProject();
// Real project
wxString projectName = project->GetName();
// Project has parent project -> touch dirty file there
if (!settings->parentProject.IsEmpty()) {
projectName = settings->parentProject;
}
// Move to project directory
wxFileName dirtyFile = m_plugin->GetProjectDirectory(projectName);
dirtyFile.SetFullName(".cmake_dirty");
// Update file time
dirtyFile.Touch();
}
示例7: dlg
//------------------------------------------------------------
void SnipWiz::OnClassWizard(wxCommandEvent& e)
{
TemplateClassDlg dlg(m_mgr->GetTheApp()->GetTopWindow(), this, m_mgr);
wxString errMsg, projectPath, projectName;
TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileView);
projectName = m_mgr->GetWorkspace()->GetActiveProjectName();
if(m_mgr->GetWorkspace()) {
if(item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory) {
projectPath = item.m_fileName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
} else {
ProjectPtr proj = m_mgr->GetWorkspace()->FindProjectByName(projectName, errMsg);
if(proj) projectPath = proj->GetFileName().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
}
}
dlg.SetCurEol(GetEOLByOS());
dlg.SetPluginPath(m_pluginPath);
dlg.SetProjectPath(projectPath);
dlg.ShowModal();
if(dlg.GetModified()) {
m_modified = true;
}
}
示例8: DoGetCommand
wxString CppCheckPlugin::DoGetCommand(ProjectPtr proj)
{
// Linux / Mac way: spawn the process and execute the command
wxString cmd, path;
path = clStandardPaths::Get().GetBinaryFullPath("codelite_cppcheck");
::WrapWithQuotes(path);
wxString fileList = DoGenerateFileList();
if(fileList.IsEmpty()) return wxT("");
// build the command
cmd << path << " ";
cmd << m_settings.GetOptions();
// Append here project specifc search paths
if(proj) {
wxArrayString projectSearchPaths = proj->GetIncludePaths();
for(size_t i = 0; i < projectSearchPaths.GetCount(); ++i) {
wxFileName fnIncPath(projectSearchPaths.Item(i), "");
wxString includePath = fnIncPath.GetPath(true);
::WrapWithQuotes(includePath);
cmd << " -I" << includePath;
}
wxArrayString projMacros = proj->GetPreProcessors();
for(size_t i = 0; i < projMacros.GetCount(); ++i) {
cmd << " -D" << projMacros.Item(i);
}
}
cmd << wxT(" --file-list=");
cmd << wxT("\"") << fileList << wxT("\"");
CL_DEBUG("cppcheck command: %s", cmd);
return cmd;
}
示例9: OnBrowseCustomBuildWD
void PSCustomBuildPage::OnBrowseCustomBuildWD(wxCommandEvent& event)
{
DirSaver ds;
// Since all paths are relative to the project, set the working directory to the
// current project path
ProjectPtr p = ManagerST::Get()->GetProject(m_projectName);
if(p) {
wxSetWorkingDirectory(p->GetFileName().GetPath());
}
wxFileName fn(m_textCtrlCustomBuildWD->GetValue());
wxString initPath(wxEmptyString);
if(fn.DirExists()) {
fn.MakeAbsolute();
initPath = fn.GetFullPath();
}
wxString new_path =
wxDirSelector(_("Select working directory:"), initPath, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
if(new_path.IsEmpty() == false) {
m_textCtrlCustomBuildWD->SetValue(new_path);
}
}
示例10: DoSettingsItem
void CppCheckPlugin::DoSettingsItem(ProjectPtr project/*= NULL*/)
{
// Find the default path for the CppCheckSettingsDialog's wxFileDialog
wxString defaultpath;
IEditor* ed = m_mgr->GetActiveEditor();
if (ed && ed->GetFileName().IsOk()) {
defaultpath = ed->GetFileName().GetPath();
}
// If there's an active project, first load any project-specific settings: definitions and undefines
// (We couldn't do that with the rest of the settings as the workspace hadn't yet been loaded)
m_settings.LoadProjectSpecificSettings(project); // NB we still do this if !project, as that will clear any stale settings
CppCheckSettingsDialog dlg(m_mgr->GetTheApp()->GetTopWindow(), &m_settings, m_mgr->GetConfigTool(), defaultpath, project.Get() != NULL);
if (dlg.ShowModal() == wxID_OK) {
m_mgr->GetConfigTool()->WriteObject(wxT("CppCheck"), &m_settings);
if (project) {
// Also save any project-specific settings: definitions and undefines
wxString definitions = wxJoin(m_settings.GetDefinitions(), ',');
wxString undefines = wxJoin(m_settings.GetUndefines(), ',');
if (!(definitions.empty() && undefines.empty())) {
project->SetPluginData("CppCheck", definitions + ';' + undefines);
} else {
project->SetPluginData("CppCheck", "");
}
}
}
}
示例11: wxLogMessage
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);
}
示例12: OnDebugStart
void LLDBDebuggerPlugin::OnDebugStart(clDebugEvent& event)
{
event.Skip();
return;
if ( ::PromptForYesNoDialogWithCheckbox(_("Would you like to use LLDB debugger as your primary debugger?"), "UseLLDB") != wxID_YES ) {
event.Skip();
return;
}
// Get the executable to debug
wxString errMsg;
ProjectPtr pProject = WorkspaceST::Get()->FindProjectByName(event.GetProjectName(), errMsg);
if ( !pProject ) {
event.Skip();
return;
}
wxSetWorkingDirectory ( pProject->GetFileName().GetPath() );
BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf ( pProject->GetName(), wxEmptyString );
if ( !bldConf ) {
event.Skip();
return;
}
// Show the terminal
ShowTerminal("LLDB Console Window");
if ( m_debugger.Start("/home/eran/devl/TestArea/TestHang/Debug/TestHang") ) {
m_debugger.AddBreakpoint("main");
m_debugger.ApplyBreakpoints();
m_debugger.Run("/tmp/in", "/tmp/out", "/tmp/err", wxArrayString(), wxArrayString(), ::wxGetCwd());
}
}
示例13: clLogMessage
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();
}
示例14: GetBuildMatrix
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;
}
示例15: BuildTree
void VirtualDirectoryTree::BuildTree(const wxString& projName)
{
ProjectPtr proj = ManagerST::Get()->GetProject(projName);
wxCHECK_RET(proj, "Can't find a Project with the supplied name");
ProjectTreePtr tree = proj->AsTree();
TreeWalker<wxString, ProjectItem> walker(tree->GetRoot());
for ( ; !walker.End(); walker++ ) {
ProjectTreeNode* node = walker.GetNode();
wxString displayname(node->GetData().GetDisplayName());
if (node->GetData().GetKind() == ProjectItem::TypeVirtualDirectory) {
wxString vdPath = displayname;
ProjectTreeNode* tempnode = node->GetParent();
while (tempnode) {
vdPath = tempnode->GetData().GetDisplayName() + ':' + vdPath;
tempnode = tempnode->GetParent();
}
VirtualDirectoryTree* parent = FindParent(vdPath.BeforeLast(':'));
if (parent) {
parent->StoreChild(displayname, vdPath);
} else {
// Any orphans must be root's top-level children, and we're root
StoreChild(displayname, vdPath);
}
}
}
}