Ejemplo n.º 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());

}
Ejemplo n.º 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();
}
Ejemplo n.º 4
0
void QmlJSEditorPlugin::followSymbolUnderCursor()
{
    Core::EditorManager *em = Core::EditorManager::instance();

    if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget()))
        editor->followSymbolUnderCursor();
}
Ejemplo n.º 5
0
void CppPlugin::findUsages()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->findUsages();
}
Ejemplo n.º 6
0
void CppPlugin::renameSymbolUnderCursor()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->renameSymbolUnderCursor();
}
Ejemplo n.º 7
0
void CppPlugin::jumpToDefinition()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->jumpToDefinition();
}
Ejemplo n.º 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);
}
Ejemplo n.º 9
0
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();
    }
}
Ejemplo n.º 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);
    }
Ejemplo n.º 11
0
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();
}
Ejemplo n.º 13
0
void QmlJSEditorPlugin::renameUsages()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget()))
        editor->renameUsages();
}