summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-01-20 11:52:04 +0100
committerhjk <qtc-committer@nokia.com>2009-01-20 11:52:04 +0100
commit113b81e9dbc67dab5252eb9b6a8aaa57efda3de0 (patch)
tree7a80819280d648a2cdd1eecf1cf645d6bbcc64d5 /src/plugins/cpptools
parentd1dac15cc57549ac7da6c6007685e5bacdbf1828 (diff)
downloadqt-creator-113b81e9dbc67dab5252eb9b6a8aaa57efda3de0.tar.gz
replace ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() by Core::ICore::instance()
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp6
-rw-r--r--src/plugins/cpptools/cppmodelmanagerinterface.h2
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.cpp40
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.h5
4 files changed, 23 insertions, 30 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index 177b40f03e..75f64fea5d 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -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()
diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h
index ca1c57f863..849c3c691f 100644
--- a/src/plugins/cpptools/cppmodelmanagerinterface.h
+++ b/src/plugins/cpptools/cppmodelmanagerinterface.h
@@ -46,7 +46,7 @@ namespace ProjectExplorer {
namespace CppTools {
-class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject
+class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject
{
Q_OBJECT
diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp
index cd45cb356c..c28c4a8127 100644
--- a/src/plugins/cpptools/cpptoolsplugin.cpp
+++ b/src/plugins/cpptools/cpptoolsplugin.cpp
@@ -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>();
diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h
index 092de535b3..281fe1f708 100644
--- a/src/plugins/cpptools/cpptoolsplugin.h
+++ b/src/plugins/cpptools/cpptoolsplugin.h
@@ -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;