Commit a1877054 authored by hjk's avatar hjk
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 64d058a8 6adecf37
......@@ -234,12 +234,11 @@ public:
BinEditorInterface(BinEditor *parent)
: Core::IEditor(parent)
{
Core::ICore *core = Core::ICore::instance();
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_editor = parent;
m_file = new BinEditorFile(parent);
m_context << core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR);
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Core::Utils::LineColumnLabel;
QHBoxLayout *l = new QHBoxLayout;
......@@ -320,8 +319,8 @@ QString BinEditorFactory::kind() const
Core::IFile *BinEditorFactory::open(const QString &fileName)
{
Core::ICore *core = Core::ICore::instance();
Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind());
Core::EditorManager *em = Core::EditorManager::instance();
Core::IEditor *iface = em->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}
......@@ -384,8 +383,8 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed()));
editor->setEditorInterface(editorInterface);
Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR);
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
if (!m_undoAction) {
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
this, SLOT(undoAction()),
......
......@@ -293,8 +293,7 @@ void BookmarkView::gotoBookmark(const QModelIndex &index)
BookmarkContext::BookmarkContext(BookmarkView *widget)
: m_bookmarkView(widget)
{
Core::ICore *core = ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
m_context << UniqueIDManager::instance()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
}
QList<int> BookmarkContext::context() const
......@@ -509,7 +508,7 @@ void BookmarkManager::documentPrevNext(bool next)
nextLine = markLine;
}
Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::EditorManager *em = Core::EditorManager::instance();
em->addCurrentPositionToNavigationHistory(true);
if (next) {
if (nextLine == -1)
......@@ -554,7 +553,7 @@ void BookmarkManager::prev()
TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
{
Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::EditorManager *em = Core::EditorManager::instance();
Core::IEditor *currEditor = em->currentEditor();
if (!currEditor)
return 0;
......
......@@ -36,7 +36,6 @@
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
......@@ -44,9 +43,9 @@ using namespace CMakeProjectManager::Internal;
CMakeManager::CMakeManager()
{
Core::ICore *core = Core::ICore::instance();
m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_projectContext = uidm->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
}
int CMakeManager::projectContext() const
......
......@@ -109,8 +109,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
QDomElement root = doc.createElement("mapping");
doc.appendChild(root);
for (int i = 0; i < items.count(); ++i) {
ShortcutItem *item = items.at(i);
foreach (const ShortcutItem *item, items) {
QDomElement ctag = doc.createElement("shortcut");
ctag.setAttribute(QLatin1String("id"), idmanager->stringForUniqueIdentifier(item->m_cmd->id()));
root.appendChild(ctag);
......
......@@ -509,7 +509,7 @@ bool BaseFileWizard::postGenerateFiles(const GeneratedFiles &l, QString *errorMe
{
// File mode: open the editors in file mode and ensure editor pane
const Core::GeneratedFiles::const_iterator cend = l.constEnd();
Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::EditorManager *em = Core::EditorManager::instance();
for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) {
if (!em->openEditor(it->path(), it->editorKind())) {
*errorMessage = tr("Failed to open an editor for %1").arg(it->path());
......
......@@ -85,7 +85,7 @@ bool CorePlugin::initialize(const QStringList & /*arguments*/, QString *error_me
m_welcomeMode = new WelcomeMode;
addObject(m_welcomeMode);
EditorManager *editorManager = qobject_cast<EditorManager*>(m_mainWindow->editorManager());
EditorManager *editorManager = m_mainWindow->editorManager();
m_editMode = new EditMode(editorManager);
addObject(m_editMode);
}
......
......@@ -599,8 +599,7 @@ QList<IEditor*>
return found.toList();
}
QList<IFile *>
EditorManager::filesForEditors(QList<IEditor *> editors) const
QList<IFile *> EditorManager::filesForEditors(QList<IEditor *> editors) const
{
QSet<IEditor *> handledEditors;
QList<IFile *> files;
......@@ -925,9 +924,8 @@ QStringList EditorManager::getOpenFileNames() const
void EditorManager::ensureEditorManagerVisible()
{
if (!isVisible()) {
if (!isVisible())
m_d->m_core->modeManager()->activateMode(Constants::MODE_EDIT);
}
}
IEditor *EditorManager::newFile(const QString &editorKind,
......
......@@ -223,8 +223,7 @@ void OpenEditorsWidget::closeEditors()
core->fileManager()->saveModifiedFiles(selectedFiles, &cancelled);
if (cancelled)
return;
core->editorManager()->
closeEditors(selectedEditors);
core->editorManager()->closeEditors(selectedEditors);
updateEditorList();
}
......
......@@ -509,7 +509,7 @@ void FileManager::syncWithEditor(Core::IContext *context)
if (!context)
return;
Core::IEditor *editor = Core::ICore::instance()->editorManager()->currentEditor();
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor();
if (editor && (editor->widget() == context->widget()))
setCurrentFile(editor->file()->fileName());
}
......
......@@ -84,8 +84,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
// Create the globalcontext list to register actions accordingly
QList<int> globalcontext;
globalcontext << ICore::instance()->uniqueIDManager()->
uniqueIdentifier(Core::Constants::C_GLOBAL);
globalcontext << UniqueIDManager::instance()->uniqueIdentifier(Core::Constants::C_GLOBAL);
// Create the settings Page
m_settingsPage = new SettingsPage();
......@@ -129,7 +128,7 @@ void CodepasterPlugin::post()
{
if (m_poster)
delete m_poster;
IEditor* editor = ICore::instance()->editorManager()->currentEditor();
IEditor* editor = EditorManager::instance()->currentEditor();
ITextEditor* textEditor = qobject_cast<ITextEditor*>(editor);
if (!textEditor)
return;
......@@ -240,8 +239,7 @@ void CustomFetcher::customRequestFinished(int, bool error)
QByteArray data = body();
if (!m_listWidget) {
QString title = QString::fromLatin1("Code Paster: %1").arg(m_id);
ICore::instance()->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR
, &title, data);
EditorManager::instance()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR, &title, data);
} else {
m_listWidget->clear();
QStringList lines = QString(data).split(QLatin1Char('\n'));
......
......@@ -139,10 +139,10 @@ QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &contex
CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
: BaseTextEditorEditable(editor)
{
Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
m_context << core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
m_context << uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
}
CPPEditor::CPPEditor(QWidget *parent)
......@@ -334,10 +334,10 @@ void CPPEditor::jumpToMethod(int)
if (! symbol)
return;
Core::ICore::instance()->editorManager()->addCurrentPositionToNavigationHistory(true);
Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(true);
int line = symbol->line();
gotoLine(line);
Core::ICore::instance()->editorManager()->addCurrentPositionToNavigationHistory();
Core::EditorManager::instance()->addCurrentPositionToNavigationHistory();
setFocus();
}
......
......@@ -88,7 +88,7 @@ QString CppPluginEditorFactory::kind() const
Core::IFile *CppPluginEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}
......@@ -238,20 +238,18 @@ void CppPlugin::extensionsInitialized()
void CppPlugin::switchDeclarationDefinition()
{
Core::ICore *core = Core::ICore::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget());
if (editor) {
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(em->currentEditor()->widget());
if (editor)
editor->switchDeclarationDefinition();
}
}
void CppPlugin::jumpToDefinition()
{
Core::ICore *core = Core::ICore::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget());
if (editor) {
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(em->currentEditor()->widget());
if (editor)
editor->jumpToDefinition();
}
}
Q_EXPORT_PLUGIN(CppPlugin)
......@@ -147,7 +147,7 @@ void CppToolsPlugin::shutdown()
void CppToolsPlugin::switchHeaderSource()
{
Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *editor = editorManager->currentEditor();
QString otherFile = correspondingHeaderOrSource(editor->file()->fileName());
if (!otherFile.isEmpty()) {
......
......@@ -723,18 +723,17 @@ void DebuggerPlugin::activatePreviousMode()
void DebuggerPlugin::activateDebugMode()
{
ICore *core = ICore::instance();
Core::ModeManager *modeManager = core->modeManager();
ModeManager *modeManager = ModeManager::instance();
m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName());
modeManager->activateMode(QLatin1String(MODE_DEBUG));
}
void DebuggerPlugin::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object)
{
ICore *core = ICore::instance();
if (!core || !core->editorManager())
EditorManager *editorManager = EditorManager::instance();
if (!editorManager)
return;
Core::IEditor *editor = core->editorManager()->currentEditor();
Core::IEditor *editor = editorManager->currentEditor();
ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor);
if (!textEditor)
return;
......
......@@ -63,7 +63,7 @@ QString FormEditorFactory::kind() const
Core::IFile *FormEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}
......
......@@ -236,8 +236,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
m_gitClient = new GitClient(this);
// Create the globalcontext list to register actions accordingly
QList<int> globalcontext;
globalcontext << m_core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::C_GLOBAL);
globalcontext << m_core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_GLOBAL);
// Create the output Window
m_outputWindow = new GitOutputWindow();
......
......@@ -241,8 +241,8 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess
globalcontext << Core::Constants::C_GLOBAL_ID;
QList<int> perforcesubmitcontext;
perforcesubmitcontext <<
Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_PERFORCESUBMITEDITOR);
perforcesubmitcontext << Core::UniqueIDManager::instance()->
uniqueIdentifier(Constants::C_PERFORCESUBMITEDITOR);
Core::Command *command;
QAction *tmpaction;
......@@ -467,7 +467,7 @@ void PerforcePlugin::diffAllOpened()
void PerforcePlugin::printOpenedFileList()
{
Core::IEditor *e = Core::ICore::instance()->editorManager()->currentEditor();
Core::IEditor *e = Core::EditorManager::instance()->currentEditor();
if (e)
e->widget()->setFocus();
PerforceResponse result = runP4Cmd(QStringList() << QLatin1String("opened"), QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
......@@ -542,9 +542,9 @@ void PerforcePlugin::submit()
Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
{
Core::IEditor *editor =
Core::ICore::instance()->editorManager()->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND);
Core::ICore::instance()->editorManager()->ensureEditorManagerVisible();
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *editor = editorManager->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND);
editorManager->ensureEditorManagerVisible();
PerforceSubmitEditor *submitEditor = dynamic_cast<PerforceSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
submitEditor->restrictToProjectFiles(depotFileNames);
......@@ -841,9 +841,9 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q
if (Perforce::Constants::debug)
qDebug() << "PerforcePlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
Core::IEditor *ediface = Core::ICore::instance()->editorManager()->
Core::IEditor *editor = Core::EditorManager::instance()->
newFile(kind, &s, output.toLocal8Bit());
PerforceEditor *e = qobject_cast<PerforceEditor*>(ediface->widget());
PerforceEditor *e = qobject_cast<PerforceEditor*>(editor->widget());
if (!e)
return 0;
s.replace(QLatin1Char(' '), QLatin1Char('_'));
......@@ -857,7 +857,7 @@ QStringList PerforcePlugin::environment() const
{
QStringList newEnv = QProcess::systemEnvironment();
const QString name = "P4DIFF";
for (int i=0; i<newEnv.count(); ++i) {
for (int i = 0; i < newEnv.count(); ++i) {
if (newEnv.at(i).startsWith(name)) {
newEnv.removeAt(i);
return newEnv;
......@@ -889,7 +889,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
diffname = fi.fileName();
}
foreach (Core::IEditor *ed, Core::ICore::instance()->editorManager()->openedEditors()) {
foreach (Core::IEditor *ed, Core::EditorManager::instance()->openedEditors()) {
if (ed->property("originalFileName").toString() == fileName) {
existingEditor = ed;
displayInEditor = false;
......@@ -912,7 +912,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
} else if (!displayInEditor && existingEditor) {
if (existingEditor) {
existingEditor->createNew(result.stdOut);
Core::ICore::instance()->editorManager()->setCurrentEditor(existingEditor);
Core::EditorManager::instance()->setCurrentEditor(existingEditor);
}
}
}
......@@ -930,7 +930,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
void PerforcePlugin::submitCurrentLog()
{
Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::EditorManager *em = Core::EditorManager::instance();
em->closeEditors(QList<Core::IEditor*>() << em->currentEditor());
}
......@@ -1004,8 +1004,8 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
void PerforcePlugin::openFiles(const QStringList &files)
{
Core::EditorManager *em = Core::ICore::instance()->editorManager();
foreach (QString s, files)
Core::EditorManager *em = Core::EditorManager::instance();
foreach (const QString &s, files)
em->openEditor(clientFilePath(s));
em->ensureEditorManagerVisible();
}
......
......@@ -170,7 +170,7 @@ void FolderNavigationWidget::openItem(const QModelIndex &index)
setCurrentTitle(QDir(m_dirModel->filePath(srcIndex)));
} else {
const QString filePath = m_dirModel->filePath(srcIndex);
Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->openEditor(filePath);
editorManager->ensureEditorManagerVisible();
}
......
......@@ -870,7 +870,7 @@ bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames)
updateActions();
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
QApplication::restoreOverrideCursor();
return true;
......@@ -986,7 +986,7 @@ void ProjectExplorerPlugin::restoreSession()
}
// update welcome page
Core::ModeManager *modeManager = Core::ICore::instance()->modeManager();
Core::ModeManager *modeManager = Core::ModeManager::instance();
connect(modeManager, SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(currentModeChanged(Core::IMode*)));
if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast<Core::Internal::WelcomeMode*>(modeManager->mode(Core::Constants::MODE_WELCOME))) {
updateWelcomePage(welcomeMode);
......@@ -1618,9 +1618,9 @@ void ProjectExplorerPlugin::openFile()
{
if (m_currentNode)
return;
Core::ICore *core = Core::ICore::instance();
core->editorManager()->openEditor(m_currentNode->path());
core->editorManager()->ensureEditorManagerVisible();
Core::EditorManager *em = Core::EditorManager::instance();
em->openEditor(m_currentNode->path());
em->ensureEditorManagerVisible();
}
void ProjectExplorerPlugin::removeFile()
......@@ -1802,7 +1802,7 @@ void ProjectExplorerPlugin::openWithMenuTriggered(QAction *action)
qWarning() << "Editor Factory not attached to action, can't happen"<<editorFactory;
return;
}
Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::EditorManager *em = Core::EditorManager::instance();
em->openEditor(currentNode()->path(), editorFactory->kind());
em->ensureEditorManagerVisible();
}
......
......@@ -291,7 +291,7 @@ void ProjectTreeWidget::openItem(const QModelIndex &mainIndex)
{
Node *node = m_model->nodeForIndex(mainIndex);
if (node->nodeType() == FileNodeType) {
Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->openEditor(node->path());
editorManager->ensureEditorManagerVisible();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment