1
#include <wx/aui/aui.h>
2
#include <sdk.h> // Code::Blocks SDK
6
#include <projectmanager.h>
8
//#include <configurationpanel.h>
10
#include "FileManager.h"
12
// Register the plugin with Code::Blocks.
13
// We are using an anonymous namespace so we don't litter the global one.
16
PluginRegistrant<FileManagerPlugin> reg(_T("FileManager"));
19
int ID_ProjectOpenInFileBrowser=wxNewId();
21
BEGIN_EVENT_TABLE(FileManagerPlugin, cbPlugin)
22
EVT_MENU(ID_ProjectOpenInFileBrowser, FileManagerPlugin::OnOpenProjectInFileBrowser)
27
FileManagerPlugin::FileManagerPlugin()
29
if(!Manager::LoadResource(_T("FileManager.zip")))
31
NotifyMissingFile(_T("FileManager.zip"));
37
FileManagerPlugin::~FileManagerPlugin()
41
void FileManagerPlugin::OnAttach()
43
//Create a new instance of the FileExplorer and attach it to the Project Manager notebook
44
m_fe=new FileExplorer(Manager::Get()->GetAppWindow());
45
Manager::Get()->GetProjectManager()->GetUI().GetNotebook()->AddPage(m_fe,_("Files"));
48
void FileManagerPlugin::OnRelease(bool /*appShutDown*/)
50
if (m_fe) //remove the File Explorer from the managment pane and destroy it.
52
cbAuiNotebook *notebook = Manager::Get()->GetProjectManager()->GetUI().GetNotebook();
53
int idx = notebook->GetPageIndex(m_fe);
55
notebook->RemovePage(idx);
61
void FileManagerPlugin::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data)
63
if(type==mtProjectManager && data && data->GetKind()==FileTreeData::ftdkProject)
65
m_project_selected=wxFileName(data->GetProject()->GetFilename()).GetPath();
66
menu->Append(ID_ProjectOpenInFileBrowser, _("Open Project Folder in File Browser"), _("Opens the folder containing the project file in the file browser"));
70
void FileManagerPlugin::OnOpenProjectInFileBrowser(wxCommandEvent& /*event*/)
72
cbAuiNotebook *m_nb=Manager::Get()->GetProjectManager()->GetUI().GetNotebook();
73
m_nb->SetSelection(m_nb->GetPageIndex(m_fe));
74
m_fe->SetRootFolder(m_project_selected);