Пример #1
0
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
{
    CPPEditorWidget *editor = new CPPEditorWidget(parent);
    editor->setRevisionsVisible(true);
    m_owner->initializeEditor(editor);
    return editor->editor();
}
Пример #2
0
void CppHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
{
    CPPEditorWidget *cppEditor = qobject_cast<CPPEditorWidget *>(editor->widget());
    if (!cppEditor)
        return;

    if (!cppEditor->extraSelectionTooltip(pos).isEmpty()) {
        setToolTip(cppEditor->extraSelectionTooltip(pos));
    } else {
        QTextCursor tc(cppEditor->document());
        tc.setPosition(pos);

        CppElementEvaluator evaluator(cppEditor);
        evaluator.setTextCursor(tc);
        evaluator.execute();
        if (evaluator.hasDiagnosis()) {
            setToolTip(evaluator.diagnosis());
            setIsDiagnosticTooltip(true);
        }
        if (evaluator.identifiedCppElement()) {
            const QSharedPointer<CppElement> &cppElement = evaluator.cppElement();
            if (!isDiagnosticTooltip())
                setToolTip(cppElement->tooltip());
            foreach (const QString &helpId, cppElement->helpIdCandidates()) {
                if (!Core::HelpManager::instance()->linksForIdentifier(helpId).isEmpty()) {
                    setLastHelpItemIdentified(TextEditor::HelpItem(helpId,
                                                                   cppElement->helpMark(),
                                                                   cppElement->helpCategory()));
                    break;
                }
            }
        }
    }
}
Пример #3
0
void CppPlugin::findUsages()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->findUsages();
}
Пример #4
0
void CppPlugin::renameSymbolUnderCursor()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->renameSymbolUnderCursor();
}
Пример #5
0
void CppPlugin::jumpToDefinition()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->jumpToDefinition();
}
Пример #6
0
    virtual void perform()
    {
        CPPEditorWidget *editor = assistInterface()->editor();
        QSharedPointer<FunctionDeclDefLink> link = editor->declDefLink();
        if (link != m_link)
            return;

        return editor->applyDeclDefLinkChanges(/*don't jump*/false);
    }
Пример #7
0
void CppPlugin::findUsages()
{
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
    if (editor)
        editor->findUsages();
}
Пример #8
0
void CppPlugin::renameSymbolUnderCursor()
{
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
    if (editor)
        editor->renameSymbolUnderCursor();
}
Пример #9
0
void CppPlugin::switchDeclarationDefinition()
{
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
    if (editor)
        editor->switchDeclarationDefinition();
}