Skip to content

Commit 2b52cf6

Browse files
committed
Remove Retagging Hooks From Workspace And Editor
Eliminate the legacy retagging flow from project creation, file additions, file renames, and several editor/workspace UI actions. Workspace and file tag refreshes are no longer triggered directly from Manager, FileViewTree, MainBook, or ContextCpp, and the retag-in-progress guard is removed along with its related menu and update handlers. The change also fixes the FileSystemWorkspace compile-flags file helper declaration to use the correct class name. * Manager * FileViewTree * MainBook * ContextCpp * FileSystemWorkspace **Generated by CodeLite** Signed-off-by: Eran Ifrah <eran@codelite.org>
1 parent d26607f commit 2b52cf6

File tree

8 files changed

+3
-120
lines changed

8 files changed

+3
-120
lines changed

LiteEditor/context_cpp.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ EVT_MENU(XRCID("add_multi_impl"), ContextCpp::OnAddMultiImpl)
144144
EVT_MENU(XRCID("setters_getters"), ContextCpp::OnGenerateSettersGetters)
145145
EVT_MENU(XRCID("add_include_file"), ContextCpp::OnAddIncludeFile)
146146
EVT_MENU(XRCID("add_forward_decl"), ContextCpp::OnAddForwardDecl)
147-
EVT_MENU(XRCID("retag_file"), ContextCpp::OnRetagFile)
148147
EVT_MENU(XRCID("open_include_file"), ContextCpp::OnContextOpenDocument)
149148
END_EVENT_TABLE()
150149

@@ -1688,36 +1687,6 @@ bool ContextCpp::IsComment(long pos) const
16881687
style == wxSTC_C_COMMENTDOCKEYWORDERROR);
16891688
}
16901689

1691-
void ContextCpp::OnRetagFile(wxCommandEvent& e)
1692-
{
1693-
CHECK_JS_RETURN_VOID();
1694-
VALIDATE_WORKSPACE();
1695-
1696-
wxUnusedVar(e);
1697-
clEditor& editor = GetCtrl();
1698-
if (editor.GetModify()) {
1699-
wxMessageBox(wxString::Format(_("Please save the file before retagging it")));
1700-
return;
1701-
}
1702-
1703-
RetagFile();
1704-
editor.SetActive();
1705-
}
1706-
1707-
void ContextCpp::RetagFile()
1708-
{
1709-
CHECK_JS_RETURN_VOID();
1710-
if (ManagerST::Get()->GetRetagInProgress()) {
1711-
return;
1712-
}
1713-
1714-
clEditor& editor = GetCtrl();
1715-
ManagerST::Get()->RetagFile(editor.GetFileName().GetFullPath());
1716-
1717-
// incase this file is not cache this function does nothing
1718-
TagsManagerST::Get()->ClearCachedFile(editor.GetFileName().GetFullPath());
1719-
}
1720-
17211690
void ContextCpp::OnUserTypedXChars(const wxString& word)
17221691
{
17231692
// user typed more than 3 chars, display completion box with C++ keywords

LiteEditor/context_cpp.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class ContextCpp : public ContextBase
5555
bool DoCodeComplete(long pos);
5656
void DoCreateFile(const wxFileName& fn);
5757
void DoUpdateCalltipHighlight();
58-
size_t DoGetEntriesForHeaderAndImpl(std::vector<TagEntryPtr>& prototypes, std::vector<TagEntryPtr>& functions,
58+
size_t DoGetEntriesForHeaderAndImpl(std::vector<TagEntryPtr>& prototypes,
59+
std::vector<TagEntryPtr>& functions,
5960
wxString& otherfile);
6061

6162
public:
@@ -84,7 +85,6 @@ class ContextCpp : public ContextBase
8485
void AddMenuDynamicContent(wxMenu* menu) override;
8586
void RemoveMenuDynamicContent(wxMenu* menu) override;
8687
void ApplySettings() override;
87-
void RetagFile() override;
8888
wxString CallTipContent() override;
8989
void SetActive() override;
9090
void SemicolonShift() override;
@@ -120,7 +120,6 @@ class ContextCpp : public ContextBase
120120
virtual void OnMoveImpl(wxCommandEvent& e);
121121
virtual void OnAddImpl(wxCommandEvent& e);
122122
virtual void OnAddMultiImpl(wxCommandEvent& e);
123-
virtual void OnRetagFile(wxCommandEvent& e);
124123
virtual void OnUserTypedXChars(const wxString& word);
125124
void OnCallTipClick(wxStyledTextEvent& e) override;
126125
void OnCalltipCancel() override;

LiteEditor/fileview.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ EVT_MENU(XRCID("pin_project"), FileViewTree::OnPinProject)
105105
EVT_MENU(XRCID("rebuild_project"), FileViewTree::OnReBuild)
106106
EVT_MENU(XRCID("generate_makefile"), FileViewTree::OnRunPremakeStep)
107107
EVT_MENU(XRCID("stop_build"), FileViewTree::OnStopBuild)
108-
EVT_MENU(XRCID("retag_project"), FileViewTree::OnRetagProject)
109108
EVT_MENU(XRCID("build_project_only"), FileViewTree::OnBuildProjectOnly)
110109
EVT_MENU(XRCID("clean_project_only"), FileViewTree::OnCleanProjectOnly)
111110
EVT_MENU(XRCID("rebuild_project_only"), FileViewTree::OnRebuildProjectOnly)
@@ -140,8 +139,6 @@ EVT_UPDATE_UI(XRCID("build_order"), FileViewTree::OnBuildInProgress)
140139
EVT_UPDATE_UI(XRCID("clean_project"), FileViewTree::OnBuildInProgress)
141140
EVT_UPDATE_UI(XRCID("build_project"), FileViewTree::OnBuildInProgress)
142141
EVT_UPDATE_UI(XRCID("rebuild_project"), FileViewTree::OnBuildInProgress)
143-
EVT_UPDATE_UI(XRCID("retag_project"), FileViewTree::OnRetagInProgressUI)
144-
EVT_UPDATE_UI(XRCID("retag_workspace"), FileViewTree::OnRetagInProgressUI)
145142
EVT_UPDATE_UI(XRCID("build_project_only"), FileViewTree::OnBuildInProgress)
146143
EVT_UPDATE_UI(XRCID("clean_project_only"), FileViewTree::OnBuildInProgress)
147144
EVT_UPDATE_UI(XRCID("rebuild_project_only"), FileViewTree::OnBuildInProgress)
@@ -1335,22 +1332,6 @@ size_t FileViewTree::GetMultiSelection(wxArrayTreeItemIds& arr)
13351332
}
13361333
}
13371334

1338-
void FileViewTree::OnRetagProject(wxCommandEvent& event)
1339-
{
1340-
wxUnusedVar(event);
1341-
wxTreeItemId item = GetSingleSelection();
1342-
if (item.IsOk()) {
1343-
wxString projectName = GetItemText(item);
1344-
ManagerST::Get()->RetagProject(projectName, true);
1345-
}
1346-
}
1347-
1348-
void FileViewTree::OnRetagWorkspace(wxCommandEvent& event)
1349-
{
1350-
wxUnusedVar(event);
1351-
ManagerST::Get()->RetagWorkspace(TagsManager::Retag_Quick);
1352-
}
1353-
13541335
void FileViewTree::OnItemBeginDrag(wxTreeEvent& event)
13551336
{
13561337
wxArrayTreeItemIds selections;
@@ -2060,11 +2041,6 @@ void FileViewTree::OnLocalWorkspaceSettings(wxCommandEvent& e)
20602041
}
20612042
}
20622043

2063-
void FileViewTree::OnRetagInProgressUI(wxUpdateUIEvent& event)
2064-
{
2065-
event.Enable(!ManagerST::Get()->GetRetagInProgress());
2066-
}
2067-
20682044
void FileViewTree::OnOpenWithDefaultApplication(wxCommandEvent& event)
20692045
{
20702046
wxArrayTreeItemIds items;
@@ -2433,10 +2409,6 @@ void FileViewTree::OnFolderDropped(clCommandEvent& event)
24332409
evtOpenworkspace.SetEventObject(clMainFrame::Get());
24342410
clMainFrame::Get()->GetEventHandler()->AddPendingEvent(evtOpenworkspace);
24352411
}
2436-
2437-
// And trigger a full reparse of the workspace
2438-
wxCommandEvent evtOpenworkspace(wxEVT_MENU, XRCID("full_retag_workspace"));
2439-
clMainFrame::Get()->GetEventHandler()->AddPendingEvent(evtOpenworkspace);
24402412
}
24412413

24422414
void FileViewTree::FolderDropped(const wxArrayString& folders)

LiteEditor/fileview.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,8 @@ class FileViewTree : public clThemedTreeCtrl
164164
virtual void OnCleanProjectOnly(wxCommandEvent& event);
165165
virtual void OnRebuildProjectOnly(wxCommandEvent& event);
166166
virtual void OnStopBuild(wxCommandEvent& event);
167-
virtual void OnRetagProject(wxCommandEvent& event);
168-
virtual void OnRetagWorkspace(wxCommandEvent& event);
169167
virtual void OnBuildInProgress(wxUpdateUIEvent& event);
170168
virtual void OnExcludeFromBuildUI(wxUpdateUIEvent& event);
171-
virtual void OnRetagInProgressUI(wxUpdateUIEvent& event);
172169
virtual void OnItemBeginDrag(wxTreeEvent& event);
173170
virtual void OnItemEndDrag(wxTreeEvent& event);
174171
virtual void OnImportDirectory(wxCommandEvent& e);

LiteEditor/mainbook.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,18 +1031,6 @@ void MainBook::ReloadExternallyModified(bool prompt)
10311031

10321032
// reset the recursive protector
10331033
depth = wxNOT_FOUND;
1034-
1035-
std::vector<wxFileName> filesToRetag;
1036-
for (size_t i = 0; i < files.size(); i++) {
1037-
if (files[i].second) {
1038-
editors[i]->ReloadFromDisk(true);
1039-
filesToRetag.push_back(files[i].first);
1040-
}
1041-
}
1042-
1043-
if (filesToRetag.size() > 1) {
1044-
TagsManagerST::Get()->ParseWorkspaceIncremental();
1045-
}
10461034
}
10471035

10481036
bool MainBook::ClosePage(wxWindow* page)

LiteEditor/manager.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ Manager::Manager()
259259
, m_tipWinPos(wxNOT_FOUND)
260260
, m_frameLineno(wxNOT_FOUND)
261261
, m_watchDlg(NULL)
262-
, m_retagInProgress(false)
263262
{
264263
Bind(wxEVT_RESTART_CODELITE, &Manager::OnRestart, this);
265264
Bind(wxEVT_FORCE_RESTART_CODELITE, &Manager::OnForcedRestart, this);
@@ -649,7 +648,6 @@ void Manager::CreateProject(ProjectData& data, const wxString& workspaceFolder)
649648
}
650649

651650
wxString projectName = proj->GetName();
652-
RetagProject(projectName, true);
653651

654652
// Update the parser search paths
655653
CallAfter(&Manager::UpdateParserPaths, false);
@@ -681,7 +679,6 @@ void Manager::AddProject(const wxString& path)
681679

682680
wxFileName fn(path);
683681
wxString projectName(fn.GetName());
684-
RetagProject(projectName, true);
685682

686683
clCommandEvent evtProjectAdded(wxEVT_PROJ_ADDED);
687684
evtProjectAdded.SetString(projectName);
@@ -879,21 +876,6 @@ void Manager::GetWorkspaceFiles(std::vector<wxFileName>& files, bool absPath)
879876
}
880877
}
881878

882-
void Manager::RetagWorkspace(TagsManager::RetagType type)
883-
{
884-
if (!clWorkspaceManager::Get().IsWorkspaceOpened()) {
885-
return;
886-
}
887-
888-
if (type == TagsManager::Retag_Quick) {
889-
TagsManagerST::Get()->ParseWorkspaceIncremental();
890-
} else {
891-
TagsManagerST::Get()->ParseWorkspaceFull(clWorkspaceManager::Get().GetWorkspace()->GetDir());
892-
}
893-
}
894-
895-
void Manager::RetagFile(const wxString& filename) { wxUnusedVar(filename); }
896-
897879
//--------------------------- Project Files Mgmt -----------------------------
898880

899881
int Manager::AddVirtualDirectory(const wxString& virtualDirFullPath, bool createIt)
@@ -1046,11 +1028,6 @@ void Manager::AddFilesToProject(const wxArrayString& files, const wxString& vdFu
10461028
vFiles.push_back(actualAdded.Item(i));
10471029
}
10481030

1049-
// re-tag the added files
1050-
if (vFiles.empty() == false) {
1051-
TagsManagerST::Get()->ParseWorkspaceIncremental();
1052-
}
1053-
10541031
if (!actualAdded.IsEmpty()) {
10551032
clCommandEvent evtAddFiles(wxEVT_PROJ_FILE_ADDED);
10561033
evtAddFiles.SetStrings(actualAdded);
@@ -1123,9 +1100,6 @@ bool Manager::RenameFile(const wxString& origName, const wxString& newName, cons
11231100
ProjectPtr proj = GetProject(projName);
11241101
proj->FastAddFile(newName, vdFullPath.AfterFirst(wxT(':')));
11251102

1126-
// Step 3: retag the new file
1127-
RetagFile(newName);
1128-
11291103
// Step 4: send an event about new file was added
11301104
// to the workspace
11311105
wxArrayString files;
@@ -1249,7 +1223,6 @@ void Manager::RetagProject(const wxString& projectName, bool quickRetag)
12491223
{
12501224
wxUnusedVar(projectName);
12511225
wxUnusedVar(quickRetag);
1252-
TagsManagerST::Get()->ParseWorkspaceIncremental();
12531226
}
12541227

12551228
void Manager::GetProjectFiles(const wxString& project, wxArrayString& files)

LiteEditor/manager.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class Manager : public wxEvtHandler, public IDebuggerObserver
9595
std::list<QueueCommand> m_buildQueue;
9696
wxArrayString m_dbgWatchExpressions;
9797
DisplayVariableDlg* m_watchDlg;
98-
bool m_retagInProgress;
9998
DbgStackInfo m_dbgCurrentFrameInfo;
10099
PerspectiveManager m_perspectiveManager;
101100
clDebuggerTerminalPOSIX m_debuggerTerminal;
@@ -111,9 +110,6 @@ class Manager : public wxEvtHandler, public IDebuggerObserver
111110

112111
PerspectiveManager& GetPerspectiveManager() { return m_perspectiveManager; }
113112

114-
void SetRetagInProgress(bool retagInProgress) { this->m_retagInProgress = retagInProgress; }
115-
bool GetRetagInProgress() const { return m_retagInProgress; }
116-
117113
const wxString& GetOriginalCwd() const { return m_originalCwd; }
118114
void SetOriginalCwd(const wxString& path) { m_originalCwd = path; }
119115

@@ -298,17 +294,6 @@ class Manager : public wxEvtHandler, public IDebuggerObserver
298294
*/
299295
void GetWorkspaceFiles(std::vector<wxFileName>& files, bool absPath = false);
300296

301-
/**
302-
* retag workspace
303-
*/
304-
void RetagWorkspace(TagsManager::RetagType type);
305-
306-
/**
307-
* @brief retag a given file
308-
* @param filename
309-
*/
310-
void RetagFile(const wxString& filename);
311-
312297
/**
313298
* @brief Launch the ParseThread to update the preprocessor visualization
314299
* @param filename

Plugin/FileSystemWorkspace/clFileSystemWorkspace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ void clFileSystemWorkspace::OnFileSystemUpdated(clFileSystemEvent& event)
10471047
}
10481048
}
10491049

1050-
void cl`ystemWorkspace::CreateCompileFlagsFile()
1050+
void clFileSystemWorkspace::CreateCompileFlagsFile()
10511051
{
10521052
wxBusyCursor bc;
10531053
const wxFileName& filename = clFileSystemWorkspace::Get().GetFileName();

0 commit comments

Comments
 (0)