예제 #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());

}
예제 #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();
}
예제 #4
0
void QmlJSEditorPlugin::followSymbolUnderCursor()
{
    Core::EditorManager *em = Core::EditorManager::instance();

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