本文整理汇总了C++中ItemData::GetFolderPath方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemData::GetFolderPath方法的具体用法?C++ ItemData::GetFolderPath怎么用?C++ ItemData::GetFolderPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData::GetFolderPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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(), " "));
}
}
示例2: 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);
}
}
}
示例3: 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);
}
示例4: 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();
}
}
示例5: 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);
}
示例6: 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, "");
}
}
}
示例7: DoAddFileWithContent
void PHPWorkspaceView::DoAddFileWithContent(const wxTreeItemId& folderId,
const wxFileName& filename,
const wxString& content)
{
// file can only be added to a folder
ItemData* data = DoGetItemData(folderId);
if(!data || !data->IsFolder()) {
return;
}
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;
}
FileExtManager::FileType type = FileExtManager::GetType(filename.GetFullName());
// Create the file
const wxString __EOL__ = EditorConfigST::Get()->GetOptions()->GetEOLAsString();
// Make sure that the path exists
filename.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
wxFFile fp;
if(fp.Open(filename.GetFullPath(), wxT("w+"))) {
// if its is a PHP file, write the php tag at to the top of the file
if(type == FileExtManager::TypePhp) {
fp.Write(wxString() << "<?php " << __EOL__ << __EOL__ << content);
}
fp.Close();
}
// add the new file
wxString project_name = DoGetSelectedProject();
wxString folder_name = data->GetFolderPath();
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(project_name);
CHECK_PTR_RET(pProject);
PHPFolder::Ptr_t pFolder = pProject->Folder(folder_name);
CHECK_PTR_RET(pFolder);
if(PHPWorkspace::Get()->AddFile(project_name, folder_name, filename.GetFullPath())) {
wxArrayString filesToAdd;
filesToAdd.Add(filename.GetFullPath());
DoAddFilesToTreeView(folderId, pProject, pFolder, filesToAdd);
}
// Open the newly added file
m_mgr->OpenFile(filename.GetFullPath());
IEditor* editor = m_mgr->GetActiveEditor();
if(editor) {
editor->SetCaretAt(editor->GetLength());
}
// Notify plugins about new files was added to workspace
wxArrayString files;
files.Add(filename.GetFullPath());
// Notify the plugins
clCommandEvent evtFilesAdded(wxEVT_PROJ_FILE_ADDED);
evtFilesAdded.SetStrings(files);
EventNotifier::Get()->AddPendingEvent(evtFilesAdded);
}