forked from qt-creator/qt-creator
CppEditor: Remove class CppEditor
It's not needed, and conflicts with the namespace of the same name in some contexts. Change-Id: I281025abbfad0feb602f006e3b997a8b9c308b48 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -41,7 +41,6 @@ add_qtc_plugin(CppEditor
|
|||||||
cppcursorinfo.h
|
cppcursorinfo.h
|
||||||
cppdocumentationcommenthelper.cpp cppdocumentationcommenthelper.h
|
cppdocumentationcommenthelper.cpp cppdocumentationcommenthelper.h
|
||||||
cppdoxygen.cpp cppdoxygen.h
|
cppdoxygen.cpp cppdoxygen.h
|
||||||
cppeditor.cpp cppeditor.h
|
|
||||||
cppeditor.qrc
|
cppeditor.qrc
|
||||||
cppeditor_global.h
|
cppeditor_global.h
|
||||||
cppeditor_utils.h
|
cppeditor_utils.h
|
||||||
@@ -135,7 +134,6 @@ add_qtc_plugin(CppEditor
|
|||||||
usages.h
|
usages.h
|
||||||
wrappablelineedit.cpp wrappablelineedit.h
|
wrappablelineedit.cpp wrappablelineedit.h
|
||||||
EXPLICIT_MOC
|
EXPLICIT_MOC
|
||||||
cppeditor.h
|
|
||||||
cppquickfixsettingswidget.h
|
cppquickfixsettingswidget.h
|
||||||
cppquickfixprojectsettingswidget.h
|
cppquickfixprojectsettingswidget.h
|
||||||
)
|
)
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <texteditor/icodestylepreferences.h>
|
#include <texteditor/icodestylepreferences.h>
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <utils/executeondestruction.h>
|
#include <utils/executeondestruction.h>
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ static QTextCursor openEditor(const QString &text)
|
|||||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||||
Constants::CPPEDITOR_ID, &name, text.toLocal8Bit());
|
Constants::CPPEDITOR_ID, &name, text.toLocal8Bit());
|
||||||
|
|
||||||
Internal::CppEditor *cppEditor = qobject_cast<Internal::CppEditor *>(editor);
|
const auto cppEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
|
||||||
if (cppEditor == 0)
|
if (cppEditor == 0)
|
||||||
return tc;
|
return tc;
|
||||||
tc = cppEditor->editorWidget()->textCursor();
|
tc = cppEditor->editorWidget()->textCursor();
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "cppdoxygen_test.h"
|
#include "cppdoxygen_test.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cpptoolssettings.h"
|
#include "cpptoolssettings.h"
|
||||||
|
@@ -1,51 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppautocompleter.h"
|
|
||||||
#include "cpphighlighter.h"
|
|
||||||
#include "cppqtstyleindenter.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <texteditor/textdocument.h>
|
|
||||||
|
|
||||||
namespace CppEditor {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
CppEditor::CppEditor()
|
|
||||||
{
|
|
||||||
addContext(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CppEditor::decorateEditor(TextEditor::TextEditorWidget *editor)
|
|
||||||
{
|
|
||||||
editor->textDocument()->setSyntaxHighlighter(new CppHighlighter);
|
|
||||||
editor->textDocument()->setIndenter(
|
|
||||||
new CppQtStyleIndenter(editor->textDocument()->document()));
|
|
||||||
editor->setAutoCompleter(new CppAutoCompleter);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace CppEditor
|
|
@@ -1,44 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
|
||||||
|
|
||||||
namespace CppEditor {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CppEditor : public TextEditor::BaseTextEditor
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CppEditor();
|
|
||||||
|
|
||||||
static void decorateEditor(TextEditor::TextEditorWidget *editor);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace CppEditor
|
|
@@ -38,7 +38,6 @@ HEADERS += \
|
|||||||
cppcursorinfo.h \
|
cppcursorinfo.h \
|
||||||
cppdocumentationcommenthelper.h \
|
cppdocumentationcommenthelper.h \
|
||||||
cppdoxygen.h \
|
cppdoxygen.h \
|
||||||
cppeditor.h \
|
|
||||||
cppeditor_global.h \
|
cppeditor_global.h \
|
||||||
cppeditor_utils.h \
|
cppeditor_utils.h \
|
||||||
cppeditorconstants.h \
|
cppeditorconstants.h \
|
||||||
@@ -163,7 +162,6 @@ SOURCES += \
|
|||||||
cppcurrentdocumentfilter.cpp \
|
cppcurrentdocumentfilter.cpp \
|
||||||
cppdocumentationcommenthelper.cpp \
|
cppdocumentationcommenthelper.cpp \
|
||||||
cppdoxygen.cpp \
|
cppdoxygen.cpp \
|
||||||
cppeditor.cpp \
|
|
||||||
cppeditordocument.cpp \
|
cppeditordocument.cpp \
|
||||||
cppeditoroutline.cpp \
|
cppeditoroutline.cpp \
|
||||||
cppeditorplugin.cpp \
|
cppeditorplugin.cpp \
|
||||||
|
@@ -101,8 +101,6 @@ QtcPlugin {
|
|||||||
"cppdoxygen.cpp",
|
"cppdoxygen.cpp",
|
||||||
"cppdoxygen.h",
|
"cppdoxygen.h",
|
||||||
"cppdoxygen.kwgen",
|
"cppdoxygen.kwgen",
|
||||||
"cppeditor.cpp",
|
|
||||||
"cppeditor.h",
|
|
||||||
"cppeditorwidget.cpp",
|
"cppeditorwidget.cpp",
|
||||||
"cppeditorwidget.h",
|
"cppeditorwidget.h",
|
||||||
"cppeditor.qrc",
|
"cppeditor.qrc",
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
#include "cppcodemodelsettings.h"
|
#include "cppcodemodelsettings.h"
|
||||||
#include "cppcodemodelsettingspage.h"
|
#include "cppcodemodelsettingspage.h"
|
||||||
#include "cppcodestylesettingspage.h"
|
#include "cppcodestylesettingspage.h"
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
#include "cppeditordocument.h"
|
#include "cppeditordocument.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
@@ -97,11 +96,13 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectpanelfactory.h>
|
#include <projectexplorer/projectpanelfactory.h>
|
||||||
#include <projectexplorer/projecttree.h>
|
#include <projectexplorer/projecttree.h>
|
||||||
|
|
||||||
#include <texteditor/colorpreviewhoverhandler.h>
|
#include <texteditor/colorpreviewhoverhandler.h>
|
||||||
#include <texteditor/snippets/snippetprovider.h>
|
#include <texteditor/snippets/snippetprovider.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
#include <texteditor/texteditoractionhandler.h>
|
#include <texteditor/texteditoractionhandler.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
@@ -158,7 +159,11 @@ public:
|
|||||||
|
|
||||||
setDocumentCreator([]() { return new CppEditorDocument; });
|
setDocumentCreator([]() { return new CppEditorDocument; });
|
||||||
setEditorWidgetCreator([]() { return new CppEditorWidget; });
|
setEditorWidgetCreator([]() { return new CppEditorWidget; });
|
||||||
setEditorCreator([]() { return new CppEditor; });
|
setEditorCreator([]() {
|
||||||
|
const auto editor = new BaseTextEditor;
|
||||||
|
editor->addContext(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||||
|
return editor;
|
||||||
|
});
|
||||||
setAutoCompleterCreator([]() { return new CppAutoCompleter; });
|
setAutoCompleterCreator([]() { return new CppAutoCompleter; });
|
||||||
setCommentDefinition(CommentDefinition::CppStyle);
|
setCommentDefinition(CommentDefinition::CppStyle);
|
||||||
setCodeFoldingSupported(true);
|
setCodeFoldingSupported(true);
|
||||||
@@ -313,7 +318,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
|||||||
ProjectPanelFactory::registerFactory(quickFixSettingsPanelFactory);
|
ProjectPanelFactory::registerFactory(quickFixSettingsPanelFactory);
|
||||||
|
|
||||||
SnippetProvider::registerGroup(Constants::CPP_SNIPPETS_GROUP_ID, tr("C++", "SnippetProvider"),
|
SnippetProvider::registerGroup(Constants::CPP_SNIPPETS_GROUP_ID, tr("C++", "SnippetProvider"),
|
||||||
&CppEditor::decorateEditor);
|
&decorateCppEditor);
|
||||||
|
|
||||||
createCppQuickFixes();
|
createCppQuickFixes();
|
||||||
|
|
||||||
@@ -621,7 +626,7 @@ CppFileSettings *CppEditorPlugin::fileSettings()
|
|||||||
|
|
||||||
void CppEditorPlugin::switchHeaderSource()
|
void CppEditorPlugin::switchHeaderSource()
|
||||||
{
|
{
|
||||||
::CppEditor::switchHeaderSource();
|
CppEditor::switchHeaderSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppEditorPlugin::switchHeaderSourceInNextSplit()
|
void CppEditorPlugin::switchHeaderSourceInNextSplit()
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
|
|
||||||
#include "cppcodemodelsettings.h"
|
#include "cppcodemodelsettings.h"
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppeditordocument.h"
|
#include "cppeditordocument.h"
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
@@ -36,6 +35,7 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <texteditor/storagesettings.h>
|
#include <texteditor/storagesettings.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ namespace Tests {
|
|||||||
|
|
||||||
GenericCppTestDocument::GenericCppTestDocument(const QByteArray &fileName, const QByteArray &source,
|
GenericCppTestDocument::GenericCppTestDocument(const QByteArray &fileName, const QByteArray &source,
|
||||||
char cursorMarker)
|
char cursorMarker)
|
||||||
: ::CppEditor::Tests::BaseCppTestDocument(fileName, source, cursorMarker)
|
: CppEditor::Tests::BaseCppTestDocument(fileName, source, cursorMarker)
|
||||||
, m_cursorPosition(-1)
|
, m_cursorPosition(-1)
|
||||||
, m_anchorPosition(-1)
|
, m_anchorPosition(-1)
|
||||||
, m_selectionStartMarker(QLatin1Char(m_cursorMarker) + QLatin1String("{start}"))
|
, m_selectionStartMarker(QLatin1Char(m_cursorMarker) + QLatin1String("{start}"))
|
||||||
@@ -78,13 +78,14 @@ bool GenericCppTestDocument::hasCursorMarker() const { return m_cursorPosition !
|
|||||||
|
|
||||||
bool GenericCppTestDocument::hasAnchorMarker() const { return m_anchorPosition != -1; }
|
bool GenericCppTestDocument::hasAnchorMarker() const { return m_anchorPosition != -1; }
|
||||||
|
|
||||||
TestCase::TestCase(bool runGarbageCollector) : ::CppEditor::Tests::TestCase(runGarbageCollector)
|
TestCase::TestCase(bool runGarbageCollector) : CppEditor::Tests::TestCase(runGarbageCollector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestCase::openCppEditor(const QString &fileName, CppEditor **editor, CppEditorWidget **editorWidget)
|
bool TestCase::openCppEditor(const QString &fileName, TextEditor::BaseTextEditor **editor,
|
||||||
|
CppEditorWidget **editorWidget)
|
||||||
{
|
{
|
||||||
if (CppEditor *e = dynamic_cast<CppEditor *>(Core::EditorManager::openEditor(fileName))) {
|
if (const auto e = dynamic_cast<TextEditor::BaseTextEditor *>(Core::EditorManager::openEditor(fileName))) {
|
||||||
if (editor) {
|
if (editor) {
|
||||||
*editor = e;
|
*editor = e;
|
||||||
TextEditor::StorageSettings s = e->textDocument()->storageSettings();
|
TextEditor::StorageSettings s = e->textDocument()->storageSettings();
|
||||||
|
@@ -29,15 +29,15 @@
|
|||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
namespace TextEditor { class BaseTextEditor; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppEditor;
|
|
||||||
class CppEditorWidget;
|
class CppEditorWidget;
|
||||||
|
|
||||||
namespace Tests {
|
namespace Tests {
|
||||||
|
|
||||||
class GenericCppTestDocument : public ::CppEditor::Tests::BaseCppTestDocument
|
class GenericCppTestDocument : public CppEditor::Tests::BaseCppTestDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericCppTestDocument(const QByteArray &fileName, const QByteArray &source,
|
GenericCppTestDocument(const QByteArray &fileName, const QByteArray &source,
|
||||||
@@ -51,19 +51,19 @@ public:
|
|||||||
int m_anchorPosition;
|
int m_anchorPosition;
|
||||||
QString m_selectionStartMarker;
|
QString m_selectionStartMarker;
|
||||||
QString m_selectionEndMarker;
|
QString m_selectionEndMarker;
|
||||||
CppEditor *m_editor;
|
TextEditor::BaseTextEditor *m_editor;
|
||||||
CppEditorWidget *m_editorWidget;
|
CppEditorWidget *m_editorWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
using TestDocuments = QVector<GenericCppTestDocument>;
|
using TestDocuments = QVector<GenericCppTestDocument>;
|
||||||
|
|
||||||
class TestCase : public ::CppEditor::Tests::TestCase
|
class TestCase : public CppEditor::Tests::TestCase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TestCase(bool runGarbageCollector = true);
|
TestCase(bool runGarbageCollector = true);
|
||||||
|
|
||||||
static bool openCppEditor(const QString &fileName,
|
static bool openCppEditor(const QString &fileName,
|
||||||
CppEditor **editor,
|
TextEditor::BaseTextEditor **editor,
|
||||||
CppEditorWidget **editorWidget = 0);
|
CppEditorWidget **editorWidget = 0);
|
||||||
|
|
||||||
static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument(
|
static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument(
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "cppincludehierarchy.h"
|
#include "cppincludehierarchy.h"
|
||||||
|
|
||||||
#include "baseeditordocumentprocessor.h"
|
#include "baseeditordocumentprocessor.h"
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "editordocumenthandle.h"
|
#include "editordocumenthandle.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
@@ -42,6 +41,8 @@
|
|||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
|
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <utils/delegates.h>
|
#include <utils/delegates.h>
|
||||||
#include <utils/dropsupport.h>
|
#include <utils/dropsupport.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
@@ -428,7 +429,7 @@ void CppIncludeHierarchyWidget::perform()
|
|||||||
{
|
{
|
||||||
showNoIncludeHierarchyLabel();
|
showNoIncludeHierarchyLabel();
|
||||||
|
|
||||||
m_editor = qobject_cast<CppEditor *>(EditorManager::currentEditor());
|
m_editor = qobject_cast<BaseTextEditor *>(EditorManager::currentEditor());
|
||||||
if (!m_editor)
|
if (!m_editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -493,7 +494,7 @@ void CppIncludeHierarchyWidget::syncFromEditorManager()
|
|||||||
if (!m_toggleSync->isChecked())
|
if (!m_toggleSync->isChecked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto editor = qobject_cast<CppEditor *>(EditorManager::currentEditor());
|
const auto editor = qobject_cast<BaseTextEditor *>(EditorManager::currentEditor());
|
||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -25,13 +25,13 @@
|
|||||||
|
|
||||||
#include "cppincludehierarchy_test.h"
|
#include "cppincludehierarchy_test.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
#include "cppincludehierarchy.h"
|
#include "cppincludehierarchy.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
// Open Editor
|
// Open Editor
|
||||||
const QString fileName = temporaryDir.path() + QLatin1String("/file1.h");
|
const QString fileName = temporaryDir.path() + QLatin1String("/file1.h");
|
||||||
CppEditor *editor;
|
TextEditor::BaseTextEditor *editor;
|
||||||
QVERIFY(openCppEditor(fileName, &editor));
|
QVERIFY(openCppEditor(fileName, &editor));
|
||||||
closeEditorAtEndOfTestCase(editor);
|
closeEditorAtEndOfTestCase(editor);
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ QTC_DECLARE_MYTESTDATADIR("../../../tests/cpplocators/")
|
|||||||
|
|
||||||
class CppLocatorFilterTestCase
|
class CppLocatorFilterTestCase
|
||||||
: public BasicLocatorFilterTest
|
: public BasicLocatorFilterTest
|
||||||
, public ::CppEditor::Tests::TestCase
|
, public CppEditor::Tests::TestCase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CppLocatorFilterTestCase(ILocatorFilter *filter,
|
CppLocatorFilterTestCase(ILocatorFilter *filter,
|
||||||
|
@@ -25,16 +25,14 @@
|
|||||||
|
|
||||||
#include "cppoutline.h"
|
#include "cppoutline.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditoroutline.h"
|
#include "cppeditoroutline.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "cppoverviewmodel.h"
|
#include "cppoverviewmodel.h"
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
|
||||||
|
|
||||||
#include <coreplugin/find/itemviewfind.h>
|
#include <coreplugin/find/itemviewfind.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <texteditor/textdocument.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
#include <utils/linecolumn.h>
|
#include <utils/linecolumn.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -212,21 +210,20 @@ bool CppOutlineWidget::syncCursor()
|
|||||||
|
|
||||||
bool CppOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const
|
bool CppOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const
|
||||||
{
|
{
|
||||||
const auto cppEditor = qobject_cast<CppEditor*>(editor);
|
const auto cppEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor);
|
||||||
if (!cppEditor)
|
if (!cppEditor || !CppModelManager::isCppEditor(cppEditor))
|
||||||
return false;
|
return false;
|
||||||
return CppModelManager::supportsOutline(cppEditor->textDocument());
|
return CppModelManager::supportsOutline(cppEditor->textDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor *editor)
|
TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
auto *cppEditor = qobject_cast<CppEditor*>(editor);
|
const auto cppEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor);
|
||||||
auto *cppEditorWidget = qobject_cast<CppEditorWidget*>(cppEditor->widget());
|
QTC_ASSERT(cppEditor, return nullptr);
|
||||||
|
const auto cppEditorWidget = qobject_cast<CppEditorWidget*>(cppEditor->widget());
|
||||||
QTC_ASSERT(cppEditorWidget, return nullptr);
|
QTC_ASSERT(cppEditorWidget, return nullptr);
|
||||||
|
|
||||||
auto *widget = new CppOutlineWidget(cppEditorWidget);
|
return new CppOutlineWidget(cppEditorWidget);
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -26,9 +26,9 @@
|
|||||||
#include "cpppreprocessordialog.h"
|
#include "cpppreprocessordialog.h"
|
||||||
#include "ui_cpppreprocessordialog.h"
|
#include "ui_cpppreprocessordialog.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
|
#include "cpptoolsreuse.h"
|
||||||
|
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(const QString &filePath, QWidget *p
|
|||||||
m_ui->editorLabel->setText(m_ui->editorLabel->text().arg(Utils::FilePath::fromString(m_filePath).fileName()));
|
m_ui->editorLabel->setText(m_ui->editorLabel->text().arg(Utils::FilePath::fromString(m_filePath).fileName()));
|
||||||
m_ui->editWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
m_ui->editWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
|
||||||
CppEditor::decorateEditor(m_ui->editWidget);
|
decorateCppEditor(m_ui->editWidget);
|
||||||
|
|
||||||
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath;
|
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath;
|
||||||
const QString directives = ProjectExplorer::SessionManager::value(key).toString();
|
const QString directives = ProjectExplorer::SessionManager::value(key).toString();
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "cppquickfix_test.h"
|
#include "cppquickfix_test.h"
|
||||||
|
|
||||||
#include "cppcodestylepreferences.h"
|
#include "cppcodestylepreferences.h"
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
|
@@ -85,7 +85,7 @@ protected:
|
|||||||
QList<QuickFixTestDocument::Ptr> m_testDocuments;
|
QList<QuickFixTestDocument::Ptr> m_testDocuments;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<::CppEditor::Tests::TemporaryDir> m_temporaryDirectory;
|
QScopedPointer<CppEditor::Tests::TemporaryDir> m_temporaryDirectory;
|
||||||
|
|
||||||
CppCodeStylePreferences *m_cppCodeStylePreferences;
|
CppCodeStylePreferences *m_cppCodeStylePreferences;
|
||||||
QByteArray m_cppCodeStylePreferencesOriginalDelegateId;
|
QByteArray m_cppCodeStylePreferencesOriginalDelegateId;
|
||||||
|
@@ -25,9 +25,12 @@
|
|||||||
|
|
||||||
#include "cpptoolsreuse.h"
|
#include "cpptoolsreuse.h"
|
||||||
|
|
||||||
|
#include "cppautocompleter.h"
|
||||||
#include "cppcodemodelsettings.h"
|
#include "cppcodemodelsettings.h"
|
||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
|
#include "cpphighlighter.h"
|
||||||
|
#include "cppqtstyleindenter.h"
|
||||||
#include "cpprefactoringchanges.h"
|
#include "cpprefactoringchanges.h"
|
||||||
#include "projectinfo.h"
|
#include "projectinfo.h"
|
||||||
|
|
||||||
@@ -36,6 +39,7 @@
|
|||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
#include <texteditor/textdocument.h>
|
||||||
|
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
@@ -584,4 +588,15 @@ ProjectExplorer::Project *projectForProjectInfo(const ProjectInfo &info)
|
|||||||
return ProjectExplorer::SessionManager::projectWithProjectFilePath(info.projectFilePath());
|
return ProjectExplorer::SessionManager::projectWithProjectFilePath(info.projectFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
void decorateCppEditor(TextEditor::TextEditorWidget *editor)
|
||||||
|
{
|
||||||
|
editor->textDocument()->setSyntaxHighlighter(new CppHighlighter);
|
||||||
|
editor->textDocument()->setIndenter(
|
||||||
|
new CppQtStyleIndenter(editor->textDocument()->document()));
|
||||||
|
editor->setAutoCompleter(new CppAutoCompleter);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
} // CppEditor
|
} // CppEditor
|
||||||
|
@@ -154,4 +154,8 @@ private:
|
|||||||
bool m_done = false;
|
bool m_done = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
void decorateCppEditor(TextEditor::TextEditorWidget *editor);
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
} // CppEditor
|
} // CppEditor
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "cpptypehierarchy.h"
|
#include "cpptypehierarchy.h"
|
||||||
|
|
||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
#include "cppelementevaluator.h"
|
#include "cppelementevaluator.h"
|
||||||
@@ -34,6 +33,7 @@
|
|||||||
#include <coreplugin/find/itemviewfind.h>
|
#include <coreplugin/find/itemviewfind.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/delegates.h>
|
#include <utils/delegates.h>
|
||||||
#include <utils/dropsupport.h>
|
#include <utils/dropsupport.h>
|
||||||
@@ -188,7 +188,7 @@ void CppTypeHierarchyWidget::perform()
|
|||||||
|
|
||||||
m_showOldClass = false;
|
m_showOldClass = false;
|
||||||
|
|
||||||
auto editor = qobject_cast<CppEditor *>(Core::EditorManager::currentEditor());
|
auto editor = qobject_cast<TextEditor::BaseTextEditor *>(Core::EditorManager::currentEditor());
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
showNoTypeHierarchyLabel();
|
showNoTypeHierarchyLabel();
|
||||||
return;
|
return;
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "cppuseselections_test.h"
|
#include "cppuseselections_test.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
@@ -89,7 +88,7 @@ UseSelectionsTestCase::UseSelectionsTestCase(GenericCppTestDocument &testFile,
|
|||||||
QVERIFY(testFile.hasCursorMarker());
|
QVERIFY(testFile.hasCursorMarker());
|
||||||
testFile.m_source.remove(testFile.m_cursorPosition, 1);
|
testFile.m_source.remove(testFile.m_cursorPosition, 1);
|
||||||
|
|
||||||
::CppEditor::Tests::TemporaryDir temporaryDir;
|
CppEditor::Tests::TemporaryDir temporaryDir;
|
||||||
QVERIFY(temporaryDir.isValid());
|
QVERIFY(temporaryDir.isValid());
|
||||||
testFile.setBaseDirectory(temporaryDir.path());
|
testFile.setBaseDirectory(temporaryDir.path());
|
||||||
testFile.writeToDisk();
|
testFile.writeToDisk();
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "fileandtokenactions_test.h"
|
#include "fileandtokenactions_test.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
@@ -42,6 +41,7 @@
|
|||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <cplusplus/TranslationUnit.h>
|
#include <cplusplus/TranslationUnit.h>
|
||||||
@@ -111,7 +111,7 @@ private:
|
|||||||
/// Move word camel case wise from current cursor position until given token (not included)
|
/// Move word camel case wise from current cursor position until given token (not included)
|
||||||
/// and execute the tokenActions for each new position.
|
/// and execute the tokenActions for each new position.
|
||||||
static void moveWordCamelCaseToToken(TranslationUnit *translationUnit, const Token &token,
|
static void moveWordCamelCaseToToken(TranslationUnit *translationUnit, const Token &token,
|
||||||
CppEditor *editor, const Actions &tokenActions);
|
BaseTextEditor *editor, const Actions &tokenActions);
|
||||||
|
|
||||||
static void undoAllChangesAndCloseAllEditors();
|
static void undoAllChangesAndCloseAllEditors();
|
||||||
};
|
};
|
||||||
@@ -176,7 +176,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
|
|||||||
|
|
||||||
// Open editor
|
// Open editor
|
||||||
QCOMPARE(DocumentModel::openedDocuments().size(), 0);
|
QCOMPARE(DocumentModel::openedDocuments().size(), 0);
|
||||||
CppEditor *editor;
|
BaseTextEditor *editor;
|
||||||
CppEditorWidget *editorWidget;
|
CppEditorWidget *editorWidget;
|
||||||
QVERIFY(openCppEditor(filePath, &editor, &editorWidget));
|
QVERIFY(openCppEditor(filePath, &editor, &editorWidget));
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ void TestActionsTestCase::executeActionsOnEditorWidget(CppEditorWidget *editorWi
|
|||||||
|
|
||||||
void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationUnit,
|
void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationUnit,
|
||||||
const Token &token,
|
const Token &token,
|
||||||
CppEditor *editor,
|
BaseTextEditor *editor,
|
||||||
const Actions &tokenActions)
|
const Actions &tokenActions)
|
||||||
{
|
{
|
||||||
QVERIFY(translationUnit);
|
QVERIFY(translationUnit);
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "followsymbol_switchmethoddecldef_test.h"
|
#include "followsymbol_switchmethoddecldef_test.h"
|
||||||
|
|
||||||
#include "cppcodemodelsettings.h"
|
#include "cppcodemodelsettings.h"
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
#include "cppeditortestcase.h"
|
#include "cppeditortestcase.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
#include <texteditor/codeassist/genericproposalmodel.h>
|
#include <texteditor/codeassist/genericproposalmodel.h>
|
||||||
#include <texteditor/codeassist/iassistprocessor.h>
|
#include <texteditor/codeassist/iassistprocessor.h>
|
||||||
#include <texteditor/codeassist/iassistproposal.h>
|
#include <texteditor/codeassist/iassistproposal.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
@@ -317,7 +317,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write files to disk
|
// Write files to disk
|
||||||
::CppEditor::Tests::TemporaryDir temporaryDir;
|
CppEditor::Tests::TemporaryDir temporaryDir;
|
||||||
QVERIFY(temporaryDir.isValid());
|
QVERIFY(temporaryDir.isValid());
|
||||||
QString projectFileContent = "CppApplication { files: [";
|
QString projectFileContent = "CppApplication { files: [";
|
||||||
foreach (TestDocumentPtr testFile, testFiles) {
|
foreach (TestDocumentPtr testFile, testFiles) {
|
||||||
@@ -349,8 +349,8 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
|||||||
openProjectResult.project()->configureAsExampleProject(m_testKit);
|
openProjectResult.project()->configureAsExampleProject(m_testKit);
|
||||||
|
|
||||||
// Wait until project is fully indexed.
|
// Wait until project is fully indexed.
|
||||||
QVERIFY(::CppEditor::Tests::waitForSignalOrTimeout(openProjectResult.project(),
|
QVERIFY(CppEditor::Tests::waitForSignalOrTimeout(openProjectResult.project(),
|
||||||
&Project::indexingFinished, ::CppEditor::Tests::clangdIndexingTimeout()));
|
&Project::indexingFinished, CppEditor::Tests::clangdIndexingTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Code Model
|
// Update Code Model
|
||||||
@@ -441,7 +441,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
|||||||
QEXPECT_FAIL("infiniteLoopLocalTypedef_QTCREATORBUG-11999",
|
QEXPECT_FAIL("infiniteLoopLocalTypedef_QTCREATORBUG-11999",
|
||||||
"clangd bug: Go to definition does not return", Abort);
|
"clangd bug: Go to definition does not return", Abort);
|
||||||
if (expectedVirtualFunctionProposal.size() <= 1) {
|
if (expectedVirtualFunctionProposal.size() <= 1) {
|
||||||
QVERIFY(::CppEditor::Tests::waitForSignalOrTimeout(EditorManager::instance(),
|
QVERIFY(CppEditor::Tests::waitForSignalOrTimeout(EditorManager::instance(),
|
||||||
&EditorManager::linkOpened, 10000));
|
&EditorManager::linkOpened, 10000));
|
||||||
} else {
|
} else {
|
||||||
QTimer t;
|
QTimer t;
|
||||||
|
Reference in New Issue
Block a user