From 704b1a4e9aa1d50efcaae70aeb425aa6d4f2a2e2 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 24 Jul 2018 14:28:19 +0200 Subject: [PATCH] logic: Disable activation of errors while indexing --- CHANGELOG.md | 41 +++++++++++++++++++ .../component/controller/ErrorController.cpp | 25 ++++++++++- .../component/controller/ErrorController.h | 1 + .../controller/UndoRedoController.cpp | 30 +++++++++++++- 4 files changed, 93 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a40758f2..0ef246c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ ### Changelog +#### 2018.3.0 +released 2018-07-24 + +* C/C++: Fixed file logging broken when indexing a compilation database project in single process +* Only prefill system specific paths in application settings once +* Added check if entered project name is a valid file name +* Windows: Fixed names of available header path detectors +* Graph: Show graph legend via 'legend' command or '?' button in the lower right corner (issue #308, #540) +* C/C++: Ship clang compiler headers also for Windows +* Code: Added on-demand local reference navigation to code view navigation bar (issue #453, #538) +* Improved button texts for "reindexing required" dialog +* Code: Scroll code horizontally to active source location if out of view +* Graph: Added show definition context menu action/shortcut to show definition of any node in the code (issue #83) +* Improved project loading speed +* Create project directory during project setup if not existing +* Tooltip: Show function/method signatures exactly as declared in source file +* Search: Improved autocompletion scoring to process more symbols +* Search: Fixed autocompletions fail with wide characters (issue #598) +* Windows: Show error text when opening external .dll fails +* C/C++: Highlight opening and closing brackets in code when hovering either one (issue #12) +* macOS: Fixed start screen not disappearing when launching Sourcetrail by opening a project +* Graph: Fixed restoring of scroll position in graph on undo broken +* Graph: Hide children with type use edges to parent if parent is active +* Bookmark: Fixed bookmark creator dialog header not visible +* Graph: Show parameters for functions/methods with same name (issue #259) +* Graph: exporting graph as .svg (issue #596) +* Show indexing progress bar in status bar +* Keep browsing old project state while indexing (issue #175) +* Java: Added support for Java 10 +* Check if Sonargraph paths exist before allowing to continue. +* Added project setup from Sonargraph project for C, C++ and Java. +* Migrate old ".coatiproject" settings to new ".srctrlprj" extension when loading project +* Allow discarding unfinished index when aborting indexing +* Fixed partly indexed project can't be opened after closing while indexing (issue #594) +* C/C++: Show translation unit of indexing errors +* Fixed activating history item from menu showed wrong symbol (issue #572) +* Fixed all errors shown when only showing errors for certain file and changing error filter (issue #577) +* Added page steps to project setup dialogs +* C/C++: Make complete file incomplete if it has errors in later translation units + + #### 2018.2.77 released 2018-06-18 diff --git a/src/lib/component/controller/ErrorController.cpp b/src/lib/component/controller/ErrorController.cpp index 995d19b0..447d00fb 100644 --- a/src/lib/component/controller/ErrorController.cpp +++ b/src/lib/component/controller/ErrorController.cpp @@ -3,6 +3,7 @@ #include "Application.h" #include "component/view/DialogView.h" #include "data/access/StorageAccess.h" +#include "project/Project.h" #include "settings/ApplicationSettings.h" ErrorController::ErrorController(StorageAccess* storageAccess) @@ -114,12 +115,18 @@ void ErrorController::handleMessage(MessageErrorCountUpdate* message) void ErrorController::handleMessage(MessageErrorsAll* message) { - MessageActivateErrors(getView()->getErrorFilter()).dispatch(); + if (canDisplayErrors()) + { + MessageActivateErrors(getView()->getErrorFilter()).dispatch(); + } } void ErrorController::handleMessage(MessageErrorsForFile* message) { - MessageActivateErrors(ErrorFilter(), message->file).dispatch(); + if (canDisplayErrors()) + { + MessageActivateErrors(ErrorFilter(), message->file).dispatch(); + } } void ErrorController::handleMessage(MessageErrorsHelpMessage* message) @@ -205,3 +212,17 @@ bool ErrorController::showErrors(const ErrorFilter& filter, bool scrollTo) return errors.size(); } + +bool ErrorController::canDisplayErrors() const +{ + Project* project = Application::getInstance()->getCurrentProject().get(); + if (project && project->isIndexing()) + { + Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm( + "Errors cannot be activated while indexing." + ); + return false; + } + + return true; +} diff --git a/src/lib/component/controller/ErrorController.h b/src/lib/component/controller/ErrorController.h index 7e39f76e..d0f19aca 100644 --- a/src/lib/component/controller/ErrorController.h +++ b/src/lib/component/controller/ErrorController.h @@ -61,6 +61,7 @@ private: virtual void clear(); bool showErrors(const ErrorFilter& filter, bool scrollTo); + bool canDisplayErrors() const; StorageAccess* m_storageAccess; diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index e7178a75..daa735e1 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -7,6 +7,7 @@ #include "Application.h" #include "component/view/UndoRedoView.h" #include "data/access/StorageAccess.h" +#include "project/Project.h" UndoRedoController::UndoRedoController(StorageAccess* storageAccess) : m_storageAccess(storageAccess) @@ -473,8 +474,6 @@ void UndoRedoController::replayCommands(std::list::iterator it) void UndoRedoController::replayCommand(std::list::iterator it) { std::shared_ptr m = it->message; - m->setIsReplayed(true); - m->setIsLast(it == std::prev(m_iterator)); if (m->getType() == MessageActivateTokens::getStaticType()) { @@ -489,6 +488,33 @@ void UndoRedoController::replayCommand(std::list::iterator it) msg->searchMatches = ret.second; } } + else if (m->getType() == MessageActivateErrors::getStaticType()) + { + Project* project = Application::getInstance()->getCurrentProject().get(); + if (project && project->isIndexing()) + { + Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm( + "Errors cannot be activated while indexing." + ); + + ErrorFilter filter; + filter.error = false; + filter.fatal = false; + filter.unindexedError = false; + filter.unindexedFatal = false; + + MessageActivateErrors msg(filter); + msg.setIsReplayed(true); + msg.setIsLast(it == std::prev(m_iterator)); + msg.dispatch(); + + return; + } + + } + + m->setIsReplayed(true); + m->setIsLast(it == std::prev(m_iterator)); m->dispatch();