本文整理汇总了C++中ItemData::GetProjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemData::GetProjectName方法的具体用法?C++ ItemData::GetProjectName怎么用?C++ ItemData::GetProjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData::GetProjectName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OnNewClass
void PHPWorkspaceView::OnNewClass(wxCommandEvent& e)
{
wxTreeItemId folderId = DoGetSingleSelection();
ItemData* data = DoGetItemData(folderId);
if(!data || !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);
NewPHPClass dlg(wxTheApp->GetTopWindow(), pFolder->GetFullPath(pProject->GetFilename().GetPath(), false));
if(dlg.ShowModal() == wxID_OK) {
PHPClassDetails pcd = dlg.GetDetails();
pFolder = pProject->AddFolder(PHPFolder::GetFolderPathFromFileFullPath(pcd.GetFilepath().GetFullPath(),
pProject->GetFilename().GetPath()));
CHECK_PTR_RET(pFolder);
folderId = EnsureFolderExists(
DoGetProjectItem(pProject->GetName()), pFolder->GetPathRelativeToProject(), pProject->GetName());
DoAddFileWithContent(
folderId, pcd.GetFilepath(), pcd.ToString(EditorConfigST::Get()->GetOptions()->GetEOLAsString(), " "));
}
}
示例3: DoGetSelectedProject
wxString PHPWorkspaceView::DoGetSelectedProject()
{
wxTreeItemId item = m_treeCtrlView->GetSelection();
if(!item.IsOk()) {
return wxEmptyString;
}
ItemData* id = DoGetItemData(item);
if(!id) return wxEmptyString;
return id->GetProjectName();
}
示例4: OnSetProjectActive
void PHPWorkspaceView::OnSetProjectActive(wxCommandEvent& e)
{
wxString project = DoGetSelectedProject();
if(project.IsEmpty()) return;
PHPWorkspace::Get()->SetProjectActive(project);
wxTreeItemIdValue cookie;
wxTreeItemId child = m_treeCtrlView->GetFirstChild(m_treeCtrlView->GetRootItem(), cookie);
while(child.IsOk()) {
ItemData* id = DoGetItemData(child);
if(id && id->IsProject()) {
id->SetActive(id->GetProjectName() == project);
m_treeCtrlView->SetItemBold(child, id->IsActive());
}
child = m_treeCtrlView->GetNextChild(m_treeCtrlView->GetRootItem(), cookie);
}
}
示例5: OnDeleteProject
void PHPWorkspaceView::OnDeleteProject(wxCommandEvent& e)
{
// Prompt user
wxTreeItemId selection = m_treeCtrlView->GetSelection();
if(selection.IsOk()) {
ItemData* itemData = DoGetItemData(selection);
if ( itemData && itemData->IsProject() ) {
if(wxMessageBox(wxString() << _("Are you sure you want to delete\nproject '") << itemData->GetProjectName() << "'?",
_("CodeLite"),
wxYES_NO| wxCANCEL,
wxTheApp->GetTopWindow()) == wxYES) {
PHPWorkspace::Get()->DeleteProject(itemData->GetProjectName());
m_treeCtrlView->Delete( selection );
}
}
}
}
示例6: 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();
}
示例7: 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();
}
}
示例8: OnNewFile
void PHPWorkspaceView::OnNewFile(wxCommandEvent& e)
{
wxTreeItemId folderId = DoGetSingleSelection();
ItemData *data = DoGetItemData( folderId );
if( data->IsFolder() ) {
PHPProject::Ptr_t pProj = PHPWorkspace::Get()->GetProject(data->GetProjectName());
CHECK_PTR_RET(pProj);
PHPFolder::Ptr_t pFolder = pProj->Folder(data->GetFolderPath());
CHECK_PTR_RET(pFolder);
NewFileDlg dlg(wxTheApp->GetTopWindow(), pFolder->GetFullPath( pProj->GetFilename().GetPath() ) );
if(dlg.ShowModal() == wxID_OK) {
wxFileName filename = dlg.GetPath();
if( filename.FileExists() ) {
// A file with this name already exists
wxMessageBox(_("A file with same name already exists!"), wxT("CodeLite"), wxOK|wxCENTER|wxICON_WARNING);
return;
}
DoAddFileWithContent(folderId, filename, "");
}
}
}