diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 7668bf83228fbd111ab0a22d494c9b44d76f4c68..973d4153eea9eebf58855ec8de4b26c3a7572067 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -687,7 +687,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA } if (currentEditorRemoved) { if (m_d->m_editorHistory.count() > 0) { - setCurrentEditor(m_d->m_editorHistory.first(), true); + activateEditor(m_d->m_editorHistory.first(), true); } else { editorChanged(currentEditor()); } @@ -1223,7 +1223,7 @@ void EditorManager::updateActions() QList<IEditor*> EditorManager::openedEditors() const { - return m_d->m_view->editors(); + return m_d->m_editorModel->editors(); } Internal::EditorModel *EditorManager::openedEditorsModel() const @@ -1611,7 +1611,7 @@ void EditorManager::unsplitAll() { m_d->m_splitter->unsplit(0); if (IEditor *e = m_d->m_splitter->editor()) - setCurrentEditor(e); + activateEditor(e); } void EditorManager::gotoOtherWindow() diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 36448d44a333ce6c3254ab2776a4af58bf5f1f7c..833032be4210fcbee936c0f0b82be3bacad6c3a5 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -116,7 +116,9 @@ public: bool hasEditor(const QString &fileName) const; QList<IEditor *> editorsForFileName(const QString &filename) const; +private: void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false); +public: IEditor *currentEditor() const; IEditor *activateEditor(IEditor *editor, bool ignoreNavigationHistory = false); // EditorGroup *currentEditorGroup() const; diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index 316843c88e91f706b8ff319d0fafddce5788d110..f653e235118f2352ba27c751f20f501f4c345a38 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -235,7 +235,7 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item) IEditor *editor = 0; if (item) editor = item->data(0, Qt::UserRole).value<IEditor*>(); - EditorManager::instance()->setCurrentEditor(editor); + EditorManager::instance()->activateEditor(editor); } void OpenEditorsWindow::editorClicked(QTreeWidgetItem *item) diff --git a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp index b85732c4a460cfdf27ce8a4685eadfc6c7585b81..e7dee79aefd6b7a6ff7c7bf7af838c84cb2c2ec4 100644 --- a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp +++ b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp @@ -252,9 +252,9 @@ Core::IEditor *EditorManagerPrototype::currentEditor() const return callee()->currentEditor(); } -void EditorManagerPrototype::setCurrentEditor(Core::IEditor *editor) +void EditorManagerPrototype::activateEditor(Core::IEditor *editor) { - callee()->setCurrentEditor(editor); + callee()->activateEditor(editor); } QList<Core::IEditor*> EditorManagerPrototype::openedEditors() const @@ -267,11 +267,6 @@ QList<Core::IEditor*> EditorManagerPrototype::editorHistory() const return callee()->editorHistory(); } -//QList<Core::EditorGroup *> EditorManagerPrototype::editorGroups() const -//{ -// return callee()->editorGroups(); -//} - QList<Core::IEditor*> EditorManagerPrototype::editorsForFiles(QList<Core::IFile*> files) const { return callee()->editorsForFiles(files); @@ -376,70 +371,6 @@ QString EditorPrototype::toString() const return rc; } -// ----------- EditorGroupPrototype - -EditorGroupPrototype::EditorGroupPrototype(QObject *parent) : - QObject(parent) -{ -} - -int EditorGroupPrototype::editorCount() const -{ - return callee()->editorCount(); -} - -Core::IEditor *EditorGroupPrototype::currentEditor() const -{ - return callee()->currentEditor(); -} - -void EditorGroupPrototype::setCurrentEditor(Core::IEditor *editor) -{ - callee()->setCurrentEditor(editor); -} - -QList<Core::IEditor*> EditorGroupPrototype::editors() const -{ - return callee()->editors(); -} - -void EditorGroupPrototype::addEditor(Core::IEditor *editor) -{ - callee()->addEditor(editor); -} - -void EditorGroupPrototype::insertEditor(int i, Core::IEditor *editor) -{ - callee()->insertEditor(i, editor); -} - -void EditorGroupPrototype::removeEditor(Core::IEditor *editor) -{ - callee()->removeEditor(editor); -} - - -void EditorGroupPrototype::moveEditorsFromGroup(Core::EditorGroup *group) -{ - callee()->moveEditorsFromGroup(group); -} - -void EditorGroupPrototype::moveEditorFromGroup(Core::EditorGroup *group, Core::IEditor *editor) -{ - callee()->moveEditorFromGroup(group, editor); -} - -QString EditorGroupPrototype::toString() const -{ - return QLatin1String("EditorGroup"); -} - -Core::EditorGroup *EditorGroupPrototype::callee() const -{ - EditorGroup *rc = qscriptvalue_cast<EditorGroup *>(thisObject()); - QTC_ASSERT(rc, return 0); - return rc; -} } // namespace Internal } // namespace Core diff --git a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h index 3df8de92c017165b8c71be8253c163c3ef8e06e9..d2b3889e5c9113a17ed02e33c9a8b18e43f70d6a 100644 --- a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h +++ b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h @@ -167,20 +167,18 @@ private: class EditorManagerPrototype : public QObject, public QScriptable { Q_OBJECT - Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE setCurrentEditor DESIGNABLE false SCRIPTABLE true STORED false) + Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE activateEditor DESIGNABLE false SCRIPTABLE true STORED false) Q_PROPERTY(QList<Core::IEditor*> openedEditors READ openedEditors DESIGNABLE false SCRIPTABLE true STORED false) Q_PROPERTY(QList<Core::IEditor*> editorHistory READ editorHistory DESIGNABLE false SCRIPTABLE true STORED false) -// Q_PROPERTY(QList<Core::EditorGroup *> editorGroups READ editorGroups DESIGNABLE false SCRIPTABLE true STORED false) public: typedef Core::EditorManager EditorManager; EditorManagerPrototype(QObject *parent = 0); Core::IEditor *currentEditor() const; - void setCurrentEditor(Core::IEditor *editor); + void activateEditor(Core::IEditor *editor); QList<Core::IEditor*> openedEditors() const; QList<Core::IEditor*> editorHistory() const; -// QList<Core::EditorGroup *> editorGroups() const; public slots: QList<Core::IEditor*> editorsForFiles(QList<Core::IFile*> files) const; @@ -229,37 +227,6 @@ private: Core::IEditor *callee() const; }; -// Script prototype for the editor group interface with Script-managed life cycle. - -class EditorGroupPrototype : public QObject, public QScriptable -{ - Q_OBJECT - Q_PROPERTY(int editorCount READ editorCount DESIGNABLE false SCRIPTABLE true STORED false) - Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE setCurrentEditor DESIGNABLE false SCRIPTABLE true STORED false) - Q_PROPERTY(QList<Core::IEditor*> editors READ editors DESIGNABLE false SCRIPTABLE true STORED false) - -public: - EditorGroupPrototype(QObject *parent = 0); - - int editorCount() const; - Core::IEditor *currentEditor() const; - void setCurrentEditor(Core::IEditor *editor); - QList<Core::IEditor*> editors() const; - -public slots: - void addEditor(Core::IEditor *editor); - void insertEditor(int i, Core::IEditor *editor); - void removeEditor(Core::IEditor *editor); - - void moveEditorsFromGroup(Core::EditorGroup *group); - void moveEditorFromGroup(Core::EditorGroup *group, Core::IEditor *editor); - - QString toString() const; - -private: - Core::EditorGroup *callee() const; -}; - } // namespace Internal } // namespace Core diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index e20ee11f9657d6b6613fbc3eea9eef2623a17728..5f7225e36d685f654a31af5ac9eeca84b82ad218 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -169,7 +169,7 @@ VCSBase::VCSBaseEditor outputEditor->createNew(m_msgWait); rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor); QTC_ASSERT(rc, return 0); - m_core->editorManager()->setCurrentEditor(outputEditor); + m_core->editorManager()->activateEditor(outputEditor); } else { // Create new, set wait message, set up with source and codec outputEditor = m_core->editorManager()->newFile(kind, &title, m_msgWait); diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index b17cb7e5b6ee775daa72a37708c66d7cab836684..2b4da85bf2b58b9c2273613d34ec71ca6b392c6a 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -912,7 +912,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname) } else if (!displayInEditor && existingEditor) { if (existingEditor) { existingEditor->createNew(result.stdOut); - Core::EditorManager::instance()->setCurrentEditor(existingEditor); + Core::EditorManager::instance()->activateEditor(existingEditor); } } } diff --git a/src/plugins/quickopen/opendocumentsfilter.cpp b/src/plugins/quickopen/opendocumentsfilter.cpp index 7b09fdcede9c45709150cdc7b9ff8566481e1fa9..a5419cde0192dbb86aa04a8b9320785e047e0e07 100644 --- a/src/plugins/quickopen/opendocumentsfilter.cpp +++ b/src/plugins/quickopen/opendocumentsfilter.cpp @@ -97,7 +97,7 @@ void OpenDocumentsFilter::accept(FilterEntry selection) const { IEditor *editor = selection.internalData.value<IEditor *>(); if (editor) { - m_editorManager->setCurrentEditor(editor); + m_editorManager->activateEditor(editor); return; } m_editorManager->openEditor(selection.internalData.toString()); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 7f6ea476eb29d12fd27ae5f74102fa476757c97b..115259bc5f6df659ad1ddf38dcd4c6739694bbf2 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -513,7 +513,7 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname) // Show in the same editor if diff has been executed before if (Core::IEditor *editor = locateEditor("originalFileName", files.front())) { editor->createNew(response.stdOut); - Core::EditorManager::instance()->setCurrentEditor(editor); + Core::EditorManager::instance()->activateEditor(editor); return; } } @@ -776,7 +776,7 @@ void SubversionPlugin::filelog(const QString &file) if (Core::IEditor *editor = locateEditor("logFileName", file)) { editor->createNew(response.stdOut); - Core::EditorManager::instance()->setCurrentEditor(editor); + Core::EditorManager::instance()->activateEditor(editor); } else { const QString title = tr("svn log %1").arg(QFileInfo(file).fileName()); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, file, codec); @@ -819,7 +819,7 @@ void SubversionPlugin::annotate(const QString &file) if (Core::IEditor *editor = locateEditor("annotateFileName", file)) { editor->createNew(response.stdOut); - Core::EditorManager::instance()->setCurrentEditor(editor); + Core::EditorManager::instance()->activateEditor(editor); } else { const QString title = tr("svn annotate %1").arg(QFileInfo(file).fileName()); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, file, codec); @@ -873,7 +873,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) const QString id = diffArg + source; if (Core::IEditor *editor = locateEditor("describeChange", id)) { editor->createNew(response.stdOut); - Core::EditorManager::instance()->setCurrentEditor(editor); + Core::EditorManager::instance()->activateEditor(editor); } else { const QString title = tr("svn describe %1#%2").arg(QFileInfo(source).fileName(), changeNr); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::DiffOutput, source, codec);