Debian Codegraph @

Rust/RustPlugin.hpp

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2021 by Eran Ifrah
5 // file name : RustPlugin.hpp
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef __RUSTPLUGIN_HPP__
27 #define __RUSTPLUGIN_HPP__
28
29 #include "clFileSystemEvent.h"
30 #include "clTabTogglerHelper.h"
31 #include "clWorkspaceEvent.hpp"
32 #include "cl_command_event.h"
33 #include "macros.h"
34 #include "plugin.h"
35 #include "wxStringHash.h"
36
37 #include <unordered_map>
38
39 class RustPlugin : public IPlugin
40 {
41 std::unordered_map<wxString, wxString> m_cargoTomlDigest;
42 wxFileName m_cargoTomlFile;
43
44 public:
45 RustPlugin(IManager* manager);
46 virtual ~RustPlugin();
47
48 protected:
49 void OnFolderContextMenu(clContextMenuEvent& event);
50 void OnRustWorkspaceFileCreated(clFileSystemEvent& event);
51 void OnNewWorkspace(clCommandEvent& e);
52 wxString GetRustTool(const wxString& toolname) const;
53 void OnBuildErrorLineClicked(clBuildEvent& event);
54 void AddRustcCompilerIfMissing();
55 void OnBuildEnded(clBuildEvent& event);
56 void OnWorkspaceLoaded(clWorkspaceEvent& event);
57 void OnWorkspaceClosed(clWorkspaceEvent& event);
58
59 wxFileName find_cargo_toml(const wxFileName& workspaceFile) const;
60
61 public:
62 //--------------------------------------------
63 // Abstract methods
64 //--------------------------------------------
65 virtual void CreateToolBar(clToolBarGeneric* toolbar);
66 virtual void CreatePluginMenu(wxMenu* pluginsMenu);
67 virtual void HookPopupMenu(wxMenu* menu, MenuType type);
68 virtual void UnPlug();
69 IManager* GetManager() { return m_mgr; }
70 };
71
72 #endif // __RUSTPLUGIN_HPP__