ITextEditor *LineNumberFilter::currentTextEditor() const { Core::EditorManager *editorManager = Core::EditorManager::instance(); if (!editorManager->currentEditor()) return 0; return qobject_cast<TextEditor::ITextEditor*>(editorManager->currentEditor()); }
void QmlJSEditorPlugin::openPreview() { Core::EditorManager *em = Core::EditorManager::instance(); if (em->currentEditor() && em->currentEditor()->id() == Constants::C_QMLJSEDITOR_ID) m_previewRunner->run(em->currentEditor()->file()->fileName()); }
void Mode::grabEditorManager( Core::IMode * mode ) { if ( mode != this ) return; Core::EditorManager * em = Core::EditorManager::instance(); if ( em && em->currentEditor() ) em->currentEditor()->widget()->setFocus(); }
void QmlJSEditorPlugin::followSymbolUnderCursor() { Core::EditorManager *em = Core::EditorManager::instance(); if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget())) editor->followSymbolUnderCursor(); }
void CppPlugin::findUsages() { Core::EditorManager *em = Core::EditorManager::instance(); CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget()); if (editor) editor->findUsages(); }
void CppPlugin::renameSymbolUnderCursor() { Core::EditorManager *em = Core::EditorManager::instance(); CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget()); if (editor) editor->renameSymbolUnderCursor(); }
void CppPlugin::jumpToDefinition() { Core::EditorManager *em = Core::EditorManager::instance(); CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget()); if (editor) editor->jumpToDefinition(); }
void CppToolsPlugin::switchHeaderSource() { Core::EditorManager *editorManager = Core::EditorManager::instance(); Core::IEditor *editor = editorManager->currentEditor(); QString otherFile = correspondingHeaderOrSource(editor->file()->fileName()); if (!otherFile.isEmpty()) editorManager->openEditor(otherFile); }
void CppPlugin::openTypeHierarchy() { Core::EditorManager *em = Core::EditorManager::instance(); CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget()); if (editor) { Core::NavigationWidget *navigation = Core::NavigationWidget::instance(); navigation->activateSubWidget(QLatin1String(Constants::TYPE_HIERARCHY_ID)); emit typeHierarchyRequested(); } }
void QmlJSEditorPlugin::reformatFile() { Core::EditorManager *em = Core::EditorManager::instance(); if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget())) { QTC_ASSERT(!editor->isSemanticInfoOutdated(), return); const QString &newText = QmlJS::reformat(editor->semanticInfo().document); QTextCursor tc(editor->textCursor()); tc.movePosition(QTextCursor::Start); tc.movePosition(QTextCursor::End, QTextCursor::KeepAnchor); tc.insertText(newText); }
void CppPlugin::quickFixNow() { if (! m_currentEditor) return; Core::EditorManager *em = Core::EditorManager::instance(); CPPEditorWidget *currentEditor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget()); if (CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(m_currentEditor->widget())) { if (currentEditor == editor) { if (editor->isOutdated()) m_quickFixTimer->start(QUICKFIX_INTERVAL); else TextEditor::CompletionSupport::instance()-> complete(m_currentEditor, TextEditor::QuickFixCompletion, true); } } }
void CoolScroll::Internal::CoolScrollPlugin::onSettingChanged() { saveSettings(); Core::EditorManager* em = Core::EditorManager::instance(); QList<Core::IEditor*> editors = em->visibleEditors(); QList<Core::IEditor*>::iterator it = editors.begin(); // editors will update settings after next opening for( ; it != editors.end(); ++it) { CoolScrollBar* bar = getEditorScrollBar(*it); Q_ASSERT(bar); bar->markStateDirty(); } // update current editor right now CoolScrollBar* bar = getEditorScrollBar(em->currentEditor()); Q_ASSERT(bar); bar->fullUpdateSettings(); }
void QmlJSEditorPlugin::renameUsages() { Core::EditorManager *em = Core::EditorManager::instance(); if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget())) editor->renameUsages(); }