forked from qt-creator/qt-creator
		
	replace ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() by Core::ICore::instance()
This commit is contained in:
		@@ -433,10 +433,10 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
 | 
			
		||||
    modified within Workbench.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
CppModelManager::CppModelManager(QObject *parent) :
 | 
			
		||||
    CppModelManagerInterface(parent),
 | 
			
		||||
    m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>())
 | 
			
		||||
CppModelManager::CppModelManager(QObject *parent)
 | 
			
		||||
    : CppModelManagerInterface(parent)
 | 
			
		||||
{
 | 
			
		||||
    m_core = Core::ICore::instance(); // FIXME
 | 
			
		||||
    m_dirty = true;
 | 
			
		||||
 | 
			
		||||
    m_projectExplorer = ExtensionSystem::PluginManager::instance()
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ namespace ProjectExplorer {
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
 | 
			
		||||
class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject
 | 
			
		||||
class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -65,10 +65,8 @@ enum { debug = 0 };
 | 
			
		||||
 | 
			
		||||
CppToolsPlugin *CppToolsPlugin::m_instance = 0;
 | 
			
		||||
 | 
			
		||||
CppToolsPlugin::CppToolsPlugin() :
 | 
			
		||||
    m_core(0),
 | 
			
		||||
    m_context(-1),
 | 
			
		||||
    m_modelManager(0)
 | 
			
		||||
CppToolsPlugin::CppToolsPlugin()
 | 
			
		||||
    : m_context(-1), m_modelManager(0)
 | 
			
		||||
{
 | 
			
		||||
    m_instance = this;
 | 
			
		||||
}
 | 
			
		||||
@@ -79,21 +77,23 @@ CppToolsPlugin::~CppToolsPlugin()
 | 
			
		||||
    m_modelManager = 0; // deleted automatically
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
 | 
			
		||||
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
 | 
			
		||||
{
 | 
			
		||||
    m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
 | 
			
		||||
    Core::ActionManager *am = m_core->actionManager();
 | 
			
		||||
    Q_UNUSED(arguments);
 | 
			
		||||
    Q_UNUSED(error);
 | 
			
		||||
    Core::ICore *core = Core::ICore::instance();
 | 
			
		||||
    Core::ActionManager *am = core->actionManager();
 | 
			
		||||
 | 
			
		||||
    // Objects
 | 
			
		||||
    m_modelManager = new CppModelManager(this);
 | 
			
		||||
    addAutoReleasedObject(m_modelManager);
 | 
			
		||||
    m_completion = new CppCodeCompletion(m_modelManager, m_core);
 | 
			
		||||
    m_completion = new CppCodeCompletion(m_modelManager, core);
 | 
			
		||||
    addAutoReleasedObject(m_completion);
 | 
			
		||||
    CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
 | 
			
		||||
                                                                 m_core->editorManager());
 | 
			
		||||
                                                                 core->editorManager());
 | 
			
		||||
    addAutoReleasedObject(quickOpenFilter);
 | 
			
		||||
    addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
 | 
			
		||||
    addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager()));
 | 
			
		||||
    addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager()));
 | 
			
		||||
    addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager()));
 | 
			
		||||
    addAutoReleasedObject(new CompletionSettingsPage(m_completion));
 | 
			
		||||
 | 
			
		||||
    // Menus
 | 
			
		||||
@@ -105,7 +105,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
 | 
			
		||||
    mtools->addMenu(mcpptools);
 | 
			
		||||
 | 
			
		||||
    // Actions
 | 
			
		||||
    m_context = m_core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
 | 
			
		||||
    m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
 | 
			
		||||
    QList<int> context = QList<int>() << m_context;
 | 
			
		||||
 | 
			
		||||
    QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
 | 
			
		||||
@@ -115,7 +115,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
 | 
			
		||||
    connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));
 | 
			
		||||
 | 
			
		||||
    // Restore settings
 | 
			
		||||
    QSettings *settings = m_core->settings();
 | 
			
		||||
    QSettings *settings = Core::ICore::instance()->settings();
 | 
			
		||||
    settings->beginGroup(QLatin1String("CppTools"));
 | 
			
		||||
    settings->beginGroup(QLatin1String("Completion"));
 | 
			
		||||
    const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool();
 | 
			
		||||
@@ -135,7 +135,7 @@ void CppToolsPlugin::extensionsInitialized()
 | 
			
		||||
void CppToolsPlugin::shutdown()
 | 
			
		||||
{
 | 
			
		||||
    // Save settings
 | 
			
		||||
    QSettings *settings = m_core->settings();
 | 
			
		||||
    QSettings *settings = Core::ICore::instance()->settings();
 | 
			
		||||
    settings->beginGroup(QLatin1String("CppTools"));
 | 
			
		||||
    settings->beginGroup(QLatin1String("Completion"));
 | 
			
		||||
    settings->setValue(QLatin1String("CaseSensitive"), m_completion->caseSensitivity() == Qt::CaseSensitive);
 | 
			
		||||
@@ -147,14 +147,12 @@ void CppToolsPlugin::shutdown()
 | 
			
		||||
 | 
			
		||||
void CppToolsPlugin::switchHeaderSource()
 | 
			
		||||
{
 | 
			
		||||
    if (!m_core)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    Core::IEditor *editor = m_core->editorManager()->currentEditor();
 | 
			
		||||
    Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
 | 
			
		||||
    Core::IEditor *editor = editorManager->currentEditor();
 | 
			
		||||
    QString otherFile = correspondingHeaderOrSource(editor->file()->fileName());
 | 
			
		||||
    if (!otherFile.isEmpty()) {
 | 
			
		||||
        m_core->editorManager()->openEditor(otherFile);
 | 
			
		||||
        m_core->editorManager()->ensureEditorManagerVisible();
 | 
			
		||||
        editorManager->openEditor(otherFile);
 | 
			
		||||
        editorManager->ensureEditorManagerVisible();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -222,7 +220,7 @@ static QStringList matchingCandidateSuffixes(const Core::MimeDatabase *mimeDatas
 | 
			
		||||
 | 
			
		||||
QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) const
 | 
			
		||||
{
 | 
			
		||||
    const Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
 | 
			
		||||
    const Core::ICore *core = Core::ICore::instance();
 | 
			
		||||
    const Core::MimeDatabase *mimeDatase = core->mimeDatabase();
 | 
			
		||||
    ProjectExplorer::ProjectExplorerPlugin *explorer =
 | 
			
		||||
        ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
 | 
			
		||||
 
 | 
			
		||||
@@ -42,10 +42,6 @@ class QFileInfo;
 | 
			
		||||
class QDir;
 | 
			
		||||
QT_END_NAMESPACE
 | 
			
		||||
 | 
			
		||||
namespace Core {
 | 
			
		||||
class ICore;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
@@ -75,7 +71,6 @@ private:
 | 
			
		||||
    QString correspondingHeaderOrSourceI(const QString &fileName) const;
 | 
			
		||||
    QFileInfo findFile(const QDir &dir, const QString &name, const ProjectExplorer::Project *project) const;
 | 
			
		||||
 | 
			
		||||
    Core::ICore *m_core;
 | 
			
		||||
    int m_context;
 | 
			
		||||
    CppModelManager *m_modelManager;
 | 
			
		||||
    CppCodeCompletion *m_completion;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user