Commit 3114780e authored by Marco Bubke's avatar Marco Bubke

CppTools: Add CppModelManager::isManagedById

Change-Id: Ica1a33b2619f64746b8671bff2856503775a40bf
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 6e14eb69
......@@ -107,6 +107,15 @@ void CppCodeModelSettings::setModelManagerSupportIdForMimeType(const QString &mi
m_modelManagerSupportByMimeType.insert(theMimeType, id);
}
bool CppCodeModelSettings::hasModelManagerSupportIdForMimeType(const QString &mimeType,
const QString &id) const
{
if (mimeType == cHeaderMimeType)
return m_modelManagerSupportByMimeType.value(cppHeaderMimeType) == id;
else
return m_modelManagerSupportByMimeType.value(mimeType) == id;
}
void CppCodeModelSettings::setIdForMimeType(const QVariant &var, const QString &mimeType)
{
QHash<QString, QVariant> mimeToId = var.toHash();
......
......@@ -62,6 +62,7 @@ public:
QString modelManagerSupportIdForMimeType(const QString &mimeType) const;
void setModelManagerSupportIdForMimeType(const QString &mimeType, const QString &id);
bool hasModelManagerSupportIdForMimeType(const QString &mimeType, const QString &id) const;
const QHash<QString, QString> &availableModelManagerSupportProvidersByName() const
{ return m_modelManagerSupportsByName; }
......
......@@ -951,6 +951,14 @@ bool CppModelManager::isCppEditor(Core::IEditor *editor) const
return editor->context().contains(ProjectExplorer::Constants::LANG_CXX);
}
bool CppModelManager::isManagedByModelManagerSupport(Core::IDocument *document, const QString &id) const
{
auto documentMimeTupe = document->mimeType();
auto codeModelSettings = CppToolsPlugin::instance()->codeModelSettings();
return codeModelSettings->hasModelManagerSupportIdForMimeType(documentMimeTupe, id);
}
void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
{
if (replaceDocument(doc))
......
......@@ -42,7 +42,11 @@
#include <QObject>
#include <QStringList>
namespace Core { class IEditor; }
namespace Core {
class IDocument;
class IEditor;
}
namespace CPlusPlus { class LookupContext; }
namespace ProjectExplorer { class Project; }
namespace TextEditor { class TextDocument; }
......@@ -116,6 +120,7 @@ public:
void emitAbstractEditorSupportRemoved(const QString &filePath);
bool isCppEditor(Core::IEditor *editor) const;
bool isManagedByModelManagerSupport(Core::IDocument *document, const QString &id) const;
QSet<AbstractEditorSupport*> abstractEditorSupports() const;
void addExtraEditorSupport(AbstractEditorSupport *editorSupport);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment