diff --git a/shell/problemmodel.h b/shell/problemmodel.h --- a/shell/problemmodel.h +++ b/shell/problemmodel.h @@ -133,6 +133,20 @@ /// Retrieve problems for selected document QVector problems(const KDevelop::IndexedString& document); + /** + * Clear current problems and add new "placeholder" item (problem). + * + * The method should be used to notify user about some events. For example, analyzer plugin + * can set placeholders at analysis state changes - started/finished without errors/etc. + * + * \param[in] text Sets problem description. + * \param[in] source Sets problem sourceString() return value. + * \param[in] location Sets problem final location. + */ + void setPlaceHolderText(const QString& text, + const QString& source, + const KDevelop::DocumentRange& location = KDevelop::DocumentRange()); + /// Retrieve the supported features Features features() const; diff --git a/shell/problemmodel.cpp b/shell/problemmodel.cpp --- a/shell/problemmodel.cpp +++ b/shell/problemmodel.cpp @@ -225,6 +225,22 @@ } } +void ProblemModel::setPlaceHolderText( + const QString& text, + const QString& source, + const KDevelop::DocumentRange& location) +{ + IProblem::Ptr placeholderProblem(new DetectedProblem); + + placeholderProblem->setSeverity(KDevelop::IProblem::Hint); + placeholderProblem->setDescription(text); + placeholderProblem->setSource(IProblem::Plugin); + placeholderProblem->setPluginName(source); + placeholderProblem->setFinalLocation(location); + + setProblems({ placeholderProblem }); +} + ProblemModel::Features ProblemModel::features() const { return d->m_features;