void QmlEngine::gotoLocation(const Location &location) { const QString fileName = location.fileName(); // TODO: QUrl::isLocalFile() once we depend on Qt 4.8 if (QUrl(fileName).scheme().compare(QLatin1String("file"), Qt::CaseInsensitive) == 0) { // internal file from source files -> show generated .js QTC_ASSERT(m_sourceDocuments.contains(fileName), return); Core::IEditor *editor = 0; Core::EditorManager *editorManager = Core::EditorManager::instance(); QString titlePattern = tr("JS Source for %1").arg(fileName); //Check if there are open editors with the same title QList<Core::IEditor *> editors = editorManager->openedEditors(); foreach (Core::IEditor *ed, editors) { if (ed->displayName() == titlePattern) { editor = ed; break; } } if (!editor) { editor = Core::EditorManager::openEditorWithContents(QmlJSEditor::Constants::C_QMLJSEDITOR_ID, &titlePattern); if (editor) { editor->setProperty(Constants::OPENED_BY_DEBUGGER, true); } updateEditor(editor, m_sourceDocuments.value(fileName)); } Core::EditorManager::activateEditor(editor); } else {
void BaseTextMark::init() { m_init = true; Core::EditorManager *em = Core::EditorManager::instance(); connect(em, SIGNAL(editorOpened(Core::IEditor *)), SLOT(editorOpened(Core::IEditor *))); foreach (Core::IEditor *editor, em->openedEditors()) editorOpened(editor); }
void BaseTextMark::moveMark(const QString & /* filename */, int /* line */) { Core::EditorManager *em = Core::EditorManager::instance(); if (!m_init) { connect(em, SIGNAL(editorOpened(Core::IEditor *)), SLOT(editorOpened(Core::IEditor *))); m_init = true; } if (m_markableInterface) m_markableInterface->removeMark(this); foreach (Core::IEditor *editor, em->openedEditors()) editorOpened(editor); }