本文整理汇总了C++中phpproject::Ptr_t::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr_t::Save方法的具体用法?C++ Ptr_t::Save怎么用?C++ Ptr_t::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpproject::Ptr_t
的用法示例。
在下文中一共展示了Ptr_t::Save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnNewFolder
void PHPWorkspaceView::OnNewFolder(wxCommandEvent& e)
{
wxUnusedVar(e);
wxString name = wxGetTextFromUser(_("New Folder Name:"), _("New Folder"));
if(name.IsEmpty()) return;
wxString project = DoGetSelectedProject();
if(project.IsEmpty()) return;
wxTreeItemId parent = m_treeCtrlView->GetSelection();
CHECK_ITEM_RET(parent);
ItemData* itemData = DoGetItemData(parent);
CHECK_PTR_RET(itemData);
if(!itemData->IsFolder() && !itemData->IsProject()) return;
PHPProject::Ptr_t proj = PHPWorkspace::Get()->GetProject(project);
CHECK_PTR_RET(proj);
wxString folder;
if(itemData->IsFolder()) {
folder << itemData->GetFolderPath() << "/" << name;
} else {
folder << name;
}
PHPFolder::Ptr_t pFolder = proj->AddFolder(folder);
proj->Save();
// Update the UI
DoAddFolder(parent, pFolder, proj);
}
示例2: DeleteProject
void PHPWorkspace::DeleteProject(const wxString& project)
{
PHPProject::Ptr_t p = GetProject(project);
CHECK_PTR_RET(p);
m_projects.erase(project);
if(p->IsActive() && !m_projects.empty()) {
// we are removing the active project, select a new project to be the active
PHPProject::Ptr_t newActiveProject = m_projects.begin()->second;
newActiveProject->SetIsActive(true);
newActiveProject->Save();
}
Save(); // save the workspace
}
示例3: Save
void PHPProjectSettingsDlg::Save()
{
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(m_projectName);
CHECK_PTR_RET(pProject);
PHPProjectSettingsData& data = pProject->GetSettings();
// General settings
data.SetRunAs(m_choicebook1->GetSelection() == 0 ? PHPProjectSettingsData::kRunAsCLI :
PHPProjectSettingsData::kRunAsWebsite);
data.SetPhpExe(m_filePickerPHPExe->GetPath());
data.SetIndexFile(m_filePickerIndex->GetPath());
data.SetArgs(m_textCtrlProgramArgs->GetValue());
data.SetWorkingDirectory(m_dirPickerWorkingDirectory->GetPath());
data.SetIncludePath(m_textCtrlPHPIncludePath->GetValue());
data.SetPauseWhenExeTerminates(m_checkBoxPauseWhenExecutionEnds->IsChecked());
data.SetPhpIniFile(m_filePickerPhpIni->GetPath());
data.SetProjectURL(m_textCtrlWebSiteURL->GetValue());
data.SetUseSystemBrowser(m_checkBoxSystemBrowser->IsChecked());
// Code Completion settings
data.SetCcIncludePath(m_textCtrlCCIncludePath->GetValue());
// Save the file mapping
JSONElement::wxStringMap_t mapping;
int itemCount = m_dvListCtrlFileMapping->GetItemCount();
for(int i = 0; i < itemCount; ++i) {
wxVariant source, target;
m_dvListCtrlFileMapping->GetValue(source, i, 0);
m_dvListCtrlFileMapping->GetValue(target, i, 1);
mapping.insert(std::make_pair(source.GetString(), target.GetString()));
}
data.SetFileMapping(mapping);
wxString fileExts = m_pgPropFileTypes->GetValue().GetString();
fileExts.Replace(",", ";");
pProject->SetImportFileSpec(fileExts);
wxString excludeDirs = m_pgPropExcludeFolders->GetValue().GetString();
excludeDirs.Replace(",", ";");
pProject->SetExcludeFolders(excludeDirs);
// Save the project content
pProject->Save();
SetDirty(false);
}
示例4: OnRenameFile
void PHPWorkspaceView::OnRenameFile(wxCommandEvent& e)
{
wxTreeItemId item = DoGetSingleSelection();
CHECK_ITEM_RET(item);
ItemData *data = DoGetItemData(item);
CHECK_PTR_RET(data);
CHECK_ID_FILE(data);
wxFileName old_file_name = data->GetFile();
wxString new_name = ::wxGetTextFromUser(_("New file name:"), _("Rename file"), old_file_name.GetFullName() );
if ( new_name.IsEmpty() )
return;
if ( new_name == old_file_name.GetFullName() )
return;
// Check to see if we got a file with the old path opened
bool reopenFile = false;
IEditor *editor = m_mgr->FindEditor(old_file_name.GetFullPath());
if ( editor ) {
m_mgr->ClosePage( editor->GetFileName().GetFullName() );
reopenFile = true;
editor = NULL;
}
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(DoGetSelectedProject());
CHECK_PTR_RET(pProject);
if ( pProject->RenameFile(old_file_name.GetFullPath(), new_name) ) {
// Locate the folder
pProject->Save();
m_treeCtrlView->SetItemText(item, new_name);
// Update the item data
old_file_name.SetFullName(new_name);
data->SetFile( old_file_name.GetFullPath() );
// Open the file if it was opened earlier
// old_file_name now contains the new full path to the new file
if ( reopenFile ) {
m_mgr->OpenFile( old_file_name.GetFullPath() );
}
}
}
示例5: OnMakeIndexPHP
void PHPWorkspaceView::OnMakeIndexPHP(wxCommandEvent& e)
{
e.Skip();
wxTreeItemId item = DoGetSingleSelection();
CHECK_ITEM_RET(item);
ItemData* itemData = DoGetItemData(item);
CHECK_PTR_RET(itemData);
CHECK_ID_FILE(itemData);
wxString projectName = itemData->GetProjectName();
if(projectName.IsEmpty()) return;
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(projectName);
CHECK_PTR_RET(pProject);
PHPProjectSettingsData& settings = pProject->GetSettings();
settings.SetIndexFile(itemData->GetFile());
pProject->Save();
}
示例6: OnAddFile
void PHPWorkspaceView::OnAddFile(wxCommandEvent& e)
{
wxTreeItemId folderItem = DoGetSingleSelection();
CHECK_ITEM_RET(folderItem);
ItemData* data = DoGetItemData(folderItem);
CHECK_PTR_RET(data);
if(!data->IsFolder()) return;
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(data->GetProjectName());
CHECK_PTR_RET(pProject);
PHPFolder::Ptr_t pFolder = pProject->Folder(data->GetFolderPath());
CHECK_PTR_RET(pFolder);
wxFileDialog dlg(wxTheApp->GetTopWindow(),
_("Add file"),
pFolder->GetFullPath(pProject->GetFilename().GetPath()),
wxT(""),
wxT("PHP Files (*.php)|*.php|PHP include files (*.inc)|*.inc|All files (*)|*"),
wxFD_FILE_MUST_EXIST | wxFD_OPEN | wxFD_MULTIPLE);
if(dlg.ShowModal() == wxID_OK) {
wxArrayString paths;
dlg.GetPaths(paths);
if(paths.IsEmpty()) return;
// if the file is not under the project's tree - do not add it
// Use the folder taken from the file's full path and the pFolder as the base folder for adding the file
if(!paths.Item(0).StartsWith(pProject->GetFilename().GetPath())) {
::wxMessageBox(_("Can not add file to project. File must be under the project directory tree"),
"CodeLite",
wxOK | wxCENTER | wxICON_WARNING);
return;
}
DoAddFilesToFolder(paths, pProject, true);
pProject->Save();
}
}
示例7: OnDeleteFolder
void PHPWorkspaceView::OnDeleteFolder(wxCommandEvent& e)
{
wxTreeItemId folderItem = DoGetSingleSelection();
if(!IsFolderItem(folderItem)) return;
ItemData* data = DoGetItemData(folderItem);
wxString folder = data->GetFolderPath();
wxString project = DoGetSelectedProject();
if(folder.IsEmpty() || project.IsEmpty()) return;
wxString msg = wxString() << _("Are you sure you want to delete folder '") << folder
<< ("'?\nNote: selecting 'Yes' will NOT remove any file from the file system");
if(wxMessageBox(msg, wxT("CodeLite"), wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTER) != wxYES) return;
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(project);
CHECK_PTR_RET(pProject);
pProject->DeleteFolder(folder);
pProject->Save();
// Update the UI
m_treeCtrlView->Delete(folderItem);
}