File: pluginmanager.h

package info (click to toggle)
codelite 17.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 136,204 kB
  • sloc: cpp: 491,547; ansic: 280,393; php: 10,259; sh: 8,930; lisp: 7,664; vhdl: 6,518; python: 6,020; lex: 4,920; yacc: 3,123; perl: 2,385; javascript: 1,715; cs: 1,193; xml: 1,110; makefile: 804; cobol: 741; sql: 709; ruby: 620; f90: 566; ada: 534; asm: 464; fortran: 350; objc: 289; tcl: 258; java: 157; erlang: 61; pascal: 51; ml: 49; awk: 44; haskell: 36
file content (206 lines) | stat: -rw-r--r-- 9,860 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright            : (C) 2008 by Eran Ifrah
// file name            : pluginmanager.h
//
// -------------------------------------------------------------------------
// A
//              _____           _      _     _ _
//             /  __ \         | |    | |   (_) |
//             | /  \/ ___   __| | ___| |    _| |_ ___
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
//              \____/\___/ \__,_|\___\_____/_|\__\___|
//
//                                                  F i l e
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H

#include "clToolBar.h"
#include "debugger.h"
#include "dynamiclibrary.h"
#include "plugin.h"
#include "plugindata.h"
#include "project.h"

#include <list>
#include <map>
#include <set>
#include <vector>
#include <wx/string.h>
#include <wx/treectrl.h>

class clEditorBar;
class wxBookCtrlBase;
class EnvironmentConfig;
class BuildSettingsConfig;
class BuildManager;
class BitmapLoader;
class clWorkspaceView;

class PluginManager : public IManager
{
    std::map<wxString, IPlugin*> m_plugins;
    std::list<clDynamicLibrary*> m_dl;
    PluginInfoArray m_pluginsData;
    BitmapLoader* m_bmpLoader;
    std::set<MenuType> m_menusToBeHooked;
    std::map<wxString, wxString> m_backticks;
    wxAuiManager* m_dockingManager;
    PluginInfo::PluginMap_t m_installedPlugins;

private:
    PluginManager();
    virtual ~PluginManager();

public:
    static PluginManager* Get();

    virtual void Load();
    virtual void UnLoad();
    virtual void EnableToolbars();

    void SetInstalledPlugins(const PluginInfo::PluginMap_t& installedPlugins)
    {
        this->m_installedPlugins = installedPlugins;
    }
    const PluginInfo::PluginMap_t& GetInstalledPlugins() const { return m_installedPlugins; }
    /**
     * \brief return a map of all loaded plugins
     */
    const PluginInfoArray& GetPluginsInfo() const { return m_pluginsData; }
    void SetDockingManager(wxAuiManager* dockingManager) { this->m_dockingManager = dockingManager; }

    //------------------------------------
    // Implementation of IManager interface
    //------------------------------------
    void EnableClangCodeCompletion(bool b) override;
    IEditor* GetActiveEditor() override;
    clToolBarGeneric* GetToolBar() override;
    wxMenuBar* GetMenuBar() override;
    IConfigTool* GetConfigTool() override;
    TreeItemInfo GetSelectedTreeItemInfo(TreeType type) override;
    clTreeCtrl* GetFileExplorerTree() override;
    clTreeCtrl* GetWorkspaceTree() override;
    Notebook* GetOutputPaneNotebook() override;
    Notebook* GetWorkspacePaneNotebook() override;
    Notebook* GetMainNotebook() override;
    IEditor* OpenFile(const wxString& fileName, const wxString& projectName = wxEmptyString, int lineno = wxNOT_FOUND,
                      OF_extra flags = OF_AddJump) override;
    IEditor* OpenFile(const wxString& fileName, const wxString& bmpResourceName,
                      const wxString& tooltip = wxEmptyString) override;
    IEditor* OpenFile(const BrowseRecord& rec) override;
    wxString GetStartupDirectory() const override;
    void AddProject(const wxString& path) override;
    bool IsWorkspaceOpen() const override;
    TagsManager* GetTagsManager() override;
    clCxxWorkspace* GetWorkspace() override;
    bool AddFilesToVirtualFolder(wxTreeItemId& item, wxArrayString& paths) override;
    bool AddFilesToVirtualFolder(const wxString& vdFullPath, wxArrayString& paths) override;
    bool AddFilesToVirtualFolderIntelligently(const wxString& vdFullPath, wxArrayString& paths) override;
    int GetToolbarIconSize() override;
    wxAuiManager* GetDockingManager() override;
    EnvironmentConfig* GetEnv() override;
    wxString GetProjectExecutionCommand(const wxString& projectName, wxString& wd) override;
    wxApp* GetTheApp() override;
    void ReloadWorkspace() override;
    IPlugin* GetPlugin(const wxString& pluginName) override;
    wxEvtHandler* GetOutputWindow() override;
    bool SaveAll(bool prompt = true) override;
    wxString GetInstallDirectory() const override;
    bool CreateVirtualDirectory(const wxString& parentPath, const wxString& vdName) override;
    OptionsConfigPtr GetEditorSettings() override;
    void FindAndSelect(const wxString& pattern, const wxString& name, int pos = 0) override;
    TagEntryPtr GetTagAtCaret(bool scoped, bool impl) override;
    bool AllowToolbar() override;
    void SetStatusMessage(const wxString& msg, int seconds_to_live = wxID_ANY) override;
    void PushQueueCommand(const QueueCommand& cmd) override;
    void ProcessCommandQueue() override;
    void StopAndClearQueue() override;
    bool IsBuildInProgress() const override;
    bool IsBuildEndedSuccessfully() const override;
    wxString GetProjectNameByFile(wxString& fullPathFileName) override;
    wxString GetProjectNameByFile(const wxString& fullPathFileName) override;
    BuildManager* GetBuildManager() override;
    BuildSettingsConfig* GetBuildSettingsConfigManager() override;
    bool ClosePage(const wxString& title) override;
    bool ClosePage(const wxFileName& filename) override;
    wxWindow* FindPage(const wxString& text) override;
    bool AddPage(wxWindow* win, const wxString& text, const wxString& tooltip = wxEmptyString,
                 const wxString& bmpResourceName = wxEmptyString, bool selected = false) override;
    bool SelectPage(wxWindow* win) override;
    NavMgr* GetNavigationMgr() override;
    IEditor* NewEditor() override;
    bool CloseEditor(IEditor* editor, bool prompt = true) override;
    bool IsShutdownInProgress() const override;
    BitmapLoader* GetStdIcons() override;
    wxArrayString GetProjectCompileFlags(const wxString& projectName, bool isCppFile) override;
    void AddEditorPage(wxWindow* page, const wxString& name, const wxString& tooltip = wxEmptyString) override;
    wxPanel* GetEditorPaneNotebook() override;
    wxWindow* GetActivePage() override;
    wxWindow* GetPage(size_t page) override;
    size_t GetPageCount() const override;
    wxString GetPageTitle(wxWindow* win) const override;
    void SetPageTitle(wxWindow* win, const wxString& title) override;
    ProjectPtr GetSelectedProject() const override;
    void RedefineProjFiles(ProjectPtr proj, const wxString& path, std::vector<wxString>& files) override;
    IEditor* FindEditor(const wxString& filename) const override;
    size_t GetAllEditors(IEditor::List_t& editors, bool inOrder = false) override;
    size_t GetAllTabs(clTab::Vec_t& tabs) override;
    size_t GetAllBreakpoints(clDebuggerBreakpoint::Vec_t& breakpoints) override;
    clDebuggerBreakpoint CreateBreakpoint(const wxString& filepath, int line_number) override;
    void DeleteAllBreakpoints() override;
    void SetBreakpoints(const clDebuggerBreakpoint::Vec_t& breakpoints) override;
    void LoadPerspective(const wxString& perspectiveName) override;
    void SavePerspective(const wxString& perspectiveName) override;
    void ProcessEditEvent(wxCommandEvent& e, IEditor* editor) override;
    void AppendOutputTabText(eOutputPaneTab tab, const wxString& text) override;
    void ClearOutputTab(eOutputPaneTab tab) override;
    void AddWorkspaceToRecentlyUsedList(const wxFileName& filename) override;
    void StoreWorkspaceSession(const wxFileName& workspaceFile) override;
    void LoadWorkspaceSession(const wxFileName& workspaceFile) override;
    void OpenFindInFileForPath(const wxString& path) override;
    void OpenFindInFileForPaths(const wxArrayString& paths) override;
    void ShowOutputPane(const wxString& selectedWindow = "") override;
    void ToggleOutputPane(const wxString& selectedWindow = "") override;
    clStatusBar* GetStatusBar() override;
    clEditorBar* GetNavigationBar() override;
    clWorkspaceView* GetWorkspaceView() override;
    bool IsToolBarShown() const override;
    void ShowToolBar(bool show = true) override;
    void ShowBuildMenu(clToolBar* toolbar, wxWindowID buttonId) override;
    void OpenFileAndAsyncExecute(const wxString& fileName, std::function<void(IEditor*)>&& func) override;
    /**
     * @brief return list of all breakpoints
     */
    void GetBreakpoints(std::vector<clDebuggerBreakpoint>& bpList) override;

    /**
     * @brief display message to the user using the info bar
     */
    void DisplayMessage(const wxString& message, int flags = wxICON_INFORMATION,
                        const std::vector<std::pair<wxWindowID, wxString>>& buttons = {}) override;

    //------------------------------------
    // End of IManager interface
    //------------------------------------

    // (Un)Hook the contect menus
    virtual void HookPopupMenu(wxMenu* menu, MenuType type);

    // (Un)Hook the project settings tab
    virtual void HookProjectSettingsTab(wxBookCtrlBase* book, const wxString& projectName, const wxString& configName);
    virtual void UnHookProjectSettingsTab(wxBookCtrlBase* book, const wxString& projectName,
                                          const wxString& configName);
};

#endif // PLUGINMANAGER_H