Example #1
0
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());

}
Example #3
0
void
Mode::grabEditorManager( Core::IMode * mode )
{
    if ( mode != this )
        return;
    Core::EditorManager * em = Core::EditorManager::instance();
    if ( em && em->currentEditor() )
        em->currentEditor()->widget()->setFocus();
}
Example #4
0
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();
}
Example #8
0
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();
    }
}
Example #10
0
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();
}
Example #13
0
void QmlJSEditorPlugin::renameUsages()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget()))
        editor->renameUsages();
}