本文整理汇总了C++中ItemData::GetFile方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemData::GetFile方法的具体用法?C++ ItemData::GetFile怎么用?C++ ItemData::GetFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData::GetFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoDeleteSelectedFileItem
void PHPWorkspaceView::DoDeleteSelectedFileItem()
{
wxTreeItemId item = DoGetSingleSelection();
CHECK_ITEM_RET(item);
ItemData* itemData = DoGetItemData(item);
if(!itemData || !itemData->IsFile()) return;
wxString msg, caption;
caption << _("Removing file '") << wxFileName(itemData->GetFile()).GetFullName() << "'";
msg << _("Removing file '") << wxFileName(itemData->GetFile()).GetFullName() << "' from project '"
<< itemData->GetProjectName() << "'\n"
<< _("You can select to remove the file from the project and optionally from the file system\n")
<< _("From where should codelite remove the file?");
wxMessageDialog dlg(EventNotifier::Get()->TopFrame(), msg, caption, wxYES_NO | wxCANCEL | wxCANCEL_DEFAULT);
dlg.SetYesNoCancelLabels("File system && project", "Project only", "Cancel");
int answer = dlg.ShowModal();
if(answer == wxID_YES || answer == wxID_NO) {
wxString fileName = itemData->GetFile();
// Remove from from project
if(PHPWorkspace::Get()->DelFile(itemData->GetProjectName(), itemData->GetFolderPath(), fileName)) {
m_treeCtrlView->Delete(item);
} else {
return;
}
if(answer == wxID_YES) {
::wxRemoveFile(fileName);
}
}
}
示例2: DoOpenFile
void PHPWorkspaceView::DoOpenFile(const wxTreeItemId& item)
{
ItemData* data = DoGetItemData(item);
if(data && data->IsFile()) {
m_mgr->OpenFile(data->GetFile());
}
}
示例3: 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() );
}
}
}
示例4: 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();
}