replace ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() by Core::ICore::instance()

This commit is contained in:
hjk
2009-01-20 11:52:04 +01:00
parent d1dac15cc5
commit 113b81e9db
85 changed files with 432 additions and 613 deletions

View File

@@ -42,16 +42,16 @@
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <coreplugin/icore.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <find/ifindsupport.h> #include <find/ifindsupport.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
#include <utils/linecolumnlabel.h> #include <utils/linecolumnlabel.h>
#include <utils/reloadpromptutils.h> #include <utils/reloadpromptutils.h>
@@ -205,7 +205,7 @@ public:
break; break;
} }
switch (Core::Utils::reloadPrompt(fileName, BinEditorPlugin::core()->mainWindow())) { switch (Core::Utils::reloadPrompt(fileName, Core::ICore::instance()->mainWindow())) {
case Core::Utils::ReloadCurrent: case Core::Utils::ReloadCurrent:
open(fileName); open(fileName);
break; break;
@@ -231,12 +231,15 @@ class BinEditorInterface : public Core::IEditor
{ {
Q_OBJECT Q_OBJECT
public: public:
BinEditorInterface(BinEditor *parent ) : Core::IEditor(parent) { BinEditorInterface(BinEditor *parent)
: Core::IEditor(parent)
{
Core::ICore *core = Core::ICore::instance();
m_editor = parent; m_editor = parent;
m_file = new BinEditorFile(parent); m_file = new BinEditorFile(parent);
m_context << BinEditorPlugin::core()->uniqueIDManager()-> m_context << core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR); uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
m_context << BinEditorPlugin::core()->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Core::Utils::LineColumnLabel; m_cursorPositionLabel = new Core::Utils::LineColumnLabel;
QHBoxLayout *l = new QHBoxLayout; QHBoxLayout *l = new QHBoxLayout;
@@ -317,7 +320,8 @@ QString BinEditorFactory::kind() const
Core::IFile *BinEditorFactory::open(const QString &fileName) Core::IFile *BinEditorFactory::open(const QString &fileName)
{ {
Core::IEditor *iface = m_owner->m_core->editorManager()->openEditor(fileName, kind()); Core::ICore *core = Core::ICore::instance();
Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0; return iface ? iface->file() : 0;
} }
@@ -337,8 +341,7 @@ QStringList BinEditorFactory::mimeTypes() const
BinEditorPlugin *BinEditorPlugin::m_instance = 0; BinEditorPlugin *BinEditorPlugin::m_instance = 0;
BinEditorPlugin::BinEditorPlugin() : BinEditorPlugin::BinEditorPlugin()
m_core(0)
{ {
m_undoAction = m_redoAction = m_copyAction = m_selectAllAction = 0; m_undoAction = m_redoAction = m_copyAction = m_selectAllAction = 0;
m_instance = this; m_instance = this;
@@ -354,16 +357,11 @@ BinEditorPlugin *BinEditorPlugin::instance()
return m_instance; return m_instance;
} }
Core::ICore *BinEditorPlugin::core()
{
return m_instance->m_core;
}
QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title) QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title)
{ {
QAction *result = new QAction(title, this); QAction *result = new QAction(title, this);
m_core->actionManager()->registerAction(result, id, m_context); Core::ICore::instance()->actionManager()->registerAction(result, id, m_context);
return result; return result;
} }
@@ -386,7 +384,8 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed())); QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed()));
editor->setEditorInterface(editorInterface); editor->setEditorInterface(editorInterface);
m_context << BinEditorPlugin::core()->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR);
if (!m_undoAction) { if (!m_undoAction) {
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO), m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
this, SLOT(undoAction()), this, SLOT(undoAction()),
@@ -416,13 +415,16 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
aggregate->add(editor); aggregate->add(editor);
} }
bool BinEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool BinEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/bineditor/BinEditor.mimetypes.xml"), errorMessage)) Q_UNUSED(errorMessage);
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/bineditor/BinEditor.mimetypes.xml"), errorMessage))
return false; return false;
connect(m_core, SIGNAL(contextAboutToChange(Core::IContext *)), connect(core, SIGNAL(contextAboutToChange(Core::IContext *)),
this, SLOT(updateCurrentEditor(Core::IContext *))); this, SLOT(updateCurrentEditor(Core::IContext *)));
addAutoReleasedObject(new BinEditorFactory(this)); addAutoReleasedObject(new BinEditorFactory(this));

View File

@@ -62,7 +62,6 @@ public:
~BinEditorPlugin(); ~BinEditorPlugin();
static BinEditorPlugin *instance(); static BinEditorPlugin *instance();
static Core::ICore *core();
bool initialize(const QStringList &arguments, QString *error_message = 0); bool initialize(const QStringList &arguments, QString *error_message = 0);
void extensionsInitialized(); void extensionsInitialized();

View File

@@ -58,6 +58,7 @@ Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
using namespace Bookmarks; using namespace Bookmarks;
using namespace Bookmarks::Internal; using namespace Bookmarks::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Core;
BookmarkDelegate::BookmarkDelegate(QObject *parent) BookmarkDelegate::BookmarkDelegate(QObject *parent)
: QStyledItemDelegate(parent), m_normalPixmap(0), m_selectedPixmap(0) : QStyledItemDelegate(parent), m_normalPixmap(0), m_selectedPixmap(0)
@@ -214,8 +215,7 @@ BookmarkView::BookmarkView(QWidget *parent)
this, SLOT(gotoBookmark(const QModelIndex &))); this, SLOT(gotoBookmark(const QModelIndex &)));
m_bookmarkContext = new BookmarkContext(this); m_bookmarkContext = new BookmarkContext(this);
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); ICore::instance()->addContextObject(m_bookmarkContext);
core->addContextObject(m_bookmarkContext);
setItemDelegate(new BookmarkDelegate(this)); setItemDelegate(new BookmarkDelegate(this));
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
@@ -225,8 +225,7 @@ BookmarkView::BookmarkView(QWidget *parent)
BookmarkView::~BookmarkView() BookmarkView::~BookmarkView()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); ICore::instance()->removeContextObject(m_bookmarkContext);
core->removeContextObject(m_bookmarkContext);
} }
void BookmarkView::contextMenuEvent(QContextMenuEvent *event) void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
@@ -246,13 +245,11 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
connect(removeAll, SIGNAL(triggered()), connect(removeAll, SIGNAL(triggered()),
this, SLOT(removeAll())); this, SLOT(removeAll()));
menu.exec(mapToGlobal(event->pos())); menu.exec(mapToGlobal(event->pos()));
} }
void BookmarkView::removeFromContextMenu() void BookmarkView::removeFromContextMenu()
{ {
removeBookmark(m_contextMenuIndex); removeBookmark(m_contextMenuIndex);
} }
@@ -296,7 +293,7 @@ void BookmarkView::gotoBookmark(const QModelIndex &index)
BookmarkContext::BookmarkContext(BookmarkView *widget) BookmarkContext::BookmarkContext(BookmarkView *widget)
: m_bookmarkView(widget) : m_bookmarkView(widget)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
} }
@@ -315,15 +312,14 @@ QWidget *BookmarkContext::widget()
//// ////
BookmarkManager::BookmarkManager() : BookmarkManager::BookmarkManager() :
m_core(BookmarksPlugin::core()),
m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png"))) m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png")))
{ {
m_selectionModel = new QItemSelectionModel(this, this); m_selectionModel = new QItemSelectionModel(this, this);
connect(m_core, SIGNAL(contextChanged(Core::IContext*)), connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)),
this, SLOT(updateActionStatus())); this, SLOT(updateActionStatus()));
ExtensionSystem::PluginManager *pm = m_core->pluginManager(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *projectExplorer = pm->getObject<ProjectExplorerPlugin>(); ProjectExplorerPlugin *projectExplorer = pm->getObject<ProjectExplorerPlugin>();
connect(projectExplorer->session(), SIGNAL(sessionLoaded()), connect(projectExplorer->session(), SIGNAL(sessionLoaded()),
@@ -513,7 +509,8 @@ void BookmarkManager::documentPrevNext(bool next)
nextLine = markLine; nextLine = markLine;
} }
m_core->editorManager()->addCurrentPositionToNavigationHistory(true); Core::EditorManager *em = Core::ICore::instance()->editorManager();
em->addCurrentPositionToNavigationHistory(true);
if (next) { if (next) {
if (nextLine == -1) if (nextLine == -1)
editor->gotoLine(firstLine); editor->gotoLine(firstLine);
@@ -525,7 +522,7 @@ void BookmarkManager::documentPrevNext(bool next)
else else
editor->gotoLine(prevLine); editor->gotoLine(prevLine);
} }
m_core->editorManager()->addCurrentPositionToNavigationHistory(); em->addCurrentPositionToNavigationHistory();
} }
void BookmarkManager::next() void BookmarkManager::next()
@@ -557,7 +554,8 @@ void BookmarkManager::prev()
TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
{ {
Core::IEditor *currEditor = m_core->editorManager()->currentEditor(); Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::IEditor *currEditor = em->currentEditor();
if (!currEditor) if (!currEditor)
return 0; return 0;
return qobject_cast<TextEditor::ITextEditor *>(currEditor); return qobject_cast<TextEditor::ITextEditor *>(currEditor);
@@ -566,7 +564,7 @@ TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
/* Returns the current session. */ /* Returns the current session. */
SessionManager *BookmarkManager::sessionManager() const SessionManager *BookmarkManager::sessionManager() const
{ {
ExtensionSystem::PluginManager *pm = m_core->pluginManager(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>(); ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>();
return pe->session(); return pe->session();
} }

View File

@@ -48,7 +48,6 @@ class SessionManager;
} }
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
} }
@@ -131,7 +130,6 @@ private:
typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap; typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap;
DirectoryFileBookmarksMap m_bookmarksMap; DirectoryFileBookmarksMap m_bookmarksMap;
Core::ICore *m_core;
QIcon m_bookmarkIcon; QIcon m_bookmarkIcon;

View File

@@ -57,7 +57,7 @@ using namespace TextEditor;
BookmarksPlugin *BookmarksPlugin::m_instance = 0; BookmarksPlugin *BookmarksPlugin::m_instance = 0;
BookmarksPlugin::BookmarksPlugin() BookmarksPlugin::BookmarksPlugin()
: m_bookmarkManager(0), m_core(0) : m_bookmarkManager(0)
{ {
m_instance = this; m_instance = this;
} }
@@ -68,13 +68,13 @@ void BookmarksPlugin::extensionsInitialized()
bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = core->actionManager();
QList<int> context = QList<int>() << m_core->uniqueIDManager()-> QList<int> context = QList<int>() << core->uniqueIDManager()->
uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
QList<int> textcontext, globalcontext; QList<int> textcontext, globalcontext;
textcontext << m_core->uniqueIDManager()-> textcontext << core->uniqueIDManager()->
uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
globalcontext << Core::Constants::C_GLOBAL_ID; globalcontext << Core::Constants::C_GLOBAL_ID;
@@ -172,7 +172,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
this, SLOT(bookmarkMarginActionTriggered())); this, SLOT(bookmarkMarginActionTriggered()));
// EditorManager // EditorManager
QObject *editorManager = m_core->editorManager(); QObject *editorManager = core->editorManager();
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(editorAboutToClose(Core::IEditor*))); this, SLOT(editorAboutToClose(Core::IEditor*)));
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),

View File

@@ -45,7 +45,6 @@ class QMenu;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
} }
@@ -67,7 +66,6 @@ public:
~BookmarksPlugin(); ~BookmarksPlugin();
static BookmarksPlugin *instance() { return m_instance; } static BookmarksPlugin *instance() { return m_instance; }
static Core::ICore *core() { return m_instance->m_core; }
bool initialize(const QStringList &arguments, QString *error_message); bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized(); void extensionsInitialized();
@@ -85,7 +83,6 @@ private slots:
private: private:
static BookmarksPlugin *m_instance; static BookmarksPlugin *m_instance;
BookmarkManager *m_bookmarkManager; BookmarkManager *m_bookmarkManager;
Core::ICore *m_core;
QAction *m_toggleAction; QAction *m_toggleAction;
QAction *m_prevAction; QAction *m_prevAction;

View File

@@ -37,7 +37,6 @@
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -45,7 +44,7 @@ using namespace CMakeProjectManager::Internal;
CMakeManager::CMakeManager() CMakeManager::CMakeManager()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT); m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
} }

View File

@@ -39,7 +39,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -57,7 +56,7 @@ CMakeProjectPlugin::~CMakeProjectPlugin()
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
return false; return false;
addAutoReleasedObject(new CMakeManager()); addAutoReleasedObject(new CMakeManager());

View File

@@ -61,7 +61,7 @@ namespace {
You get the only implementation of this class from the core interface You get the only implementation of this class from the core interface
ICore::actionManager() method, e.g. ICore::actionManager() method, e.g.
\code \code
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager() Core::ICore::instance()->actionManager()
\endcode \endcode
The main reasons for the need of this class is to provide a central place where the user The main reasons for the need of this class is to provide a central place where the user
@@ -80,8 +80,7 @@ namespace {
So to register a globally active action "My Action" So to register a globally active action "My Action"
put the following in your plugin's IPlugin::initialize method: put the following in your plugin's IPlugin::initialize method:
\code \code
Core::ActionManager *am = ExtensionSystem::PluginManager::instance() Core::ActionManager *am = Core::ICore::instance()->actionManager();
->getObject<Core::ICore>()->actionManager();
QAction *myAction = new QAction(tr("My Action"), this); QAction *myAction = new QAction(tr("My Action"), this);
Core::Command *cmd = am->registerAction(myAction, Core::Command *cmd = am->registerAction(myAction,
"myplugin.myaction", "myplugin.myaction",

View File

@@ -36,12 +36,21 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
namespace Core {
namespace Internal {
// The Core Singleton
static CoreImpl *m_instance = 0;
} // namespace Internal
} // namespace Core
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
CoreImpl *CoreImpl::m_instance = 0;
CoreImpl *CoreImpl::instance() ICore* ICore::instance()
{ {
return m_instance; return m_instance;
} }

View File

@@ -45,8 +45,6 @@ class CoreImpl : public ICore
Q_OBJECT Q_OBJECT
public: public:
static CoreImpl *instance();
CoreImpl(MainWindow *mainwindow); CoreImpl(MainWindow *mainwindow);
~CoreImpl() {} ~CoreImpl() {}
@@ -93,8 +91,6 @@ public:
private: private:
MainWindow *m_mainwindow; MainWindow *m_mainwindow;
friend class MainWindow; friend class MainWindow;
static CoreImpl *m_instance;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -51,10 +51,7 @@
You should never create a subclass of this interface. The one and only You should never create a subclass of this interface. The one and only
instance is created by the Core plugin. You can access this instance instance is created by the Core plugin. You can access this instance
from your plugin via the plugin manager, e.g. from your plugin through \c{Core::instance()}.
\code
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
\endcode
\mainclass \mainclass
*/ */

View File

@@ -74,6 +74,8 @@ public:
ICore() {} ICore() {}
virtual ~ICore() {} virtual ~ICore() {}
static ICore *instance();
virtual QStringList showNewItemDialog(const QString &title, virtual QStringList showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
const QString &defaultLocation = QString()) = 0; const QString &defaultLocation = QString()) = 0;

View File

@@ -217,7 +217,7 @@ void ModeManager::currentTabChanged(int index)
// FIXME: This hardcoded context update is required for the Debug and Edit modes, since // FIXME: This hardcoded context update is required for the Debug and Edit modes, since
// they use the editor widget, which is already a context widget so the main window won't // they use the editor widget, which is already a context widget so the main window won't
// go further up the parent tree to find the mode context. // go further up the parent tree to find the mode context.
CoreImpl *core = CoreImpl::instance(); ICore *core = ICore::instance();
foreach (const int context, m_addedContexts) foreach (const int context, m_addedContexts)
core->removeAdditionalContext(context); core->removeAdditionalContext(context);

View File

@@ -316,8 +316,8 @@ void NavigationWidget::objectAdded(QObject * obj)
if (!factory) if (!factory)
return; return;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); ICore *core = ICore::instance();
Core::ActionManager *am = core->actionManager(); ActionManager *am = core->actionManager();
QList<int> navicontext = QList<int>() << core->uniqueIDManager()-> QList<int> navicontext = QList<int>() << core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE); uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE);
@@ -399,9 +399,8 @@ NavigationSubWidget::~NavigationSubWidget()
void NavigationSubWidget::setCurrentIndex(int index) void NavigationSubWidget::setCurrentIndex(int index)
{ {
// Remove toolbutton // Remove toolbutton
foreach (QWidget *w, m_additionalToolBarWidgets) { foreach (QWidget *w, m_additionalToolBarWidgets)
delete w; delete w;
}
// Remove old Widget // Remove old Widget
delete m_navigationWidget; delete m_navigationWidget;
@@ -466,8 +465,7 @@ void NavigationSubWidget::setFactory(INavigationWidgetFactory *factory)
void NavigationSubWidget::setFactory(const QString &name) void NavigationSubWidget::setFactory(const QString &name)
{ {
for (int i = 0; i < m_navigationComboBox->count(); ++i) for (int i = 0; i < m_navigationComboBox->count(); ++i) {
{
INavigationWidgetFactory *factory = INavigationWidgetFactory *factory =
m_navigationComboBox->itemData(i).value<INavigationWidgetFactory *>(); m_navigationComboBox->itemData(i).value<INavigationWidgetFactory *>();
if (factory->displayName() == name) if (factory->displayName() == name)

View File

@@ -395,8 +395,7 @@ void OutputPane::showPage(int idx, bool focus)
if (!OutputPanePlaceHolder::m_current) { if (!OutputPanePlaceHolder::m_current) {
// In this mode we don't have a placeholder // In this mode we don't have a placeholder
// switch to the output mode and switch the page // switch to the output mode and switch the page
ICore *core = m_pluginManager->getObject<ICore>(); ICore::instance()->modeManager()->activateMode(Constants::MODE_OUTPUT);
core->modeManager()->activateMode(Constants::MODE_OUTPUT);
ensurePageVisible(idx); ensurePageVisible(idx);
} else { } else {
// else we make that page visible // else we make that page visible
@@ -411,14 +410,13 @@ void OutputPane::showPage(int idx, bool focus)
void OutputPane::togglePage(bool focus) void OutputPane::togglePage(bool focus)
{ {
int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender())); int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender()));
if(OutputPanePlaceHolder::m_current if (OutputPanePlaceHolder::m_current
&& OutputPanePlaceHolder::m_current->isVisible() && OutputPanePlaceHolder::m_current->isVisible()
&& m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) { && m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) {
slotHide(); slotHide();
} else { } else {
showPage(idx, focus); showPage(idx, focus);
} }
} }
void OutputPane::setCloseable(bool b) void OutputPane::setCloseable(bool b)

View File

@@ -38,16 +38,16 @@
#include "splitter.h" #include "splitter.h"
#include "view.h" #include "view.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/messageoutputwindow.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <coreplugin/messageoutputwindow.h>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -63,8 +63,6 @@ using namespace CodePaster;
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
Core::ICore *gCoreInstance = NULL;
CodepasterPlugin::CodepasterPlugin() CodepasterPlugin::CodepasterPlugin()
: m_settingsPage(0), m_fetcher(0), m_poster(0) : m_settingsPage(0), m_fetcher(0), m_poster(0)
{ {
@@ -84,11 +82,9 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
Q_UNUSED(arguments); Q_UNUSED(arguments);
Q_UNUSED(error_message); Q_UNUSED(error_message);
gCoreInstance = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
// Create the globalcontext list to register actions accordingly // Create the globalcontext list to register actions accordingly
QList<int> globalcontext; QList<int> globalcontext;
globalcontext << gCoreInstance->uniqueIDManager()-> globalcontext << ICore::instance()->uniqueIDManager()->
uniqueIdentifier(Core::Constants::C_GLOBAL); uniqueIdentifier(Core::Constants::C_GLOBAL);
// Create the settings Page // Create the settings Page
@@ -96,7 +92,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
addObject(m_settingsPage); addObject(m_settingsPage);
//register actions //register actions
Core::ActionManager *actionManager = gCoreInstance->actionManager(); Core::ActionManager *actionManager = ICore::instance()->actionManager();
Core::ActionContainer *toolsContainer = Core::ActionContainer *toolsContainer =
actionManager->actionContainer(Core::Constants::M_TOOLS); actionManager->actionContainer(Core::Constants::M_TOOLS);
@@ -133,7 +129,7 @@ void CodepasterPlugin::post()
{ {
if (m_poster) if (m_poster)
delete m_poster; delete m_poster;
IEditor* editor = gCoreInstance->editorManager()->currentEditor(); IEditor* editor = ICore::instance()->editorManager()->currentEditor();
ITextEditor* textEditor = qobject_cast<ITextEditor*>(editor); ITextEditor* textEditor = qobject_cast<ITextEditor*>(editor);
if (!textEditor) if (!textEditor)
return; return;
@@ -244,7 +240,7 @@ void CustomFetcher::customRequestFinished(int, bool error)
QByteArray data = body(); QByteArray data = body();
if (!m_listWidget) { if (!m_listWidget) {
QString title = QString::fromLatin1("Code Paster: %1").arg(m_id); QString title = QString::fromLatin1("Code Paster: %1").arg(m_id);
gCoreInstance->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR ICore::instance()->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR
, &title, data); , &title, data);
} else { } else {
m_listWidget->clear(); m_listWidget->clear();
@@ -284,7 +280,7 @@ void CustomPoster::customRequestFinished(int, bool error)
if (!error) { if (!error) {
if (m_copy) if (m_copy)
QApplication::clipboard()->setText(pastedUrl()); QApplication::clipboard()->setText(pastedUrl());
gCoreInstance->messageManager()->printToOutputPane(pastedUrl(), m_output); ICore::instance()->messageManager()->printToOutputPane(pastedUrl(), m_output);
} else } else
QMessageBox::warning(0, "Code Paster Error", "Some error occured while posting", QMessageBox::Ok); QMessageBox::warning(0, "Code Paster Error", "Some error occured while posting", QMessageBox::Ok);
#if 0 // Figure out how to access #if 0 // Figure out how to access

View File

@@ -34,7 +34,6 @@
#include "settingspage.h" #include "settingspage.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
@@ -46,10 +45,7 @@ using namespace CodePaster;
SettingsPage::SettingsPage() SettingsPage::SettingsPage()
{ {
Core::ICore *coreIFace = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); m_settings = Core::ICore::instance()->settings();
if (coreIFace)
m_settings = coreIFace->settings();
if (m_settings) { if (m_settings) {
m_settings->beginGroup("CodePaster"); m_settings->beginGroup("CodePaster");
m_username = m_settings->value("UserName", qgetenv("USER")).toString(); m_username = m_settings->value("UserName", qgetenv("USER")).toString();

View File

@@ -139,15 +139,14 @@ QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &contex
CPPEditorEditable::CPPEditorEditable(CPPEditor *editor) CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
: BaseTextEditorEditable(editor) : BaseTextEditorEditable(editor)
{ {
Core::ICore *core = CppPlugin::core(); Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
m_context << core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); m_context << core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
} }
CPPEditor::CPPEditor(QWidget *parent) : CPPEditor::CPPEditor(QWidget *parent)
TextEditor::BaseTextEditor(parent), : TextEditor::BaseTextEditor(parent)
m_core(CppPlugin::core())
{ {
setParenthesesMatchingEnabled(true); setParenthesesMatchingEnabled(true);
setMarksVisible(true); setMarksVisible(true);
@@ -169,7 +168,8 @@ CPPEditor::CPPEditor(QWidget *parent) :
/*ambiguousMember=*/ 0, Qt::WidgetShortcut); /*ambiguousMember=*/ 0, Qt::WidgetShortcut);
#endif #endif
m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); m_modelManager = ExtensionSystem::PluginManager::instance()
->getObject<CppTools::CppModelManagerInterface>();
if (m_modelManager) { if (m_modelManager) {
connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),

View File

@@ -67,15 +67,16 @@
using namespace CppEditor::Internal; using namespace CppEditor::Internal;
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace Core;
CppHoverHandler::CppHoverHandler(QObject *parent) CppHoverHandler::CppHoverHandler(QObject *parent)
: QObject(parent) : QObject(parent)
, m_core(CppPlugin::core())
, m_helpEngineNeedsSetup(false) , m_helpEngineNeedsSetup(false)
{ {
m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
QFileInfo fi(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings()->fileName()); ICore *core = ICore::instance();
QFileInfo fi(core->settings()->fileName());
// FIXME shouldn't the help engine create the directory if it doesn't exist? // FIXME shouldn't the help engine create the directory if it doesn't exist?
QDir directory(fi.absolutePath()+"/qtcreator"); QDir directory(fi.absolutePath()+"/qtcreator");
if (!directory.exists()) if (!directory.exists())
@@ -90,7 +91,7 @@ CppHoverHandler::CppHoverHandler(QObject *parent)
m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0; m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0;
// Listen for editor opened events in order to connect to tooltip/helpid requests // Listen for editor opened events in order to connect to tooltip/helpid requests
connect(m_core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), connect(core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)),
this, SLOT(editorOpened(Core::IEditor *))); this, SLOT(editorOpened(Core::IEditor *)));
} }
@@ -99,7 +100,7 @@ void CppHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int p
updateHelpIdAndTooltip(editor, pos); updateHelpIdAndTooltip(editor, pos);
} }
void CppHoverHandler::editorOpened(Core::IEditor *editor) void CppHoverHandler::editorOpened(IEditor *editor)
{ {
CPPEditorEditable *cppEditor = qobject_cast<CPPEditorEditable *>(editor); CPPEditorEditable *cppEditor = qobject_cast<CPPEditorEditable *>(editor);
if (!cppEditor) if (!cppEditor)
@@ -117,9 +118,10 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
if (!editor) if (!editor)
return; return;
const int dbgcontext = m_core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER); ICore *core = ICore::instance();
const int dbgcontext = core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER);
if (m_core->hasContext(dbgcontext)) if (core->hasContext(dbgcontext))
return; return;
updateHelpIdAndTooltip(editor, pos); updateHelpIdAndTooltip(editor, pos);

View File

@@ -42,7 +42,6 @@ class QPoint;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
} }
@@ -74,7 +73,6 @@ private slots:
private: private:
void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos); void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos);
Core::ICore *m_core;
CppTools::CppModelManagerInterface *m_modelManager; CppTools::CppModelManagerInterface *m_modelManager;
QHelpEngineCore *m_helpEngine; QHelpEngineCore *m_helpEngine;
QString m_helpId; QString m_helpId;

View File

@@ -88,7 +88,7 @@ QString CppPluginEditorFactory::kind() const
Core::IFile *CppPluginEditorFactory::open(const QString &fileName) Core::IFile *CppPluginEditorFactory::open(const QString &fileName)
{ {
Core::IEditor *iface = m_owner->m_core->editorManager()->openEditor(fileName, kind()); Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0; return iface ? iface->file() : 0;
} }
@@ -111,7 +111,6 @@ QStringList CppPluginEditorFactory::mimeTypes() const
CppPlugin *CppPlugin::m_instance = 0; CppPlugin *CppPlugin::m_instance = 0;
CppPlugin::CppPlugin() : CppPlugin::CppPlugin() :
m_core(0),
m_actionHandler(0), m_actionHandler(0),
m_factory(0) m_factory(0)
{ {
@@ -131,11 +130,6 @@ CppPlugin *CppPlugin::instance()
return m_instance; return m_instance;
} }
Core::ICore *CppPlugin::core()
{
return m_instance->m_core;
}
void CppPlugin::initializeEditor(CPPEditor *editor) void CppPlugin::initializeEditor(CPPEditor *editor)
{ {
// common actions // common actions
@@ -160,14 +154,13 @@ void CppPlugin::initializeEditor(CPPEditor *editor)
// auto completion // auto completion
connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)), connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)),
TextEditor::Internal::CompletionSupport::instance(core()), SLOT(autoComplete(ITextEditable*, bool))); TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(ITextEditable*, bool)));
} }
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
typedef TextEditor::TextEditorActionHandler TextEditorActionHandler; Core::ICore *core = Core::ICore::instance();
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
return false; return false;
m_factory = new CppPluginEditorFactory(this); m_factory = new CppPluginEditorFactory(this);
@@ -181,21 +174,21 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
wizardParameters.setTrCategory(tr("C++")); wizardParameters.setTrCategory(tr("C++"));
wizardParameters.setDescription(tr("Creates a new C++ header file.")); wizardParameters.setDescription(tr("Creates a new C++ header file."));
wizardParameters.setName(tr("C++ Header File")); wizardParameters.setName(tr("C++ Header File"));
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, m_core)); addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
wizardParameters.setDescription(tr("Creates a new C++ source file.")); wizardParameters.setDescription(tr("Creates a new C++ source file."));
wizardParameters.setName(tr("C++ Source File")); wizardParameters.setName(tr("C++ Source File"));
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, m_core)); addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
wizardParameters.setKind(Core::IWizard::ClassWizard); wizardParameters.setKind(Core::IWizard::ClassWizard);
wizardParameters.setName(tr("C++ Class")); wizardParameters.setName(tr("C++ Class"));
wizardParameters.setDescription(tr("Creates a header and a source file for a new class.")); wizardParameters.setDescription(tr("Creates a header and a source file for a new class."));
addAutoReleasedObject(new CppClassWizard(wizardParameters, m_core)); addAutoReleasedObject(new CppClassWizard(wizardParameters, core));
QList<int> context; QList<int> context;
context << m_core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = core->actionManager();
am->createMenu(CppEditor::Constants::M_CONTEXT); am->createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd; Core::Command *cmd;
@@ -218,22 +211,22 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd); am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
m_actionHandler = new CPPEditorActionHandler(m_core, m_actionHandler = new CPPEditorActionHandler(core,
CppEditor::Constants::C_CPPEDITOR, CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll); | TextEditor::TextEditorActionHandler::UnCollapseAll);
// Check Suffixes // Check Suffixes
if (const QSettings *settings = m_core->settings()) { if (const QSettings *settings = core->settings()) {
const QString headerSuffixKey = QLatin1String(headerSuffixKeyC); const QString headerSuffixKey = QLatin1String(headerSuffixKeyC);
if (settings->contains(headerSuffixKey)) { if (settings->contains(headerSuffixKey)) {
const QString headerSuffix = settings->value(headerSuffixKey, QString()).toString(); const QString headerSuffix = settings->value(headerSuffixKey, QString()).toString();
if (!headerSuffix.isEmpty()) if (!headerSuffix.isEmpty())
m_core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix); core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix);
const QString sourceSuffix = settings->value(QLatin1String(sourceSuffixKeyC), QString()).toString(); const QString sourceSuffix = settings->value(QLatin1String(sourceSuffixKeyC), QString()).toString();
if (!sourceSuffix.isEmpty()) if (!sourceSuffix.isEmpty())
m_core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix); core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix);
} }
} }
return true; return true;
@@ -246,7 +239,8 @@ void CppPlugin::extensionsInitialized()
void CppPlugin::switchDeclarationDefinition() void CppPlugin::switchDeclarationDefinition()
{ {
CPPEditor *editor = qobject_cast<CPPEditor*>(m_core->editorManager()->currentEditor()->widget()); Core::ICore *core = Core::ICore::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget());
if (editor) { if (editor) {
editor->switchDeclarationDefinition(); editor->switchDeclarationDefinition();
} }
@@ -254,7 +248,8 @@ void CppPlugin::switchDeclarationDefinition()
void CppPlugin::jumpToDefinition() void CppPlugin::jumpToDefinition()
{ {
CPPEditor *editor = qobject_cast<CPPEditor*>(m_core->editorManager()->currentEditor()->widget()); Core::ICore *core = Core::ICore::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget());
if (editor) { if (editor) {
editor->jumpToDefinition(); editor->jumpToDefinition();
} }

View File

@@ -65,7 +65,6 @@ public:
~CppPlugin(); ~CppPlugin();
static CppPlugin *instance(); static CppPlugin *instance();
static Core::ICore *core();
bool initialize(const QStringList &arguments, QString *error_message = 0); bool initialize(const QStringList &arguments, QString *error_message = 0);
void extensionsInitialized(); void extensionsInitialized();

View File

@@ -433,10 +433,10 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
modified within Workbench. modified within Workbench.
*/ */
CppModelManager::CppModelManager(QObject *parent) : CppModelManager::CppModelManager(QObject *parent)
CppModelManagerInterface(parent), : CppModelManagerInterface(parent)
m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>())
{ {
m_core = Core::ICore::instance(); // FIXME
m_dirty = true; m_dirty = true;
m_projectExplorer = ExtensionSystem::PluginManager::instance() m_projectExplorer = ExtensionSystem::PluginManager::instance()

View File

@@ -46,7 +46,7 @@ namespace ProjectExplorer {
namespace CppTools { namespace CppTools {
class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -65,10 +65,8 @@ enum { debug = 0 };
CppToolsPlugin *CppToolsPlugin::m_instance = 0; CppToolsPlugin *CppToolsPlugin::m_instance = 0;
CppToolsPlugin::CppToolsPlugin() : CppToolsPlugin::CppToolsPlugin()
m_core(0), : m_context(-1), m_modelManager(0)
m_context(-1),
m_modelManager(0)
{ {
m_instance = this; m_instance = this;
} }
@@ -79,21 +77,23 @@ CppToolsPlugin::~CppToolsPlugin()
m_modelManager = 0; // deleted automatically 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>(); Q_UNUSED(arguments);
Core::ActionManager *am = m_core->actionManager(); Q_UNUSED(error);
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
// Objects // Objects
m_modelManager = new CppModelManager(this); m_modelManager = new CppModelManager(this);
addAutoReleasedObject(m_modelManager); addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager, m_core); m_completion = new CppCodeCompletion(m_modelManager, core);
addAutoReleasedObject(m_completion); addAutoReleasedObject(m_completion);
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager, CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
m_core->editorManager()); core->editorManager());
addAutoReleasedObject(quickOpenFilter); addAutoReleasedObject(quickOpenFilter);
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager())); addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager())); addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CompletionSettingsPage(m_completion)); addAutoReleasedObject(new CompletionSettingsPage(m_completion));
// Menus // Menus
@@ -105,7 +105,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
mtools->addMenu(mcpptools); mtools->addMenu(mcpptools);
// Actions // 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; QList<int> context = QList<int>() << m_context;
QAction *switchAction = new QAction(tr("Switch Header/Source"), this); 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())); connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));
// Restore settings // Restore settings
QSettings *settings = m_core->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("CppTools")); settings->beginGroup(QLatin1String("CppTools"));
settings->beginGroup(QLatin1String("Completion")); settings->beginGroup(QLatin1String("Completion"));
const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool(); const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool();
@@ -135,7 +135,7 @@ void CppToolsPlugin::extensionsInitialized()
void CppToolsPlugin::shutdown() void CppToolsPlugin::shutdown()
{ {
// Save settings // Save settings
QSettings *settings = m_core->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("CppTools")); settings->beginGroup(QLatin1String("CppTools"));
settings->beginGroup(QLatin1String("Completion")); settings->beginGroup(QLatin1String("Completion"));
settings->setValue(QLatin1String("CaseSensitive"), m_completion->caseSensitivity() == Qt::CaseSensitive); settings->setValue(QLatin1String("CaseSensitive"), m_completion->caseSensitivity() == Qt::CaseSensitive);
@@ -147,14 +147,12 @@ void CppToolsPlugin::shutdown()
void CppToolsPlugin::switchHeaderSource() void CppToolsPlugin::switchHeaderSource()
{ {
if (!m_core) Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
return; Core::IEditor *editor = editorManager->currentEditor();
Core::IEditor *editor = m_core->editorManager()->currentEditor();
QString otherFile = correspondingHeaderOrSource(editor->file()->fileName()); QString otherFile = correspondingHeaderOrSource(editor->file()->fileName());
if (!otherFile.isEmpty()) { if (!otherFile.isEmpty()) {
m_core->editorManager()->openEditor(otherFile); editorManager->openEditor(otherFile);
m_core->editorManager()->ensureEditorManagerVisible(); editorManager->ensureEditorManagerVisible();
} }
} }
@@ -222,7 +220,7 @@ static QStringList matchingCandidateSuffixes(const Core::MimeDatabase *mimeDatas
QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) const 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(); const Core::MimeDatabase *mimeDatase = core->mimeDatabase();
ProjectExplorer::ProjectExplorerPlugin *explorer = ProjectExplorer::ProjectExplorerPlugin *explorer =
ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>(); ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();

View File

@@ -42,10 +42,6 @@ class QFileInfo;
class QDir; class QDir;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {
@@ -75,7 +71,6 @@ private:
QString correspondingHeaderOrSourceI(const QString &fileName) const; QString correspondingHeaderOrSourceI(const QString &fileName) const;
QFileInfo findFile(const QDir &dir, const QString &name, const ProjectExplorer::Project *project) const; QFileInfo findFile(const QDir &dir, const QString &name, const ProjectExplorer::Project *project) const;
Core::ICore *m_core;
int m_context; int m_context;
CppModelManager *m_modelManager; CppModelManager *m_modelManager;
CppCodeCompletion *m_completion; CppCodeCompletion *m_completion;

View File

@@ -55,12 +55,12 @@
#include <coreplugin/rightpane.h> #include <coreplugin/rightpane.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <cplusplus/ExpressionUnderCursor.h> #include <cplusplus/ExpressionUnderCursor.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
@@ -346,7 +346,7 @@ DebuggerPlugin::~DebuggerPlugin()
static QSettings *settings() static QSettings *settings()
{ {
return ExtensionSystem::PluginManager::instance()->getObject<ICore>()->settings(); return ICore::instance()->settings();
} }
void DebuggerPlugin::shutdown() void DebuggerPlugin::shutdown()
@@ -387,7 +387,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
m_pm = ExtensionSystem::PluginManager::instance(); m_pm = ExtensionSystem::PluginManager::instance();
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
QTC_ASSERT(core, return false); QTC_ASSERT(core, return false);
Core::ActionManager *am = core->actionManager(); Core::ActionManager *am = core->actionManager();
@@ -713,8 +713,7 @@ ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const
/*! Activates the previous mode when the current mode is the debug mode. */ /*! Activates the previous mode when the current mode is the debug mode. */
void DebuggerPlugin::activatePreviousMode() void DebuggerPlugin::activatePreviousMode()
{ {
ICore *core = m_pm->getObject<Core::ICore>(); Core::ModeManager *const modeManager = ICore::instance()->modeManager();
Core::ModeManager *const modeManager = core->modeManager();
if (modeManager->currentMode() == modeManager->mode(Constants::MODE_DEBUG) if (modeManager->currentMode() == modeManager->mode(Constants::MODE_DEBUG)
&& !m_previousMode.isEmpty()) { && !m_previousMode.isEmpty()) {
@@ -725,7 +724,7 @@ void DebuggerPlugin::activatePreviousMode()
void DebuggerPlugin::activateDebugMode() void DebuggerPlugin::activateDebugMode()
{ {
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
Core::ModeManager *modeManager = core->modeManager(); Core::ModeManager *modeManager = core->modeManager();
m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName()); m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName());
modeManager->activateMode(QLatin1String(MODE_DEBUG)); modeManager->activateMode(QLatin1String(MODE_DEBUG));
@@ -733,7 +732,7 @@ void DebuggerPlugin::activateDebugMode()
void DebuggerPlugin::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object) void DebuggerPlugin::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object)
{ {
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
if (!core || !core->editorManager()) if (!core || !core->editorManager())
return; return;
Core::IEditor *editor = core->editorManager()->currentEditor(); Core::IEditor *editor = core->editorManager()->currentEditor();
@@ -872,7 +871,7 @@ void DebuggerPlugin::gotoLocation(const QString &fileName, int lineNumber,
void DebuggerPlugin::changeStatus(int status) void DebuggerPlugin::changeStatus(int status)
{ {
bool startIsContinue = (status == DebuggerInferiorStopped); bool startIsContinue = (status == DebuggerInferiorStopped);
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
if (startIsContinue) { if (startIsContinue) {
core->addAdditionalContext(m_gdbRunningContext); core->addAdditionalContext(m_gdbRunningContext);
core->updateContext(); core->updateContext();
@@ -916,8 +915,7 @@ void DebuggerPlugin::readSettings()
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
defaultCommand.append(".exe"); defaultCommand.append(".exe");
#endif #endif
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); QString defaultScript = ICore::instance()->resourcePath() +
QString defaultScript = coreIFace->resourcePath() +
QLatin1String("/gdb/qt4macros"); QLatin1String("/gdb/qt4macros");
s->beginGroup(QLatin1String("DebugMode")); s->beginGroup(QLatin1String("DebugMode"));

View File

@@ -35,7 +35,6 @@
#include "gdbengine.h" #include "gdbengine.h"
#include "imports.h" #include "imports.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QtCore/QSettings> #include <QtCore/QSettings>
@@ -49,9 +48,7 @@ TypeMacroPage::TypeMacroPage(GdbSettings *settings)
m_pm = ExtensionSystem::PluginManager::instance(); m_pm = ExtensionSystem::PluginManager::instance();
m_settings = settings; m_settings = settings;
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); Core::ICore *coreIFace = ICore::instance();
if (!coreIFace || !coreIFace->settings())
return;
QSettings *s = coreIFace->settings(); QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions"); s->beginGroup("GdbOptions");
@@ -164,14 +161,11 @@ void TypeMacroPage::finished(bool accepted)
m_settings->m_typeMacros.insert(item->text(0), data); m_settings->m_typeMacros.insert(item->text(0), data);
} }
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); QSettings *s = ICore::instance()->settings();
if (coreIFace && coreIFace->settings()) { s->beginGroup("GdbOptions");
QSettings *s = coreIFace->settings(); s->setValue("ScriptFile", m_settings->m_scriptFile);
s->beginGroup("GdbOptions"); s->setValue("TypeMacros", m_settings->m_typeMacros);
s->setValue("ScriptFile", m_settings->m_scriptFile); s->endGroup();
s->setValue("TypeMacros", m_settings->m_typeMacros);
s->endGroup();
}
} }
void TypeMacroPage::onAddButton() void TypeMacroPage::onAddButton()

View File

@@ -37,7 +37,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>
@@ -176,7 +175,7 @@ bool FormClassWizardPage::validatePage()
void FormClassWizardPage::saveSettings() void FormClassWizardPage::saveSettings()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (QSettings *settings = core->settings()) { if (QSettings *settings = core->settings()) {
settings->beginGroup(QLatin1String(formClassWizardPageGroupC)); settings->beginGroup(QLatin1String(formClassWizardPageGroupC));
settings->setValue(QLatin1String(translationKeyC), hasRetranslationSupport()); settings->setValue(QLatin1String(translationKeyC), hasRetranslationSupport());
@@ -190,7 +189,7 @@ void FormClassWizardPage::restoreSettings()
bool retranslationSupport = true; bool retranslationSupport = true;
int embedding = PointerAggregatedUiClass; int embedding = PointerAggregatedUiClass;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (QSettings *settings = core->settings()) { if (QSettings *settings = core->settings()) {
QString key = QLatin1String(formClassWizardPageGroupC); QString key = QLatin1String(formClassWizardPageGroupC);

View File

@@ -50,7 +50,6 @@
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -90,13 +89,16 @@ FormEditorPlugin::~FormEditorPlugin()
// INHERITED FROM ExtensionSystem::Plugin // INHERITED FROM ExtensionSystem::Plugin
// //
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
bool FormEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message/* = 0*/) // =0; bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error_message)) Q_UNUSED(error);
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error))
return false; return false;
if (!initializeTemplates(error_message)) if (!initializeTemplates(error))
return false; return false;
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR)); const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
@@ -108,7 +110,7 @@ bool FormEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
// Make sure settings pages and action shortcuts are registered // Make sure settings pages and action shortcuts are registered
FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins); FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
error_message->clear(); error->clear();
return true; return true;
} }
@@ -122,10 +124,10 @@ void FormEditorPlugin::extensionsInitialized()
// //
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
bool FormEditorPlugin::initializeTemplates(QString * /* error_message */) bool FormEditorPlugin::initializeTemplates(QString *error)
{ {
Q_UNUSED(error);
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setCategory(QLatin1String("Qt")); wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt")); wizardParameters.setTrCategory(tr("Qt"));

View File

@@ -163,7 +163,7 @@ FormEditorW::FormEditorW() :
m_formeditor(QDesignerComponents::createFormEditor(0)), m_formeditor(QDesignerComponents::createFormEditor(0)),
m_integration(0), m_integration(0),
m_fwm(0), m_fwm(0),
m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()), m_core(Core::ICore::instance()),
m_initStage(RegisterPlugins), m_initStage(RegisterPlugins),
m_actionGroupEditMode(0), m_actionGroupEditMode(0),
m_actionPrint(0), m_actionPrint(0),

View File

@@ -79,8 +79,8 @@ static QString msgClassNotFound(const QString &uiClassName, const QList<Document
static inline CppTools::CppModelManagerInterface *cppModelManagerInstance() static inline CppTools::CppModelManagerInterface *cppModelManagerInstance()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); return ExtensionSystem::PluginManager::instance()
return core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); ->getObject<CppTools::CppModelManagerInterface>();
} }
WorkbenchIntegration::WorkbenchIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) : WorkbenchIntegration::WorkbenchIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) :

View File

@@ -45,7 +45,6 @@
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
@@ -159,7 +158,7 @@ bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *err
m_handler = new FakeVimHandler; m_handler = new FakeVimHandler;
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); m_core = Core::ICore::instance();
QTC_ASSERT(m_core, return false); QTC_ASSERT(m_core, return false);
Core::ActionManager *actionManager = m_core->actionManager(); Core::ActionManager *actionManager = m_core->actionManager();

View File

@@ -60,8 +60,7 @@ using namespace Find;
using namespace Find::Internal; using namespace Find::Internal;
FindPlugin::FindPlugin() FindPlugin::FindPlugin()
: m_core(0), : m_currentDocumentFind(0),
m_currentDocumentFind(0),
m_findToolBar(0), m_findToolBar(0),
m_findDialog(0), m_findDialog(0),
m_findCompletionModel(new QStringListModel(this)), m_findCompletionModel(new QStringListModel(this)),
@@ -78,14 +77,14 @@ FindPlugin::~FindPlugin()
bool FindPlugin::initialize(const QStringList &, QString *) bool FindPlugin::initialize(const QStringList &, QString *)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
setupMenu(); setupMenu();
m_currentDocumentFind = new CurrentDocumentFind(m_core); m_currentDocumentFind = new CurrentDocumentFind(core);
m_findToolBar = new FindToolBar(this, m_currentDocumentFind); m_findToolBar = new FindToolBar(this, m_currentDocumentFind);
m_findDialog = new FindToolWindow(this); m_findDialog = new FindToolWindow(this);
SearchResultWindow *searchResultWindow = new SearchResultWindow(m_core); SearchResultWindow *searchResultWindow = new SearchResultWindow(core);
addAutoReleasedObject(searchResultWindow); addAutoReleasedObject(searchResultWindow);
return true; return true;
} }
@@ -125,10 +124,10 @@ void FindPlugin::openFindFilter()
m_findDialog->open(filter); m_findDialog->open(filter);
} }
void FindPlugin::setupMenu() void FindPlugin::setupMenu()
{ {
Core::ActionManager *am = m_core->actionManager(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND); Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND);
medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); medit->addMenu(mfind, Core::Constants::G_EDIT_FIND);
@@ -151,7 +150,8 @@ void FindPlugin::setupMenu()
void FindPlugin::setupFilterMenuItems() void FindPlugin::setupFilterMenuItems()
{ {
Core::ActionManager *am = m_core->actionManager(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
QList<IFindFilter*> findInterfaces = QList<IFindFilter*> findInterfaces =
ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>();
Core::Command *cmd; Core::Command *cmd;
@@ -173,11 +173,6 @@ void FindPlugin::setupFilterMenuItems()
m_findDialog->setFindFilters(findInterfaces); m_findDialog->setFindFilters(findInterfaces);
} }
Core::ICore *FindPlugin::core()
{
return m_core;
}
QTextDocument::FindFlags FindPlugin::findFlags() const QTextDocument::FindFlags FindPlugin::findFlags() const
{ {
return m_findFlags; return m_findFlags;
@@ -218,7 +213,7 @@ bool FindPlugin::hasFindFlag(QTextDocument::FindFlag flag)
void FindPlugin::writeSettings() void FindPlugin::writeSettings()
{ {
QSettings *settings = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0)); settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0));
settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0)); settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0));
@@ -231,7 +226,7 @@ void FindPlugin::writeSettings()
void FindPlugin::readSettings() void FindPlugin::readSettings()
{ {
QSettings *settings = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
bool block = blockSignals(true); bool block = blockSignals(true);
setBackward(settings->value("Backward", false).toBool()); setBackward(settings->value("Backward", false).toBool());

View File

@@ -64,7 +64,6 @@ public:
void extensionsInitialized(); void extensionsInitialized();
void shutdown(); void shutdown();
Core::ICore *core();
QTextDocument::FindFlags findFlags() const; QTextDocument::FindFlags findFlags() const;
void updateFindCompletion(const QString &text); void updateFindCompletion(const QString &text);
void updateReplaceCompletion(const QString &text); void updateReplaceCompletion(const QString &text);
@@ -93,7 +92,6 @@ private:
void readSettings(); void readSettings();
//variables //variables
Core::ICore *m_core;
QHash<IFindFilter *, QAction *> m_filterActions; QHash<IFindFilter *, QAction *> m_filterActions;
CurrentDocumentFind *m_currentDocumentFind; CurrentDocumentFind *m_currentDocumentFind;

View File

@@ -141,7 +141,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
QList<int> globalcontext; QList<int> globalcontext;
globalcontext << Core::Constants::C_GLOBAL_ID; globalcontext << Core::Constants::C_GLOBAL_ID;
Core::ActionManager *am = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager(); Core::ActionManager *am = Core::ICore::instance()->actionManager();
Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND); Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND);
Core::Command *cmd; Core::Command *cmd;

View File

@@ -42,7 +42,7 @@ using namespace Find;
using namespace Find::Internal; using namespace Find::Internal;
FindToolWindow::FindToolWindow(FindPlugin *plugin) FindToolWindow::FindToolWindow(FindPlugin *plugin)
: QDialog(plugin->core()->mainWindow()), : QDialog(Core::ICore::instance()->mainWindow()),
m_plugin(plugin), m_plugin(plugin),
m_findCompleter(new QCompleter(this)) m_findCompleter(new QCompleter(this))
{ {
@@ -124,7 +124,7 @@ void FindToolWindow::search()
void FindToolWindow::writeSettings() void FindToolWindow::writeSettings()
{ {
QSettings *settings = m_plugin->core()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
foreach (IFindFilter *filter, m_filters) foreach (IFindFilter *filter, m_filters)
filter->writeSettings(settings); filter->writeSettings(settings);
@@ -133,7 +133,7 @@ void FindToolWindow::writeSettings()
void FindToolWindow::readSettings() void FindToolWindow::readSettings()
{ {
QSettings *settings = m_plugin->core()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
foreach (IFindFilter *filter, m_filters) foreach (IFindFilter *filter, m_filters)
filter->readSettings(settings); filter->readSettings(settings);

View File

@@ -84,8 +84,7 @@ void GitCommand::execute()
QFuture<void> task = QtConcurrent::run(this, &GitCommand::run); QFuture<void> task = QtConcurrent::run(this, &GitCommand::run);
const QString taskName = QLatin1String("Git ") + m_jobs.front().arguments.at(0); const QString taskName = QLatin1String("Git ") + m_jobs.front().arguments.at(0);
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore::instance()->progressManager()->addTask(task, taskName,
core->progressManager()->addTask(task, taskName,
QLatin1String("Git.action"), QLatin1String("Git.action"),
Core::ProgressManager::CloseOnSuccess); Core::ProgressManager::CloseOnSuccess);
} }

View File

@@ -232,7 +232,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
Q_UNUSED(arguments); Q_UNUSED(arguments);
Q_UNUSED(error_message); Q_UNUSED(error_message);
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); m_core = Core::ICore::instance();
m_gitClient = new GitClient(this, m_core); m_gitClient = new GitClient(this, m_core);
// Create the globalcontext list to register actions accordingly // Create the globalcontext list to register actions accordingly
QList<int> globalcontext; QList<int> globalcontext;

View File

@@ -39,7 +39,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
@@ -78,7 +77,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_m
Q_UNUSED(error_message) Q_UNUSED(error_message)
// Get the primary access point to the workbench. // Get the primary access point to the workbench.
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
// Create a unique context id for our own view, that will be used for the // Create a unique context id for our own view, that will be used for the
// menu entry later. // menu entry later.

View File

@@ -36,8 +36,6 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <QtCore/QObject>
namespace HelloWorld { namespace HelloWorld {
namespace Internal { namespace Internal {

View File

@@ -123,9 +123,11 @@ HelpPlugin::~HelpPlugin()
{ {
} }
bool HelpPlugin::initialize(const QStringList & /*arguments*/, QString *) bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
Q_UNUSED(error);
m_core = Core::ICore::instance();
QList<int> globalcontext; QList<int> globalcontext;
globalcontext << Core::Constants::C_GLOBAL_ID; globalcontext << Core::Constants::C_GLOBAL_ID;
QList<int> modecontext; QList<int> modecontext;

View File

@@ -145,7 +145,6 @@ bool CoreListener::editorAboutToClose(Core::IEditor *editor)
// PerforcePlugin // PerforcePlugin
//// ////
Core::ICore *PerforcePlugin::m_coreInstance = NULL;
PerforcePlugin *PerforcePlugin::m_perforcePluginInstance = NULL; PerforcePlugin *PerforcePlugin::m_perforcePluginInstance = NULL;
PerforcePlugin::PerforcePlugin() : PerforcePlugin::PerforcePlugin() :
@@ -183,17 +182,20 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Perforce::Constants::C_PERFORCESUBMITEDITOR Perforce::Constants::C_PERFORCESUBMITEDITOR
}; };
bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
typedef VCSBase::VCSEditorFactory<PerforceEditor> PerforceEditorFactory; typedef VCSBase::VCSEditorFactory<PerforceEditor> PerforceEditorFactory;
typedef VCSBase::VCSSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory; typedef VCSBase::VCSSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory;
m_coreInstance = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage))
return false; return false;
m_perforcePluginInstance = this; m_perforcePluginInstance = this;
if (QSettings *settings = m_coreInstance->settings()) if (QSettings *settings = core->settings())
m_settings.fromSettings(settings); m_settings.fromSettings(settings);
m_perforceOutputWindow = new PerforceOutputWindow(this); m_perforceOutputWindow = new PerforceOutputWindow(this);
@@ -209,24 +211,19 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro
static const char *describeSlot = SLOT(describe(QString,QString)); static const char *describeSlot = SLOT(describe(QString,QString));
const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters); const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters);
for (int i = 0; i < editorCount; i++) { for (int i = 0; i < editorCount; i++) {
m_editorFactories.push_back(new PerforceEditorFactory(editorParameters + i, m_coreInstance, this, describeSlot)); m_editorFactories.push_back(new PerforceEditorFactory(editorParameters + i, core, this, describeSlot));
addObject(m_editorFactories.back()); addObject(m_editorFactories.back());
} }
m_versionControl = new PerforceVersionControl(this); m_versionControl = new PerforceVersionControl(this);
addObject(m_versionControl); addObject(m_versionControl);
#ifdef USE_P4_API
m_workbenchClientUser = new WorkbenchClientUser(m_perforceOutputWindow, this);
m_enableP4APIActions = true;
#endif
m_coreListener = new CoreListener(this); m_coreListener = new CoreListener(this);
addObject(m_coreListener); addObject(m_coreListener);
//register actions //register actions
Core::ActionManager *am = m_coreInstance->actionManager(); Core::ActionManager *am = Core::ICore::instance()->actionManager();
Core::ActionContainer *mtools = Core::ActionContainer *mtools =
am->actionContainer(Core::Constants::M_TOOLS); am->actionContainer(Core::Constants::M_TOOLS);
@@ -245,7 +242,7 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro
QList<int> perforcesubmitcontext; QList<int> perforcesubmitcontext;
perforcesubmitcontext << perforcesubmitcontext <<
m_coreInstance->uniqueIDManager()->uniqueIdentifier(Constants::C_PERFORCESUBMITEDITOR); Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_PERFORCESUBMITEDITOR);
Core::Command *command; Core::Command *command;
QAction *tmpaction; QAction *tmpaction;
@@ -383,10 +380,10 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro
m_redoAction = new QAction(tr("&Redo"), this); m_redoAction = new QAction(tr("&Redo"), this);
command = am->registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext); command = am->registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext);
connect(m_coreInstance, SIGNAL(contextChanged(Core::IContext *)), connect(core, SIGNAL(contextChanged(Core::IContext *)),
this, SLOT(updateActions())); this, SLOT(updateActions()));
connect(m_coreInstance->fileManager(), SIGNAL(currentFileChanged(const QString &)), connect(core->fileManager(), SIGNAL(currentFileChanged(const QString &)),
this, SLOT(updateActions())); this, SLOT(updateActions()));
return true; return true;
@@ -420,10 +417,8 @@ void PerforcePlugin::deleteCurrentFile()
void PerforcePlugin::revertCurrentFile() void PerforcePlugin::revertCurrentFile()
{ {
QTC_ASSERT(m_coreInstance, return);
const QString fileName = currentFileName(); const QString fileName = currentFileName();
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(fileName);
QStringList args; QStringList args;
args << QLatin1String("diff") << QLatin1String("-sa"); args << QLatin1String("diff") << QLatin1String("-sa");
PerforceResponse result = runP4Cmd(args, QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow, codec); PerforceResponse result = runP4Cmd(args, QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow, codec);
@@ -439,7 +434,7 @@ void PerforcePlugin::revertCurrentFile()
return; return;
} }
Core::FileManager *fm = m_coreInstance->fileManager(); Core::FileManager *fm = Core::ICore::instance()->fileManager();
QList<Core::IFile *> files = fm->managedFiles(fileName); QList<Core::IFile *> files = fm->managedFiles(fileName);
foreach (Core::IFile *file, files) { foreach (Core::IFile *file, files) {
fm->blockFileChange(file); fm->blockFileChange(file);
@@ -472,7 +467,7 @@ void PerforcePlugin::diffAllOpened()
void PerforcePlugin::printOpenedFileList() void PerforcePlugin::printOpenedFileList()
{ {
Core::IEditor *e = m_coreInstance->editorManager()->currentEditor(); Core::IEditor *e = Core::ICore::instance()->editorManager()->currentEditor();
if (e) if (e)
e->widget()->setFocus(); e->widget()->setFocus();
PerforceResponse result = runP4Cmd(QStringList() << QLatin1String("opened"), QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); PerforceResponse result = runP4Cmd(QStringList() << QLatin1String("opened"), QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
@@ -488,8 +483,6 @@ void PerforcePlugin::resolve()
void PerforcePlugin::submit() void PerforcePlugin::submit()
{ {
QTC_ASSERT(m_coreInstance, return);
if (!checkP4Command()) { if (!checkP4Command()) {
showOutput(tr("No p4 executable specified!"), true); showOutput(tr("No p4 executable specified!"), true);
return; return;
@@ -550,8 +543,8 @@ void PerforcePlugin::submit()
Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames) Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
{ {
Core::IEditor *editor = Core::IEditor *editor =
m_coreInstance->editorManager()->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND); Core::ICore::instance()->editorManager()->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND);
m_coreInstance->editorManager()->ensureEditorManagerVisible(); Core::ICore::instance()->editorManager()->ensureEditorManagerVisible();
PerforceSubmitEditor *submitEditor = dynamic_cast<PerforceSubmitEditor*>(editor); PerforceSubmitEditor *submitEditor = dynamic_cast<PerforceSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0); QTC_ASSERT(submitEditor, return 0);
submitEditor->restrictToProjectFiles(depotFileNames); submitEditor->restrictToProjectFiles(depotFileNames);
@@ -563,7 +556,7 @@ Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName,
void PerforcePlugin::printPendingChanges() void PerforcePlugin::printPendingChanges()
{ {
qApp->setOverrideCursor(Qt::WaitCursor); qApp->setOverrideCursor(Qt::WaitCursor);
PendingChangesDialog dia(pendingChangesData(), m_coreInstance->mainWindow()); PendingChangesDialog dia(pendingChangesData(), Core::ICore::instance()->mainWindow());
qApp->restoreOverrideCursor(); qApp->restoreOverrideCursor();
if (dia.exec() == QDialog::Accepted) { if (dia.exec() == QDialog::Accepted) {
const int i = dia.changeNumber(); const int i = dia.changeNumber();
@@ -596,7 +589,7 @@ void PerforcePlugin::annotate()
void PerforcePlugin::annotate(const QString &fileName) void PerforcePlugin::annotate(const QString &fileName)
{ {
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(fileName);
QStringList args; QStringList args;
args << QLatin1String("annotate") << QLatin1String("-cqi") << fileName; args << QLatin1String("annotate") << QLatin1String("-cqi") << fileName;
const PerforceResponse result = runP4Cmd(args, QStringList(), const PerforceResponse result = runP4Cmd(args, QStringList(),
@@ -623,7 +616,7 @@ void PerforcePlugin::filelog()
void PerforcePlugin::filelog(const QString &fileName) void PerforcePlugin::filelog(const QString &fileName)
{ {
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(fileName);
QStringList args; QStringList args;
args << QLatin1String("filelog") << QLatin1String("-li") << fileName; args << QLatin1String("filelog") << QLatin1String("-li") << fileName;
const PerforceResponse result = runP4Cmd(args, QStringList(), const PerforceResponse result = runP4Cmd(args, QStringList(),
@@ -752,7 +745,6 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
qDebug() << "PerforcePlugin::runP4Cmd" << args << extraArgs << debugCodec(outputCodec); qDebug() << "PerforcePlugin::runP4Cmd" << args << extraArgs << debugCodec(outputCodec);
PerforceResponse response; PerforceResponse response;
response.error = true; response.error = true;
QTC_ASSERT(m_coreInstance, return response);
if (!checkP4Command()) { if (!checkP4Command()) {
response.message = tr("No p4 executable specified!"); response.message = tr("No p4 executable specified!");
m_perforceOutputWindow->append(response.message, true); m_perforceOutputWindow->append(response.message, true);
@@ -847,7 +839,7 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q
if (Perforce::Constants::debug) if (Perforce::Constants::debug)
qDebug() << "PerforcePlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec); qDebug() << "PerforcePlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title; QString s = title;
Core::IEditor *ediface = m_coreInstance->editorManager()-> Core::IEditor *ediface = Core::ICore::instance()->editorManager()->
newFile(kind, &s, output.toLocal8Bit()); newFile(kind, &s, output.toLocal8Bit());
PerforceEditor *e = qobject_cast<PerforceEditor*>(ediface->widget()); PerforceEditor *e = qobject_cast<PerforceEditor*>(ediface->widget());
if (!e) if (!e)
@@ -882,7 +874,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
Core::IEditor *editor = 0; Core::IEditor *editor = 0;
bool displayInEditor = true; bool displayInEditor = true;
Core::IEditor *existingEditor = 0; Core::IEditor *existingEditor = 0;
QTextCodec *codec = files.empty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(m_coreInstance, files.front()); QTextCodec *codec = files.empty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(files.front());
if (Perforce::Constants::debug) if (Perforce::Constants::debug)
qDebug() << Q_FUNC_INFO << files << debugCodec(codec); qDebug() << Q_FUNC_INFO << files << debugCodec(codec);
@@ -895,7 +887,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
diffname = fi.fileName(); diffname = fi.fileName();
} }
foreach (Core::IEditor *ed, m_coreInstance->editorManager()->openedEditors()) { foreach (Core::IEditor *ed, Core::ICore::instance()->editorManager()->openedEditors()) {
if (ed->property("originalFileName").toString() == fileName) { if (ed->property("originalFileName").toString() == fileName) {
existingEditor = ed; existingEditor = ed;
displayInEditor = false; displayInEditor = false;
@@ -918,7 +910,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
} else if (!displayInEditor && existingEditor) { } else if (!displayInEditor && existingEditor) {
if (existingEditor) { if (existingEditor) {
existingEditor->createNew(result.stdOut); existingEditor->createNew(result.stdOut);
m_coreInstance->editorManager()->setCurrentEditor(existingEditor); Core::ICore::instance()->editorManager()->setCurrentEditor(existingEditor);
} }
} }
} }
@@ -926,7 +918,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
void PerforcePlugin::describe(const QString & source, const QString &n) void PerforcePlugin::describe(const QString & source, const QString &n)
{ {
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(m_coreInstance, source); QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(source);
QStringList args; QStringList args;
args << QLatin1String("describe") << QLatin1String("-du") << n; args << QLatin1String("describe") << QLatin1String("-du") << n;
const PerforceResponse result = runP4Cmd(args, QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow, codec); const PerforceResponse result = runP4Cmd(args, QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow, codec);
@@ -936,29 +928,32 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
void PerforcePlugin::submitCurrentLog() void PerforcePlugin::submitCurrentLog()
{ {
m_coreInstance->editorManager()->closeEditors(QList<Core::IEditor*>() Core::EditorManager *em = Core::ICore::instance()->editorManager();
<< m_coreInstance->editorManager()->currentEditor()); em->closeEditors(QList<Core::IEditor*>() << em->currentEditor());
} }
bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
{ {
if (!m_changeTmpFile || !editor) if (!m_changeTmpFile || !editor)
return true; return true;
Core::ICore *core = Core::ICore::instance();
Core::IFile *fileIFace = editor->file(); Core::IFile *fileIFace = editor->file();
if (!fileIFace) if (!fileIFace)
return true; return true;
QFileInfo editorFile(fileIFace->fileName()); QFileInfo editorFile(fileIFace->fileName());
QFileInfo changeFile(m_changeTmpFile->fileName()); QFileInfo changeFile(m_changeTmpFile->fileName());
if (editorFile.absoluteFilePath() == changeFile.absoluteFilePath()) { if (editorFile.absoluteFilePath() == changeFile.absoluteFilePath()) {
const QMessageBox::StandardButton answer = QMessageBox::question(m_coreInstance->mainWindow(), tr("Closing p4 Editor"), tr("Do you want to submit this change list?"), const QMessageBox::StandardButton answer =
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes); QMessageBox::question(core->mainWindow(),
if (answer == QMessageBox::Cancel) { tr("Closing p4 Editor"),
tr("Do you want to submit this change list?"),
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes);
if (answer == QMessageBox::Cancel)
return false; return false;
}
m_coreInstance->fileManager()->blockFileChange(fileIFace); core->fileManager()->blockFileChange(fileIFace);
fileIFace->save(); fileIFace->save();
m_coreInstance->fileManager()->unblockFileChange(fileIFace); core->fileManager()->unblockFileChange(fileIFace);
if (answer == QMessageBox::Yes) { if (answer == QMessageBox::Yes) {
QByteArray change = m_changeTmpFile->readAll(); QByteArray change = m_changeTmpFile->readAll();
m_changeTmpFile->close(); m_changeTmpFile->close();
@@ -1007,15 +1002,14 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
void PerforcePlugin::openFiles(const QStringList &files) void PerforcePlugin::openFiles(const QStringList &files)
{ {
foreach (QString s, files) { Core::EditorManager *em = Core::ICore::instance()->editorManager();
m_coreInstance->editorManager()->openEditor(clientFilePath(s)); foreach (QString s, files)
} em->openEditor(clientFilePath(s));
m_coreInstance->editorManager()->ensureEditorManagerVisible(); em->ensureEditorManagerVisible();
} }
QString PerforcePlugin::clientFilePath(const QString &serverFilePath) QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
{ {
QTC_ASSERT(m_coreInstance, return QString());
if (!checkP4Command()) if (!checkP4Command())
return QString(); return QString();
@@ -1041,7 +1035,7 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
QString PerforcePlugin::currentFileName() QString PerforcePlugin::currentFileName()
{ {
QString fileName = m_coreInstance->fileManager()->currentFile(); QString fileName = Core::ICore::instance()->fileManager()->currentFile();
// TODO: Use FileManager::fixPath // TODO: Use FileManager::fixPath
const QFileInfo fileInfo(fileName); const QFileInfo fileInfo(fileName);
@@ -1069,67 +1063,9 @@ bool PerforcePlugin::checkP4Command() const
return true; return true;
} }
#ifdef USE_P4_API
void PerforcePlugin::runP4APICmd(const QString &cmd, const QStringList &args)
{
m_enableP4APIActions = false;
updateActions();
ClientApi client;
if (!m_settings.defaultEnv) {
client.SetClient(m_settings.p4Client.toLatin1().constData());
client.SetPort(m_settings.p4Port.toLatin1().constData());
client.SetUser(m_settings.p4User.toLatin1().constData());
}
Error err;
m_coreInstance->messageManager()->displayStatusBarMessage(tr("Connecting to p4 server..."));
client.SetProtocol("api", "56");
client.Init(&err);
if (err.Test()) {
StrBuf msg;
err.Fmt(&msg);
QMessageBox::critical(m_coreInstance->mainWindow(), tr("Perforce Plugin"), tr("Failed to connect to p4 server <b>%1</b>!").arg(msg.Text()));
client.Final(&err);
m_coreInstance->messageManager()->displayStatusBarMessage(tr("Connection to p4 server failed!"), 3000);
return;
}
m_coreInstance->messageManager()->displayStatusBarMessage(tr("Connection to p4 server established."), 3000);
// ????
//client.SetCwd("c:\\depot\\research\\qworkbench\\src");
int argc = args.count();
char **argv = (char**)malloc(argc*sizeof(char*));
int i = 0;
foreach (QString s, args)
argv[i++] = qstrdup(s.toLatin1().constData());
client.SetArgv( argc, argv );
try {
client.Run(cmd.toLatin1().constData(), m_workbenchClientUser);
} catch (...) {
QMessageBox::critical(m_coreInstance->mainWindow(), tr("Perforce Plugin"), tr("Failed to run command <b>%1</b>!").arg(cmd));
}
client.Final(&err);
i = 0;
while (i<argc)
free(argv[i++]);
free(argv);
m_enableP4APIActions = true;
updateActions();
Core::IEditor *edt = m_coreInstance->editorManager()->currentEditor();
if (edt && edt->widget())
edt->widget()->setFocus();
}
#endif
QString PerforcePlugin::pendingChangesData() QString PerforcePlugin::pendingChangesData()
{ {
QString data; QString data;
Q_ASSERT(m_coreInstance);
if (!checkP4Command()) if (!checkP4Command())
return data; return data;
@@ -1169,22 +1105,18 @@ PerforcePlugin::~PerforcePlugin()
m_settingsPage = 0; m_settingsPage = 0;
} }
#ifdef USE_P4_API
if (m_workbenchClientUser) {
delete m_workbenchClientUser;
m_workbenchClientUser = 0;
}
#endif
if (m_perforceOutputWindow) { if (m_perforceOutputWindow) {
removeObject(m_perforceOutputWindow); removeObject(m_perforceOutputWindow);
delete m_perforceOutputWindow; delete m_perforceOutputWindow;
m_perforceOutputWindow = 0; m_perforceOutputWindow = 0;
} }
if (m_submitEditorFactory) { if (m_submitEditorFactory) {
removeObject(m_submitEditorFactory); removeObject(m_submitEditorFactory);
delete m_submitEditorFactory; delete m_submitEditorFactory;
m_submitEditorFactory = 0; m_submitEditorFactory = 0;
} }
if (m_versionControl) { if (m_versionControl) {
removeObject(m_versionControl); removeObject(m_versionControl);
delete m_versionControl; delete m_versionControl;
@@ -1214,7 +1146,7 @@ void PerforcePlugin::setSettings(const PerforceSettings &s)
{ {
if (s != m_settings) { if (s != m_settings) {
m_settings = s; m_settings = s;
if (QSettings *settings = m_coreInstance->settings()) if (QSettings *settings = Core::ICore::instance()->settings())
m_settings.toSettings(settings); m_settings.toSettings(settings);
} }
} }
@@ -1252,12 +1184,6 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
return rc; return rc;
} }
Core::ICore *PerforcePlugin::coreInstance()
{
QTC_ASSERT(m_coreInstance, return 0);
return m_coreInstance;
}
PerforcePlugin *PerforcePlugin::perforcePluginInstance() PerforcePlugin *PerforcePlugin::perforcePluginInstance()
{ {
QTC_ASSERT(m_perforcePluginInstance, return 0); QTC_ASSERT(m_perforcePluginInstance, return 0);

View File

@@ -42,12 +42,6 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#ifdef USE_P4_API
#include "workbenchclientuser.h"
#else
#endif
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QStringList> #include <QtCore/QStringList>
@@ -117,7 +111,6 @@ public:
Core::IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames); Core::IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames);
static Core::ICore *coreInstance();
static PerforcePlugin *perforcePluginInstance(); static PerforcePlugin *perforcePluginInstance();
PerforceSettings settings() const; PerforceSettings settings() const;
@@ -230,7 +223,6 @@ private:
static const char * const SEPARATOR2; static const char * const SEPARATOR2;
static const char * const SEPARATOR3; static const char * const SEPARATOR3;
static Core::ICore *m_coreInstance;
static PerforcePlugin *m_perforcePluginInstance; static PerforcePlugin *m_perforcePluginInstance;
QString pendingChangesData(); QString pendingChangesData();

View File

@@ -178,8 +178,7 @@ void BuildManager::startBuildQueue()
{ {
if (!m_running) { if (!m_running) {
// Progress Reporting // Progress Reporting
Core::ProgressManager *progressManager = Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->progressManager();
m_progressFutureInterface = new QFutureInterface<void>; m_progressFutureInterface = new QFutureInterface<void>;
m_progressWatcher.setFuture(m_progressFutureInterface->future()); m_progressWatcher.setFuture(m_progressFutureInterface->future());
Core::FutureProgress *progress = progressManager->addTask(m_progressFutureInterface->future(), Core::FutureProgress *progress = progressManager->addTask(m_progressFutureInterface->future(),

View File

@@ -147,10 +147,12 @@ ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
return m_instance; return m_instance;
} }
bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QString *) bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error)
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Q_UNUSED(arguments);
m_core = pm->getObject<Core::ICore>(); Q_UNUSED(error);
m_core = Core::ICore::instance();
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = m_core->actionManager();
addObject(this); addObject(this);

View File

@@ -251,7 +251,7 @@ void TaskModel::setFileNotFound(const QModelIndex &idx, bool b)
TaskWindow::TaskWindow() TaskWindow::TaskWindow()
{ {
m_coreIFace = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
m_model = new TaskModel; m_model = new TaskModel;
m_listview = new TaskView; m_listview = new TaskView;
@@ -266,10 +266,10 @@ TaskWindow::TaskWindow()
m_listview->setContextMenuPolicy(Qt::ActionsContextMenu); m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
m_taskWindowContext = new TaskWindowContext(m_listview); m_taskWindowContext = new TaskWindowContext(m_listview);
m_coreIFace->addContextObject(m_taskWindowContext); core->addContextObject(m_taskWindowContext);
m_copyAction = new QAction(QIcon(Core::Constants::ICON_COPY), tr("&Copy"), this); m_copyAction = new QAction(QIcon(Core::Constants::ICON_COPY), tr("&Copy"), this);
m_coreIFace->actionManager()-> core->actionManager()->
registerAction(m_copyAction, Core::Constants::COPY, m_taskWindowContext->context()); registerAction(m_copyAction, Core::Constants::COPY, m_taskWindowContext->context());
m_listview->addAction(m_copyAction); m_listview->addAction(m_copyAction);
@@ -289,7 +289,7 @@ TaskWindow::TaskWindow()
TaskWindow::~TaskWindow() TaskWindow::~TaskWindow()
{ {
m_coreIFace->removeContextObject(m_taskWindowContext); Core::ICore::instance()->removeContextObject(m_taskWindowContext);
delete m_listview; delete m_listview;
delete m_model; delete m_model;
} }
@@ -315,7 +315,6 @@ void TaskWindow::clearContents()
void TaskWindow::visibilityChanged(bool /* b */) void TaskWindow::visibilityChanged(bool /* b */)
{ {
} }
void TaskWindow::addItem(ProjectExplorer::BuildParserInterface::PatternType type, void TaskWindow::addItem(ProjectExplorer::BuildParserInterface::PatternType type,
@@ -579,7 +578,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
TaskWindowContext::TaskWindowContext(QWidget *widget) TaskWindowContext::TaskWindowContext(QWidget *widget)
: m_taskList(widget) : m_taskList(widget)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_PROBLEM_PANE); m_context << core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_PROBLEM_PANE);
} }

View File

@@ -89,7 +89,6 @@ private slots:
private: private:
int sizeHintForColumn(int column) const; int sizeHintForColumn(int column) const;
Core::ICore *m_coreIFace;
int m_errorCount; int m_errorCount;
int m_currentTask; int m_currentTask;

View File

@@ -38,7 +38,7 @@
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include <extensionsystem/pluginmanager.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
@@ -66,8 +66,7 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
QVariant v = value("clean"); QVariant v = value("clean");
if (v.isNull() || v.toBool() == false) { if (v.isNull() || v.toBool() == false) {
// Normal run // Normal run
QString dumperPath = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() QString dumperPath = Core::ICore::instance()->resourcePath() + "/gdbmacros/";
->resourcePath() + "/gdbmacros/";
QStringList files; QStringList files;
files << "gdbmacros.cpp" files << "gdbmacros.cpp"
<< "gdbmacros.pro"; << "gdbmacros.pro";

View File

@@ -42,7 +42,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
@@ -60,9 +59,10 @@ using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor, Core::ICore *core) ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor)
:BaseTextEditorEditable(editor) : BaseTextEditorEditable(editor)
{ {
Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()-> m_context << core->uniqueIDManager()->
uniqueIdentifier(Qt4ProjectManager::Constants::C_PROFILEEDITOR); uniqueIdentifier(Qt4ProjectManager::Constants::C_PROFILEEDITOR);
m_context << core->uniqueIDManager()-> m_context << core->uniqueIDManager()->
@@ -73,15 +73,13 @@ ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor, Core::ICore
TextEditor::BaseTextEditorEditable *ProFileEditor::createEditableInterface() TextEditor::BaseTextEditorEditable *ProFileEditor::createEditableInterface()
{ {
return new ProFileEditorEditable(this, m_core); return new ProFileEditorEditable(this);
} }
ProFileEditor::ProFileEditor(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah) ProFileEditor::ProFileEditor(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah)
: BaseTextEditor(parent), m_factory(factory), m_ah(ah) : BaseTextEditor(parent), m_factory(factory), m_ah(ah)
{ {
Qt4Manager *manager = factory->qt4ProjectManager(); Qt4Manager *manager = factory->qt4ProjectManager();
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
ProFileDocument *doc = new ProFileDocument(manager); ProFileDocument *doc = new ProFileDocument(manager);
doc->setMimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)); doc->setMimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE));
setBaseTextDocument(doc); setBaseTextDocument(doc);

View File

@@ -41,12 +41,6 @@
namespace TextEditor { namespace TextEditor {
class FontSettings; class FontSettings;
class BaseEditorActionHandler;
}
namespace Core {
class ICore;
class IFile;
} }
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
@@ -66,7 +60,7 @@ class ProFileEditor;
class ProFileEditorEditable : public TextEditor::BaseTextEditorEditable class ProFileEditorEditable : public TextEditor::BaseTextEditorEditable
{ {
public: public:
ProFileEditorEditable(ProFileEditor *, Core::ICore *core); ProFileEditorEditable(ProFileEditor *);
QList<int> context() const; QList<int> context() const;
bool duplicateSupported() const { return true; } bool duplicateSupported() const { return true; }
@@ -98,7 +92,6 @@ public slots:
virtual void setFontSettings(const TextEditor::FontSettings &); virtual void setFontSettings(const TextEditor::FontSettings &);
private: private:
Core::ICore *m_core;
ProFileEditorFactory *m_factory; ProFileEditorFactory *m_factory;
TextEditor::TextEditorActionHandler *m_ah; TextEditor::TextEditorActionHandler *m_ah;
}; };

View File

@@ -40,7 +40,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
@@ -75,7 +74,7 @@ QString ProFileEditorFactory::kind() const
Core::IFile *ProFileEditorFactory::open(const QString &fileName) Core::IFile *ProFileEditorFactory::open(const QString &fileName)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind()); Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0; return iface ? iface->file() : 0;
} }

View File

@@ -36,11 +36,11 @@
#include "makestep.h" #include "makestep.h"
#include "qmakestep.h" #include "qmakestep.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h" #include "qt4projectmanager.h"
#include "ui_qt4buildconfigwidget.h" #include "ui_qt4buildconfigwidget.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/mainwindow.h> #include <coreplugin/mainwindow.h>
#include "qt4projectmanagerconstants.h"
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
@@ -93,7 +93,7 @@ Qt4BuildConfigWidget::~Qt4BuildConfigWidget()
void Qt4BuildConfigWidget::manageQtVersions() void Qt4BuildConfigWidget::manageQtVersions()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
core->showOptionsDialog(Constants::QT_CATEGORY, Constants::QTVERSION_PAGE); core->showOptionsDialog(Constants::QT_CATEGORY, Constants::QTVERSION_PAGE);
} }

View File

@@ -262,7 +262,7 @@ bool Qt4PriFileNode::changeIncludes(ProFile *includeFile, const QStringList &pro
bool Qt4PriFileNode::priFileWritable(const QString &path) bool Qt4PriFileNode::priFileWritable(const QString &path)
{ {
const QString dir = QFileInfo(path).dir().path(); const QString dir = QFileInfo(path).dir().path();
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
Core::IVersionControl *versionControl = core->vcsManager()->findVersionControlForDirectory(dir); Core::IVersionControl *versionControl = core->vcsManager()->findVersionControlForDirectory(dir);
switch (Core::EditorManager::promptReadOnlyFile(path, versionControl, core->mainWindow(), false)) { switch (Core::EditorManager::promptReadOnlyFile(path, versionControl, core->mainWindow(), false)) {
case Core::EditorManager::RO_OpenVCS: case Core::EditorManager::RO_OpenVCS:
@@ -291,7 +291,7 @@ bool Qt4PriFileNode::saveModifiedEditors(const QString &path)
QList<Core::IFile*> allFileHandles; QList<Core::IFile*> allFileHandles;
QList<Core::IFile*> modifiedFileHandles; QList<Core::IFile*> modifiedFileHandles;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
foreach (Core::IFile *file, core->fileManager()->managedFiles(path)) { foreach (Core::IFile *file, core->fileManager()->managedFiles(path)) {
allFileHandles << file; allFileHandles << file;
@@ -428,7 +428,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
void Qt4PriFileNode::save(ProFile *includeFile) void Qt4PriFileNode::save(ProFile *includeFile)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
Core::FileManager *fileManager = core->fileManager(); Core::FileManager *fileManager = core->fileManager();
QList<Core::IFile *> allFileHandles = fileManager->managedFiles(includeFile->fileName()); QList<Core::IFile *> allFileHandles = fileManager->managedFiles(includeFile->fileName());
Core::IFile *modifiedFileHandle = 0; Core::IFile *modifiedFileHandle = 0;
@@ -839,13 +839,12 @@ void Qt4ProFileNode::updateUiFiles()
ProFileReader *Qt4PriFileNode::createProFileReader() const ProFileReader *Qt4PriFileNode::createProFileReader() const
{ {
ProFileReader *reader = new ProFileReader(); ProFileReader *reader = new ProFileReader();
connect(reader, SIGNAL(errorFound(const QString &)), connect(reader, SIGNAL(errorFound(QString)),
m_project, SLOT(proFileParseError(const QString &))); m_project, SLOT(proFileParseError(QString)));
QtVersion *version = m_project->qtVersion(m_project->activeBuildConfiguration()); QtVersion *version = m_project->qtVersion(m_project->activeBuildConfiguration());
if (version->isValid()) { if (version->isValid())
reader->setQtVersion(version); reader->setQtVersion(version);
}
reader->setOutputDir(m_qt4ProFileNode->buildDir()); reader->setOutputDir(m_qt4ProFileNode->buildDir());

View File

@@ -48,6 +48,7 @@
#include "projectloadwizard.h" #include "projectloadwizard.h"
#include "gdbmacrosbuildstep.h" #include "gdbmacrosbuildstep.h"
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>

View File

@@ -42,6 +42,7 @@
#include "qmakestep.h" #include "qmakestep.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/basefilewizard.h> #include <coreplugin/basefilewizard.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>

View File

@@ -97,31 +97,31 @@ static Core::Command *createSeparator(Core::ActionManager *am,
*/ */
bool Qt4ProjectManagerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool Qt4ProjectManagerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage))
return false; return false;
m_projectExplorer = m_core->pluginManager()->getObject<ProjectExplorer::ProjectExplorerPlugin>(); m_projectExplorer = core->pluginManager()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = core->actionManager();
//create and register objects //create and register objects
m_qt4ProjectManager = new Qt4Manager(this, m_core); m_qt4ProjectManager = new Qt4Manager(this, core);
addObject(m_qt4ProjectManager); addObject(m_qt4ProjectManager);
TextEditor::TextEditorActionHandler *editorHandler TextEditor::TextEditorActionHandler *editorHandler
= new TextEditor::TextEditorActionHandler(m_core, Constants::C_PROFILEEDITOR); = new TextEditor::TextEditorActionHandler(core, Constants::C_PROFILEEDITOR);
m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler); m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler);
addObject(m_proFileEditorFactory); addObject(m_proFileEditorFactory);
GuiAppWizard *guiWizard = new GuiAppWizard(m_core); GuiAppWizard *guiWizard = new GuiAppWizard(core);
addAutoReleasedObject(guiWizard); addAutoReleasedObject(guiWizard);
ConsoleAppWizard *consoleWizard = new ConsoleAppWizard(m_core); ConsoleAppWizard *consoleWizard = new ConsoleAppWizard(core);
addAutoReleasedObject(consoleWizard); addAutoReleasedObject(consoleWizard);
LibraryWizard *libWizard = new LibraryWizard(m_core); LibraryWizard *libWizard = new LibraryWizard(core);
addAutoReleasedObject(libWizard); addAutoReleasedObject(libWizard);
addAutoReleasedObject(new QMakeBuildStepFactory); addAutoReleasedObject(new QMakeBuildStepFactory);
@@ -148,7 +148,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList & /*arguments*/, QStr
am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
//register actions //register actions
m_projectContext = m_core->uniqueIDManager()-> m_projectContext = core->uniqueIDManager()->
uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_KIND); uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_KIND);
QList<int> context = QList<int>() << m_projectContext; QList<int> context = QList<int>() << m_projectContext;
Core::Command *command; Core::Command *command;

View File

@@ -36,7 +36,6 @@
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <coreplugin/icore.h>
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
@@ -79,7 +78,6 @@ private slots:
#endif #endif
private: private:
Core::ICore *m_core;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
ProFileEditorFactory *m_proFileEditorFactory; ProFileEditorFactory *m_proFileEditorFactory;
Qt4Manager *m_qt4ProjectManager; Qt4Manager *m_qt4ProjectManager;

View File

@@ -41,7 +41,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/variablemanager.h> #include <coreplugin/variablemanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildstep.h> #include <projectexplorer/buildstep.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -182,8 +181,7 @@ void Qt4RunConfiguration::updateCachedValues()
ProFileReader *reader = static_cast<Qt4Project *>(project())->createProFileReader(); ProFileReader *reader = static_cast<Qt4Project *>(project())->createProFileReader();
if (!reader->readProFile(m_proFilePath)) { if (!reader->readProFile(m_proFilePath)) {
delete reader; delete reader;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore::instance()->messageManager()->printToOutputPane(QString("Could not parse %1. The Qt4 run configuration %2 can not be started.").arg(m_proFilePath).arg(name()));
core->messageManager()->printToOutputPane(QString("Could not parse %1. The Qt4 run configuration %2 can not be started.").arg(m_proFilePath).arg(name()));
return; return;
} }
@@ -233,7 +231,7 @@ QString Qt4RunConfiguration::resolveVariables(const QString &buildConfiguration,
QString relSubDir = QFileInfo(project()->file()->fileName()).absoluteDir().relativeFilePath(m_srcDir); QString relSubDir = QFileInfo(project()->file()->fileName()).absoluteDir().relativeFilePath(m_srcDir);
QString baseDir = QDir(project()->buildDirectory(buildConfiguration)).absoluteFilePath(relSubDir); QString baseDir = QDir(project()->buildDirectory(buildConfiguration)).absoluteFilePath(relSubDir);
Core::VariableManager *vm = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->variableManager(); Core::VariableManager *vm = Core::ICore::instance()->variableManager();
if (!vm) if (!vm)
return QString(); return QString();
QString dest; QString dest;

View File

@@ -37,6 +37,7 @@
#include "msvcenvironment.h" #include "msvcenvironment.h"
#include "cesdkhandler.h" #include "cesdkhandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <help/helpplugin.h> #include <help/helpplugin.h>
@@ -63,8 +64,7 @@ static const char *newQtVersionsKey = "NewQtVersions";
QtVersionManager::QtVersionManager() QtVersionManager::QtVersionManager()
: m_emptyVersion(new QtVersion) : m_emptyVersion(new QtVersion)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); QSettings *s = Core::ICore::instance()->settings();
QSettings *s = m_core->settings();
m_defaultVersion = s->value(defaultQtVersionKey, 0).toInt(); m_defaultVersion = s->value(defaultQtVersionKey, 0).toInt();
m_idcount = 1; m_idcount = 1;
@@ -116,7 +116,8 @@ void QtVersionManager::addVersion(QtVersion *version)
void QtVersionManager::updateDocumentation() void QtVersionManager::updateDocumentation()
{ {
Help::HelpManager *helpManager = m_core->pluginManager()->getObject<Help::HelpManager>(); Help::HelpManager *helpManager
= ExtensionSystem::PluginManager::instance()->getObject<Help::HelpManager>();
Q_ASSERT(helpManager); Q_ASSERT(helpManager);
QStringList fileEndings = QStringList() << "/qch/qt.qch" << "/qch/qmake.qch" << "/qch/designer.qch"; QStringList fileEndings = QStringList() << "/qch/qt.qch" << "/qch/qmake.qch" << "/qch/designer.qch";
QStringList files; QStringList files;
@@ -196,7 +197,7 @@ void QtVersionManager::apply()
void QtVersionManager::writeVersionsIntoSettings() void QtVersionManager::writeVersionsIntoSettings()
{ {
QSettings *s = m_core->settings(); QSettings *s = Core::ICore::instance()->settings();
s->setValue(defaultQtVersionKey, m_defaultVersion); s->setValue(defaultQtVersionKey, m_defaultVersion);
s->beginWriteArray("QtVersions"); s->beginWriteArray("QtVersions");
for (int i = 0; i < m_versions.size(); ++i) { for (int i = 0; i < m_versions.size(); ++i) {
@@ -235,7 +236,7 @@ void QtVersionManager::addNewVersionsFromInstaller()
// NewQtVersions="qt 4.3.2=c:\\qt\\qt432;qt embedded=c:\\qtembedded;" // NewQtVersions="qt 4.3.2=c:\\qt\\qt432;qt embedded=c:\\qtembedded;"
// or NewQtVersions="qt 4.3.2=c:\\qt\\qt432=c:\\qtcreator\\mingw\\=prependToPath; // or NewQtVersions="qt 4.3.2=c:\\qt\\qt432=c:\\qtcreator\\mingw\\=prependToPath;
// Duplicate entries are not added, the first new version is set as default. // Duplicate entries are not added, the first new version is set as default.
QSettings *settings = m_core->settings(); QSettings *settings = Core::ICore::instance()->settings();
if (!settings->contains(newQtVersionsKey)) if (!settings->contains(newQtVersionsKey))
return; return;

View File

@@ -37,7 +37,6 @@
#include "ui_qtversionmanager.h" #include "ui_qtversionmanager.h"
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/icore.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -208,7 +207,6 @@ private:
static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list); static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list);
void updateUniqueIdToIndexMap(); void updateUniqueIdToIndexMap();
Core::ICore *m_core;
QPointer<QtDirWidget> m_widget; QPointer<QtDirWidget> m_widget;
QtVersion *m_emptyVersion; QtVersion *m_emptyVersion;

View File

@@ -35,6 +35,7 @@
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>

View File

@@ -33,25 +33,26 @@
#include "qtestlibplugin.h" #include "qtestlibplugin.h"
#include <QtCore/qplugin.h>
#include <QIcon>
#include <QDebug>
#include <QKeySequence>
#include <QAction>
#include <QHeaderView>
#include <QDomDocument>
#include <QTemporaryFile>
#include <texteditor/TextEditorInterfaces>
#include <Qt4IProjectManagers> #include <Qt4IProjectManagers>
#include <QFileInfo> #include <texteditor/TextEditorInterfaces>
#include <QDir>
#include <QStandardItemModel> #include <QtCore/QAction>
#include <QTreeView> #include <QtCore/QDebug>
#include <QTextEdit> #include <QtCore/QDir>
#include <QSplitter> #include <QtCore/QFileInfo>
#include <QVBoxLayout> #include <QtCore/QIcon>
#include <QComboBox> #include <QtCore/QKeySequence>
#include <QLabel> #include <QtCore/QTemporaryFile>
#include <QtCore/QtPlugin>
#include <QtGui/QComboBox>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QSplitter>
#include <QtGui/QStandardItemModel>
#include <QtGui/QTextEdit>
#include <QtGui/QTreeView>
#include <QtGui/QVBoxLayout>
#include <QtXml/QDomDocument>
using namespace QTestLib::Internal; using namespace QTestLib::Internal;

View File

@@ -78,7 +78,7 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString
{ {
typedef SharedTools::QScriptHighlighter QScriptHighlighter; typedef SharedTools::QScriptHighlighter QScriptHighlighter;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qtscripteditor/QtScriptEditor.mimetypes.xml"), error_message)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qtscripteditor/QtScriptEditor.mimetypes.xml"), error_message))
return false; return false;
m_scriptcontext << core->uniqueIDManager()->uniqueIdentifier(QtScriptEditor::Constants::C_QTSCRIPTEDITOR); m_scriptcontext << core->uniqueIDManager()->uniqueIdentifier(QtScriptEditor::Constants::C_QTSCRIPTEDITOR);

View File

@@ -82,8 +82,7 @@ QuickOpenPlugin::~QuickOpenPlugin()
bool QuickOpenPlugin::initialize(const QStringList &, QString *) bool QuickOpenPlugin::initialize(const QStringList &, QString *)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
m_settingsPage = new SettingsPage(core, this); m_settingsPage = new SettingsPage(core, this);
addObject(m_settingsPage); addObject(m_settingsPage);
@@ -137,7 +136,7 @@ void QuickOpenPlugin::startSettingsLoad()
void QuickOpenPlugin::loadSettings() void QuickOpenPlugin::loadSettings()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
QSettings settings; QSettings settings;
settings.beginGroup("QuickOpen"); settings.beginGroup("QuickOpen");
m_refreshTimer.setInterval(settings.value("RefreshInterval", 60).toInt()*60000); m_refreshTimer.setInterval(settings.value("RefreshInterval", 60).toInt()*60000);
@@ -170,16 +169,15 @@ void QuickOpenPlugin::settingsLoaded()
void QuickOpenPlugin::saveSettings() void QuickOpenPlugin::saveSettings()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (core && core->settings()) { if (core && core->settings()) {
QSettings *s = core->settings(); QSettings *s = core->settings();
s->beginGroup("QuickOpen"); s->beginGroup("QuickOpen");
s->setValue("Interval", m_refreshTimer.interval()/60000); s->setValue("Interval", m_refreshTimer.interval() / 60000);
s->remove(""); s->remove("");
foreach (IQuickOpenFilter *filter, m_filters) { foreach (IQuickOpenFilter *filter, m_filters) {
if (!m_customFilters.contains(filter)) { if (!m_customFilters.contains(filter))
s->setValue(filter->name(), filter->saveState()); s->setValue(filter->name(), filter->saveState());
}
} }
s->beginGroup("CustomFilters"); s->beginGroup("CustomFilters");
int i = 0; int i = 0;
@@ -245,7 +243,7 @@ void QuickOpenPlugin::refresh(QList<IQuickOpenFilter*> filters)
if (filters.isEmpty()) if (filters.isEmpty())
filters = m_filters; filters = m_filters;
QFuture<void> task = QtConcurrent::run(&IQuickOpenFilter::refresh, filters); QFuture<void> task = QtConcurrent::run(&IQuickOpenFilter::refresh, filters);
Core::FutureProgress *progress = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() Core::FutureProgress *progress = Core::ICore::instance()
->progressManager()->addTask(task, tr("Indexing"), Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); ->progressManager()->addTask(task, tr("Indexing"), Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess);
connect(progress, SIGNAL(finished()), this, SLOT(saveSettings())); connect(progress, SIGNAL(finished()), this, SLOT(saveSettings()));
} }

View File

@@ -490,7 +490,6 @@ void QuickOpenToolWindow::showEvent(QShowEvent *event)
void QuickOpenToolWindow::showConfigureDialog() void QuickOpenToolWindow::showConfigureDialog()
{ {
ExtensionSystem::PluginManager::instance() Core::ICore::instance()->showOptionsDialog(Constants::QUICKOPEN_CATEGORY,
->getObject<Core::ICore>()->showOptionsDialog(Constants::QUICKOPEN_CATEGORY,
Constants::FILTER_OPTIONS_PAGE); Constants::FILTER_OPTIONS_PAGE);
} }

View File

@@ -32,14 +32,15 @@
***************************************************************************/ ***************************************************************************/
#include "regexpplugin.h" #include "regexpplugin.h"
#include "settings.h"
#include "regexpwindow.h" #include "regexpwindow.h"
#include "settings.h"
#include <coreplugin/baseview.h> #include <coreplugin/baseview.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
using namespace RegExp::Internal; using namespace RegExp::Internal;
@@ -49,25 +50,24 @@ RegExpPlugin::RegExpPlugin()
RegExpPlugin::~RegExpPlugin() RegExpPlugin::~RegExpPlugin()
{ {
if (m_regexpWindow) { if (m_regexpWindow)
m_regexpWindow->settings().toQSettings(m_core->settings()); m_regexpWindow->settings().toQSettings(Core::ICore::instance()->settings());
}
} }
void RegExpPlugin::extensionsInitialized() void RegExpPlugin::extensionsInitialized()
{ {
} }
bool RegExpPlugin::initialize(const QStringList &arguments, QString *errorMessage)
bool RegExpPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{ {
Q_UNUSED(error_message) Q_UNUSED(arguments);
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(errorMessage)
Core::ICore *core = Core::ICore::instance();
m_regexpWindow = new RegExpWindow; m_regexpWindow = new RegExpWindow;
Settings settings; Settings settings;
settings.fromQSettings(m_core->settings()); settings.fromQSettings(core->settings());
m_regexpWindow->setSettings(settings); m_regexpWindow->setSettings(settings);
const int plugId = m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String("RegExpPlugin")); const int plugId = core->uniqueIDManager()->uniqueIdentifier(QLatin1String("RegExpPlugin"));
addAutoReleasedObject(new Core::BaseView("TextEditor.RegExpWindow", addAutoReleasedObject(new Core::BaseView("TextEditor.RegExpWindow",
m_regexpWindow, m_regexpWindow,
QList<int>() << plugId, QList<int>() << plugId,

View File

@@ -39,10 +39,6 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QPointer> #include <QtCore/QPointer>
namespace Core {
class ICore;
}
namespace RegExp { namespace RegExp {
namespace Internal { namespace Internal {
@@ -56,11 +52,10 @@ public:
RegExpPlugin(); RegExpPlugin();
virtual ~RegExpPlugin(); virtual ~RegExpPlugin();
bool initialize(const QStringList &arguments, QString *error_message); bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized(); void extensionsInitialized();
private: private:
Core::ICore *m_core;
QPointer<RegExpWindow> m_regexpWindow; QPointer<RegExpWindow> m_regexpWindow;
}; };

View File

@@ -56,9 +56,8 @@ using namespace ResourceEditor::Internal;
ResourceEditorPlugin::ResourceEditorPlugin() : ResourceEditorPlugin::ResourceEditorPlugin() :
m_wizard(0), m_wizard(0),
m_editor(0), m_editor(0),
m_core(NULL), m_redoAction(0),
m_redoAction(NULL), m_undoAction(0)
m_undoAction(NULL)
{ {
} }
@@ -68,13 +67,14 @@ ResourceEditorPlugin::~ResourceEditorPlugin()
removeObject(m_wizard); removeObject(m_wizard);
} }
bool ResourceEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message) bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), error_message)) Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage))
return false; return false;
m_editor = new ResourceEditorFactory(m_core, this); m_editor = new ResourceEditorFactory(core, this);
addObject(m_editor); addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
@@ -83,16 +83,16 @@ bool ResourceEditorPlugin::initialize(const QStringList & /*arguments*/, QString
wizardParameters.setCategory(QLatin1String("Qt")); wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt")); wizardParameters.setTrCategory(tr("Qt"));
m_wizard = new ResourceWizard(wizardParameters, m_core, this); m_wizard = new ResourceWizard(wizardParameters, core, this);
addObject(m_wizard); addObject(m_wizard);
error_message->clear(); errorMessage->clear();
// Register undo and redo // Register undo and redo
Core::ActionManager * const actionManager = m_core->actionManager(); Core::ActionManager * const actionManager = core->actionManager();
int const pluginId = m_core->uniqueIDManager()->uniqueIdentifier( int const pluginId = core->uniqueIDManager()->uniqueIdentifier(
Constants::C_RESOURCEEDITOR); Constants::C_RESOURCEEDITOR);
QList<int> const idList = QList<int>() << pluginId; const QList<int> idList = QList<int>() << pluginId;
m_undoAction = new QAction(tr("&Undo"), this); m_undoAction = new QAction(tr("&Undo"), this);
m_redoAction = new QAction(tr("&Redo"), this); m_redoAction = new QAction(tr("&Redo"), this);
actionManager->registerAction(m_undoAction, Core::Constants::UNDO, idList); actionManager->registerAction(m_undoAction, Core::Constants::UNDO, idList);
@@ -129,7 +129,7 @@ void ResourceEditorPlugin::onUndoStackChanged(ResourceEditorW const *editor,
ResourceEditorW * ResourceEditorPlugin::currentEditor() const ResourceEditorW * ResourceEditorPlugin::currentEditor() const
{ {
ResourceEditorW * const focusEditor = qobject_cast<ResourceEditorW *>( ResourceEditorW * const focusEditor = qobject_cast<ResourceEditorW *>(
m_core->editorManager()->currentEditor()); Core::ICore::instance()->editorManager()->currentEditor());
QTC_ASSERT(focusEditor, return 0); QTC_ASSERT(focusEditor, return 0);
return focusEditor; return focusEditor;
} }

View File

@@ -36,11 +36,9 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
QT_FORWARD_DECLARE_CLASS(QAction); QT_BEGIN_NAMESPACE
class QAction;
namespace Core { QT_END_NAMESPACE
class ICore;
}
namespace ResourceEditor { namespace ResourceEditor {
namespace Internal { namespace Internal {
@@ -57,8 +55,8 @@ public:
ResourceEditorPlugin(); ResourceEditorPlugin();
virtual ~ResourceEditorPlugin(); virtual ~ResourceEditorPlugin();
//Plugin // IPlugin
bool initialize(const QStringList &arguments, QString *error_message = 0); bool initialize(const QStringList &arguments, QString *errorMessage = 0);
void extensionsInitialized(); void extensionsInitialized();
private slots: private slots:
@@ -74,7 +72,6 @@ private:
private: private:
ResourceWizard *m_wizard; ResourceWizard *m_wizard;
ResourceEditorFactory *m_editor; ResourceEditorFactory *m_editor;
Core::ICore *m_core;
QAction *m_redoAction; QAction *m_redoAction;
QAction *m_undoAction; QAction *m_undoAction;
}; };

View File

@@ -36,13 +36,12 @@
#include "snippetsplugin.h" #include "snippetsplugin.h"
#include "snippetspec.h" #include "snippetspec.h"
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QShortcut> #include <QtGui/QShortcut>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanagerinterface.h> #include <coreplugin/actionmanager/actionmanagerinterface.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
@@ -69,19 +68,20 @@ void SnippetsPlugin::extensionsInitialized()
{ {
} }
bool SnippetsPlugin::initialize(const QStringList & /*arguments*/, QString *) bool SnippetsPlugin::initialize(const QStringList &arguments, QString *)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
Core::ActionManager *am = m_core->actionManager(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
QList<int> context; QList<int> context;
context << m_core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
m_snippetWnd = new SnippetsWindow(); m_snippetWnd = new SnippetsWindow();
addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree", addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree",
m_snippetWnd, m_snippetWnd,
QList<int>() << m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window")) QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
<< m_core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR), << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR),
Qt::RightDockWidgetArea)); Qt::RightDockWidgetArea));
m_snippetsCompletion = new SnippetsCompletion(this); m_snippetsCompletion = new SnippetsCompletion(this);
addObject(m_snippetsCompletion); addObject(m_snippetsCompletion);
@@ -107,11 +107,12 @@ QString SnippetsPlugin::simplifySnippetName(SnippetSpec *snippet) const
void SnippetsPlugin::snippetActivated() void SnippetsPlugin::snippetActivated()
{ {
Core::ICore *core = Core::ICore::instance();
SnippetSpec *snippet = m_shortcuts.value(sender()); SnippetSpec *snippet = m_shortcuts.value(sender());
if (snippet && m_core->editorManager()->currentEditor()) { if (snippet && core->editorManager()->currentEditor()) {
TextEditor::ITextEditable *te = TextEditor::ITextEditable *te =
qobject_cast<TextEditor::ITextEditable *>( qobject_cast<TextEditor::ITextEditable *>(
m_core->editorManager()->currentEditor()); core->editorManager()->currentEditor());
m_snippetWnd->insertSnippet(te, snippet); m_snippetWnd->insertSnippet(te, snippet);
} }
} }

View File

@@ -40,11 +40,6 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
namespace Core {
class ICore;
struct Application;
}
namespace Snippets { namespace Snippets {
namespace Internal { namespace Internal {
@@ -62,9 +57,8 @@ public:
static SnippetsPlugin *instance() { return m_instance; } static SnippetsPlugin *instance() { return m_instance; }
static SnippetsWindow *snippetsWindow() { return m_instance->m_snippetWnd; } static SnippetsWindow *snippetsWindow() { return m_instance->m_snippetWnd; }
static Core::ICore *core() { return m_instance->m_core; }
bool initialize(const QStringList &arguments, QString *error_message); bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized(); void extensionsInitialized();
private slots: private slots:
@@ -74,7 +68,6 @@ private:
static SnippetsPlugin *m_instance; static SnippetsPlugin *m_instance;
QString simplifySnippetName(SnippetSpec *snippet) const; QString simplifySnippetName(SnippetSpec *snippet) const;
Core::ICore *m_core;
SnippetsCompletion *m_snippetsCompletion; SnippetsCompletion *m_snippetsCompletion;
SnippetsWindow *m_snippetWnd; SnippetsWindow *m_snippetWnd;

View File

@@ -249,8 +249,10 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Subversion::Constants::SUBVERSIONCOMMITEDITOR Subversion::Constants::SUBVERSIONCOMMITEDITOR
}; };
bool SubversionPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
Q_UNUSED(arguments);
typedef VCSBase::VCSSubmitEditorFactory<SubversionSubmitEditor> SubversionSubmitEditorFactory; typedef VCSBase::VCSSubmitEditorFactory<SubversionSubmitEditor> SubversionSubmitEditorFactory;
typedef VCSBase::VCSEditorFactory<SubversionEditor> SubversionEditorFactory; typedef VCSBase::VCSEditorFactory<SubversionEditor> SubversionEditorFactory;
using namespace Constants; using namespace Constants;
@@ -259,7 +261,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments*/, QString *er
using namespace ExtensionSystem; using namespace ExtensionSystem;
m_subversionPluginInstance = this; m_subversionPluginInstance = this;
m_coreInstance = PluginManager::instance()->getObject<Core::ICore>(); m_coreInstance = Core::ICore::instance();
if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage))
return false; return false;
@@ -493,7 +495,7 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname)
if (Subversion::Constants::debug) if (Subversion::Constants::debug)
qDebug() << Q_FUNC_INFO << files << diffname; qDebug() << Q_FUNC_INFO << files << diffname;
const QString source = files.empty() ? QString() : files.front(); const QString source = files.empty() ? QString() : files.front();
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(m_coreInstance, source); QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(source);
if (files.count() == 1 && diffname.isEmpty()) if (files.count() == 1 && diffname.isEmpty())
diffname = QFileInfo(files.front()).fileName(); diffname = QFileInfo(files.front()).fileName();
@@ -760,7 +762,7 @@ void SubversionPlugin::filelogCurrentFile()
void SubversionPlugin::filelog(const QString &file) void SubversionPlugin::filelog(const QString &file)
{ {
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, file); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file);
// no need for temp file // no need for temp file
QStringList args(QLatin1String("log")); QStringList args(QLatin1String("log"));
args.append(QDir::toNativeSeparators(file)); args.append(QDir::toNativeSeparators(file));
@@ -802,7 +804,7 @@ void SubversionPlugin::annotateCurrentFile()
void SubversionPlugin::annotate(const QString &file) void SubversionPlugin::annotate(const QString &file)
{ {
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, file); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file);
QStringList args(QLatin1String("annotate")); QStringList args(QLatin1String("annotate"));
args.push_back(QLatin1String("-v")); args.push_back(QLatin1String("-v"));
@@ -861,7 +863,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
args.push_back(diffArg); args.push_back(diffArg);
args.push_back(topLevel); args.push_back(topLevel);
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, source); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(source);
const SubversionResponse response = runSvn(args, subversionShortTimeOut, false, codec); const SubversionResponse response = runSvn(args, subversionShortTimeOut, false, codec);
if (response.error) if (response.error)
return; return;
@@ -1015,12 +1017,6 @@ void SubversionPlugin::setSettings(const SubversionSettings &s)
} }
} }
Core::ICore *SubversionPlugin::coreInstance()
{
QTC_ASSERT(m_coreInstance, return 0);
return m_coreInstance;
}
SubversionPlugin *SubversionPlugin::subversionPluginInstance() SubversionPlugin *SubversionPlugin::subversionPluginInstance()
{ {
QTC_ASSERT(m_subversionPluginInstance, return m_subversionPluginInstance); QTC_ASSERT(m_subversionPluginInstance, return m_subversionPluginInstance);

View File

@@ -105,7 +105,6 @@ public:
bool managesDirectory(const QString &directory) const; bool managesDirectory(const QString &directory) const;
QString findTopLevelForDirectory(const QString &directory) const; QString findTopLevelForDirectory(const QString &directory) const;
static Core::ICore *coreInstance();
static SubversionPlugin *subversionPluginInstance(); static SubversionPlugin *subversionPluginInstance();
private slots: private slots:

View File

@@ -88,7 +88,7 @@ using namespace TextEditor::Internal;
namespace TextEditor { namespace TextEditor {
namespace Internal { namespace Internal {
class TextEditExtraArea : public QWidget { class TextEditExtraArea : public QWidget {
BaseTextEditor *textEdit; BaseTextEditor *textEdit;
@@ -124,16 +124,15 @@ protected:
} }
}; };
} } // namespace Internal
} } // namespace TextEditor
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName, ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
int line, int line,
int column, int column,
const QString &editorKind) const QString &editorKind)
{ {
Core::EditorManager *editorManager = Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager();
editorManager->addCurrentPositionToNavigationHistory(true); editorManager->addCurrentPositionToNavigationHistory(true);
Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true); Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true);
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor); TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
@@ -563,7 +562,7 @@ bool BaseTextEditor::open(const QString &fileName)
return false; return false;
} }
Core::IFile * BaseTextEditor::file() Core::IFile *BaseTextEditor::file()
{ {
return d->m_document; return d->m_document;
} }

View File

@@ -57,7 +57,7 @@ BaseTextMark::BaseTextMark(const QString &filename, int line)
void BaseTextMark::init() void BaseTextMark::init()
{ {
m_init = true; m_init = true;
Core::EditorManager *em = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager(); Core::EditorManager *em = Core::ICore::instance()->editorManager();
connect(em, SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); connect(em, SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *)));
foreach (Core::IEditor *editor, em->openedEditors()) foreach (Core::IEditor *editor, em->openedEditors())
@@ -117,7 +117,7 @@ void BaseTextMark::updateMarker()
void BaseTextMark::moveMark(const QString & /* filename */, int /* line */) void BaseTextMark::moveMark(const QString & /* filename */, int /* line */)
{ {
Core::EditorManager *em = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager(); Core::EditorManager *em = Core::ICore::instance()->editorManager();
if (!m_init) { if (!m_init) {
connect(em, SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); connect(em, SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *)));
m_init = true; m_init = true;

View File

@@ -49,23 +49,23 @@ using namespace TextEditor;
using namespace TextEditor::Internal; using namespace TextEditor::Internal;
CompletionSupport *CompletionSupport::instance(Core::ICore *core) CompletionSupport *CompletionSupport::instance()
{ {
static CompletionSupport *m_instance = 0; static CompletionSupport *m_instance = 0;
if (!m_instance) { if (!m_instance)
m_instance = new CompletionSupport(core); m_instance = new CompletionSupport;
}
return m_instance; return m_instance;
} }
CompletionSupport::CompletionSupport(Core::ICore *core) CompletionSupport::CompletionSupport()
: QObject(core), : QObject(Core::ICore::instance()),
m_completionList(0), m_completionList(0),
m_startPosition(0), m_startPosition(0),
m_checkCompletionTrigger(false), m_checkCompletionTrigger(false),
m_editor(0) m_editor(0)
{ {
m_completionCollector = core->pluginManager()->getObject<ICompletionCollector>(); m_completionCollector = ExtensionSystem::PluginManager::instance()
->getObject<ICompletionCollector>();
} }
void CompletionSupport::performCompletion(const CompletionItem &item) void CompletionSupport::performCompletion(const CompletionItem &item)

View File

@@ -38,8 +38,6 @@
#include <QtCore/QObject> #include <QtCore/QObject>
namespace Core { class ICore; }
namespace TextEditor { namespace TextEditor {
struct CompletionItem; struct CompletionItem;
@@ -58,9 +56,9 @@ class TEXTEDITOR_EXPORT CompletionSupport : public QObject
Q_OBJECT Q_OBJECT
public: public:
CompletionSupport(Core::ICore *core); CompletionSupport();
static CompletionSupport *instance(Core::ICore *core); static CompletionSupport *instance();
public slots: public slots:
void autoComplete(ITextEditable *editor, bool forced); void autoComplete(ITextEditable *editor, bool forced);

View File

@@ -88,10 +88,12 @@ Core::ICore *TextEditorPlugin::core()
return m_instance->m_core; return m_instance->m_core;
} }
//ExtensionSystem::PluginInterface // ExtensionSystem::PluginInterface
bool TextEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
m_core = Core::ICore::instance();
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage)) if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage))
return false; return false;
@@ -170,9 +172,6 @@ void TextEditorPlugin::initializeEditor(TextEditor::PlainTextEditor *editor)
void TextEditorPlugin::invokeCompletion() void TextEditorPlugin::invokeCompletion()
{ {
if (!m_core)
return;
Core::IEditor *iface = m_core->editorManager()->currentEditor(); Core::IEditor *iface = m_core->editorManager()->currentEditor();
ITextEditor *editor = qobject_cast<ITextEditor *>(iface); ITextEditor *editor = qobject_cast<ITextEditor *>(iface);
if (editor) if (editor)

View File

@@ -36,7 +36,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
namespace VCSBase { namespace VCSBase {
@@ -83,7 +82,7 @@ QStringList BaseVCSSubmitEditorFactory::mimeTypes() const
Core::IFile *BaseVCSSubmitEditorFactory::open(const QString &fileName) Core::IFile *BaseVCSSubmitEditorFactory::open(const QString &fileName)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind())) if (Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind()))
return iface->file(); return iface->file();
return 0; return 0;

View File

@@ -68,8 +68,7 @@ class VCSBaseEditorEditable : public TextEditor::BaseTextEditorEditable
{ {
public: public:
VCSBaseEditorEditable(VCSBaseEditor *, VCSBaseEditorEditable(VCSBaseEditor *,
const VCSBaseEditorParameters *type, const VCSBaseEditorParameters *type);
Core::ICore *);
QList<int> context() const; QList<int> context() const;
bool duplicateSupported() const { return false; } bool duplicateSupported() const { return false; }
@@ -83,11 +82,10 @@ private:
}; };
VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor, VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor,
const VCSBaseEditorParameters *type, const VCSBaseEditorParameters *type)
Core::ICore *core) : : BaseTextEditorEditable(editor), m_kind(type->kind)
BaseTextEditorEditable(editor),
m_kind(type->kind)
{ {
Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(QLatin1String(type->context)) m_context << core->uniqueIDManager()->uniqueIdentifier(QLatin1String(type->context))
<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(TextEditor::Constants::C_TEXTEDITOR)); << core->uniqueIDManager()->uniqueIdentifier(QLatin1String(TextEditor::Constants::C_TEXTEDITOR));
@@ -100,46 +98,39 @@ QList<int> VCSBaseEditorEditable::context() const
// ----------- VCSBaseEditorPrivate // ----------- VCSBaseEditorPrivate
struct VCSBaseEditorPrivate { struct VCSBaseEditorPrivate
{
VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent); VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent);
const VCSBaseEditorParameters *m_parameters; const VCSBaseEditorParameters *m_parameters;
QAction *m_describeAction; QAction *m_describeAction;
QString m_currentChange; QString m_currentChange;
Core::ICore *m_core;
QString m_source; QString m_source;
}; };
VCSBaseEditorPrivate::VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent) : VCSBaseEditorPrivate::VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent)
m_parameters(type), : m_parameters(type), m_describeAction(new QAction(parent))
m_describeAction(new QAction(parent)),
m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>())
{ {
} }
// ------------ VCSBaseEditor // ------------ VCSBaseEditor
VCSBaseEditor::VCSBaseEditor(const VCSBaseEditorParameters *type, VCSBaseEditor::VCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *parent)
QWidget *parent) : : BaseTextEditor(parent),
BaseTextEditor(parent), d(new VCSBaseEditorPrivate(type, this))
m_d(new VCSBaseEditorPrivate(type, this))
{ {
if (VCSBase::Constants::Internal::debug) if (VCSBase::Constants::Internal::debug)
qDebug() << "VCSBaseEditor::VCSBaseEditor" << type->type << type->kind; qDebug() << "VCSBaseEditor::VCSBaseEditor" << type->type << type->kind;
setReadOnly(true); setReadOnly(true);
connect(d->m_describeAction, SIGNAL(triggered()), this, SLOT(describe()));
connect(m_d->m_describeAction, SIGNAL(triggered()), this, SLOT(describe()));
viewport()->setMouseTracking(true); viewport()->setMouseTracking(true);
setBaseTextDocument(new Internal::VCSBaseTextDocument); setBaseTextDocument(new Internal::VCSBaseTextDocument);
setMimeType(QLatin1String(d->m_parameters->mimeType));
setMimeType(QLatin1String(m_d->m_parameters->mimeType));
} }
void VCSBaseEditor::init() void VCSBaseEditor::init()
{ {
switch (m_d->m_parameters->type) { switch (d->m_parameters->type) {
case RegularCommandOutput: case RegularCommandOutput:
case LogOutput: case LogOutput:
case AnnotateOutput: case AnnotateOutput:
@@ -154,17 +145,17 @@ void VCSBaseEditor::init()
VCSBaseEditor::~VCSBaseEditor() VCSBaseEditor::~VCSBaseEditor()
{ {
delete m_d; delete d;
} }
QString VCSBaseEditor::source() const QString VCSBaseEditor::source() const
{ {
return m_d->m_source; return d->m_source;
} }
void VCSBaseEditor::setSource(const QString &source) void VCSBaseEditor::setSource(const QString &source)
{ {
m_d->m_source = source; d->m_source = source;
} }
QTextCodec *VCSBaseEditor::codec() const QTextCodec *VCSBaseEditor::codec() const
@@ -183,7 +174,7 @@ void VCSBaseEditor::setCodec(QTextCodec *c)
EditorContentType VCSBaseEditor::contentType() const EditorContentType VCSBaseEditor::contentType() const
{ {
return m_d->m_parameters->type; return d->m_parameters->type;
} }
bool VCSBaseEditor::isModified() const bool VCSBaseEditor::isModified() const
@@ -193,19 +184,19 @@ bool VCSBaseEditor::isModified() const
TextEditor::BaseTextEditorEditable *VCSBaseEditor::createEditableInterface() TextEditor::BaseTextEditorEditable *VCSBaseEditor::createEditableInterface()
{ {
return new VCSBaseEditorEditable(this, m_d->m_parameters, m_d->m_core); return new VCSBaseEditorEditable(this, d->m_parameters);
} }
void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e) void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e)
{ {
QMenu *menu = createStandardContextMenu(); QMenu *menu = createStandardContextMenu();
// 'click on change-interaction' // 'click on change-interaction'
if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) { if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) {
m_d->m_currentChange = changeUnderCursor(cursorForPosition(e->pos())); d->m_currentChange = changeUnderCursor(cursorForPosition(e->pos()));
if (!m_d->m_currentChange.isEmpty()) { if (!d->m_currentChange.isEmpty()) {
m_d->m_describeAction->setText(tr("Describe change %1").arg(m_d->m_currentChange)); d->m_describeAction->setText(tr("Describe change %1").arg(d->m_currentChange));
menu->addSeparator(); menu->addSeparator();
menu->addAction(m_d->m_describeAction); menu->addAction(d->m_describeAction);
} }
} }
menu->exec(e->globalPos()); menu->exec(e->globalPos());
@@ -217,7 +208,7 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
bool overrideCursor = false; bool overrideCursor = false;
Qt::CursorShape cursorShape; Qt::CursorShape cursorShape;
if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) { if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) {
// Link emulation behaviour for 'click on change-interaction' // Link emulation behaviour for 'click on change-interaction'
QTextCursor cursor = cursorForPosition(e->pos()); QTextCursor cursor = cursorForPosition(e->pos());
QString change = changeUnderCursor(cursor); QString change = changeUnderCursor(cursor);
@@ -245,11 +236,11 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e) void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e)
{ {
if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) { if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) {
if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) {
QTextCursor cursor = cursorForPosition(e->pos()); QTextCursor cursor = cursorForPosition(e->pos());
m_d->m_currentChange = changeUnderCursor(cursor); d->m_currentChange = changeUnderCursor(cursor);
if (!m_d->m_currentChange.isEmpty()) { if (!d->m_currentChange.isEmpty()) {
describe(); describe();
e->accept(); e->accept();
return; return;
@@ -261,7 +252,7 @@ void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e)
void VCSBaseEditor::mouseDoubleClickEvent(QMouseEvent *e) void VCSBaseEditor::mouseDoubleClickEvent(QMouseEvent *e)
{ {
if (m_d->m_parameters->type == DiffOutput) { if (d->m_parameters->type == DiffOutput) {
if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) {
QTextCursor cursor = cursorForPosition(e->pos()); QTextCursor cursor = cursorForPosition(e->pos());
jumpToChangeFromDiff(cursor); jumpToChangeFromDiff(cursor);
@@ -282,16 +273,16 @@ void VCSBaseEditor::keyPressEvent(QKeyEvent *e)
void VCSBaseEditor::describe() void VCSBaseEditor::describe()
{ {
if (VCSBase::Constants::Internal::debug) if (VCSBase::Constants::Internal::debug)
qDebug() << "VCSBaseEditor::describe" << m_d->m_currentChange; qDebug() << "VCSBaseEditor::describe" << d->m_currentChange;
if (!m_d->m_currentChange.isEmpty()) if (!d->m_currentChange.isEmpty())
emit describeRequested(m_d->m_source, m_d->m_currentChange); emit describeRequested(d->m_source, d->m_currentChange);
} }
void VCSBaseEditor::slotActivateAnnotation() void VCSBaseEditor::slotActivateAnnotation()
{ {
// The annotation highlighting depends on contents (change number // The annotation highlighting depends on contents (change number
// set with assigned colors) // set with assigned colors)
if (m_d->m_parameters->type != AnnotateOutput) if (d->m_parameters->type != AnnotateOutput)
return; return;
const QSet<QString> changes = annotationChanges(); const QSet<QString> changes = annotationChanges();
@@ -372,9 +363,10 @@ void VCSBaseEditor::jumpToChangeFromDiff(QTextCursor cursor)
if (!exists) if (!exists)
return; return;
Core::IEditor *ediface = m_d->m_core->editorManager()->openEditor(fileName); Core::EditorManager *em = Core::ICore::instance()->editorManager();
m_d->m_core->editorManager()->ensureEditorManagerVisible(); Core::IEditor *ed = em->openEditor(fileName);
if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ediface)) em->ensureEditorManagerVisible();
if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ed))
editor->gotoLine(chunkStart + lineCount); editor->gotoLine(chunkStart + lineCount);
} }
@@ -386,7 +378,7 @@ void VCSBaseEditor::setPlainTextData(const QByteArray &data)
void VCSBaseEditor::setFontSettings(const TextEditor::FontSettings &fs) void VCSBaseEditor::setFontSettings(const TextEditor::FontSettings &fs)
{ {
TextEditor::BaseTextEditor::setFontSettings(fs); TextEditor::BaseTextEditor::setFontSettings(fs);
if (m_d->m_parameters->type == DiffOutput) { if (d->m_parameters->type == DiffOutput) {
if (DiffHighlighter *highlighter = qobject_cast<DiffHighlighter*>(baseTextDocument()->syntaxHighlighter())) { if (DiffHighlighter *highlighter = qobject_cast<DiffHighlighter*>(baseTextDocument()->syntaxHighlighter())) {
static QVector<QString> categories; static QVector<QString> categories;
if (categories.isEmpty()) { if (categories.isEmpty()) {
@@ -413,11 +405,12 @@ const VCSBaseEditorParameters *VCSBaseEditor::findType(const VCSBaseEditorParame
} }
// Find the codec used for a file querying the editor. // Find the codec used for a file querying the editor.
static QTextCodec *findFileCodec(const Core::ICore *core, const QString &source) static QTextCodec *findFileCodec(const QString &source)
{ {
typedef QList<Core::IEditor *> EditorList; typedef QList<Core::IEditor *> EditorList;
const EditorList editors = core->editorManager()->editorsForFileName(source); const EditorList editors =
Core::ICore::instance()->editorManager()->editorsForFileName(source);
if (!editors.empty()) { if (!editors.empty()) {
const EditorList::const_iterator ecend = editors.constEnd(); const EditorList::const_iterator ecend = editors.constEnd();
for (EditorList::const_iterator it = editors.constBegin(); it != ecend; ++it) for (EditorList::const_iterator it = editors.constBegin(); it != ecend; ++it)
@@ -456,13 +449,13 @@ static QTextCodec *findProjectCodec(const QString &dir)
return 0; return 0;
} }
QTextCodec *VCSBaseEditor::getCodec(const Core::ICore *core, const QString &source) QTextCodec *VCSBaseEditor::getCodec(const QString &source)
{ {
if (!source.isEmpty()) { if (!source.isEmpty()) {
// Check file // Check file
const QFileInfo sourceFi(source); const QFileInfo sourceFi(source);
if (sourceFi.isFile()) if (sourceFi.isFile())
if (QTextCodec *fc = findFileCodec(core, source)) if (QTextCodec *fc = findFileCodec(source))
return fc; return fc;
// Find by project via directory // Find by project via directory
if (QTextCodec *pc = findProjectCodec(sourceFi.isFile() ? sourceFi.absolutePath() : source)) if (QTextCodec *pc = findProjectCodec(sourceFi.isFile() ? sourceFi.absolutePath() : source))

View File

@@ -46,10 +46,6 @@ class QTextCodec;
class QTextCursor; class QTextCursor;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace VCSBase { namespace VCSBase {
struct VCSBaseEditorPrivate; struct VCSBaseEditorPrivate;
@@ -121,7 +117,7 @@ public:
// the editor manager and the project managers (defaults to system codec). // the editor manager and the project managers (defaults to system codec).
// The codec should be set on editors displaying diff or annotation // The codec should be set on editors displaying diff or annotation
// output. // output.
static QTextCodec *getCodec(const Core::ICore *core, const QString &source); static QTextCodec *getCodec(const QString &source);
// Utility to return the editor from the IEditor returned by the editor // Utility to return the editor from the IEditor returned by the editor
// manager which is a BaseTextEditable. // manager which is a BaseTextEditable.
@@ -166,7 +162,7 @@ private:
void jumpToChangeFromDiff(QTextCursor cursor); void jumpToChangeFromDiff(QTextCursor cursor);
VCSBaseEditorPrivate *m_d; VCSBaseEditorPrivate *d;
}; };
} // namespace VCSBase } // namespace VCSBase

View File

@@ -34,13 +34,12 @@
#include "vcsbaseplugin.h" #include "vcsbaseplugin.h"
#include "diffhighlighter.h" #include "diffhighlighter.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
namespace VCSBase { namespace VCSBase {
namespace Internal { namespace Internal {
@@ -57,10 +56,12 @@ VCSBasePlugin::~VCSBasePlugin()
m_instance = 0; m_instance = 0;
} }
bool VCSBasePlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool VCSBasePlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/vcsbase/VCSBase.mimetypes.xml"), errorMessage)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/vcsbase/VCSBase.mimetypes.xml"), errorMessage))
return false; return false;

View File

@@ -59,12 +59,12 @@ enum { wantToolBar = 0 };
namespace VCSBase { namespace VCSBase {
struct VCSBaseSubmitEditorPrivate { struct VCSBaseSubmitEditorPrivate
{
VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters, VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters,
Core::Utils::SubmitEditorWidget *editorWidget, Core::Utils::SubmitEditorWidget *editorWidget,
QObject *q); QObject *q);
Core::ICore *m_core;
Core::Utils::SubmitEditorWidget *m_widget; Core::Utils::SubmitEditorWidget *m_widget;
QToolBar *m_toolWidget; QToolBar *m_toolWidget;
const VCSBaseSubmitEditorParameters *m_parameters; const VCSBaseSubmitEditorParameters *m_parameters;
@@ -79,13 +79,12 @@ struct VCSBaseSubmitEditorPrivate {
VCSBaseSubmitEditorPrivate::VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters, VCSBaseSubmitEditorPrivate::VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters,
Core::Utils::SubmitEditorWidget *editorWidget, Core::Utils::SubmitEditorWidget *editorWidget,
QObject *q) : QObject *q) :
m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()),
m_widget(editorWidget), m_widget(editorWidget),
m_toolWidget(0), m_toolWidget(0),
m_parameters(parameters), m_parameters(parameters),
m_file(new VCSBase::Internal::SubmitEditorFile(QLatin1String(m_parameters->mimeType), q)) m_file(new VCSBase::Internal::SubmitEditorFile(QLatin1String(m_parameters->mimeType), q))
{ {
m_contexts << m_core->uniqueIDManager()->uniqueIdentifier(m_parameters->context); m_contexts << Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(m_parameters->context);
} }
VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters, VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters,