forked from qt-creator/qt-creator
CppEditor: Rename CPPEditor{,Document} to CppEditor{,Document}
Better in line with the rest. Change-Id: I692c8b6b9bebf22f059709fb60e53ea04fcb7d53 Reviewed-by: Christian Stenger <christian.stenger@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1373,8 +1373,7 @@ void CppCodeModelInspectorDialog::refresh()
|
||||
dumper.dumpSnapshot(editorSnapshot, editorSnapshotTitle);
|
||||
m_ui->snapshotSelector->addItem(editorSnapshotTitle);
|
||||
}
|
||||
CppEditor::Internal::CppEditorWidget *cppEditorWidget
|
||||
= qobject_cast<CppEditor::Internal::CppEditorWidget *>(editor->editorWidget());
|
||||
CppEditorWidget *cppEditorWidget = qobject_cast<CppEditorWidget *>(editor->editorWidget());
|
||||
if (cppEditorWidget) {
|
||||
SemanticInfo semanticInfo = cppEditorWidget->semanticInfo();
|
||||
CPlusPlus::Snapshot snapshot;
|
||||
|
||||
@@ -90,15 +90,15 @@ using namespace CppEditor::Internal;
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
CPPEditor::CPPEditor()
|
||||
CppEditor::CppEditor()
|
||||
{
|
||||
m_context.add(CppEditor::Constants::C_CPPEDITOR);
|
||||
m_context.add(Constants::C_CPPEDITOR);
|
||||
m_context.add(ProjectExplorer::Constants::LANG_CXX);
|
||||
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
|
||||
setDuplicateSupported(true);
|
||||
setCommentStyle(Utils::CommentDefinition::CppStyle);
|
||||
setCompletionAssistProvider([this] () -> TextEditor::CompletionAssistProvider * {
|
||||
if (CPPEditorDocument *document = qobject_cast<CPPEditorDocument *>(textDocument()))
|
||||
if (CppEditorDocument *document = qobject_cast<CppEditorDocument *>(textDocument()))
|
||||
return document->completionAssistProvider();
|
||||
return 0;
|
||||
});
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
public:
|
||||
QPointer<CppTools::CppModelManagerInterface> m_modelManager;
|
||||
|
||||
CPPEditorDocument *m_cppEditorDocument;
|
||||
CppEditorDocument *m_cppEditorDocument;
|
||||
CppEditorOutline *m_cppEditorOutline;
|
||||
|
||||
CppDocumentationCommentHelper m_cppDocumentationCommentHelper;
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
|
||||
CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
|
||||
: m_modelManager(CppModelManagerInterface::instance())
|
||||
, m_cppEditorDocument(qobject_cast<CPPEditorDocument *>(q->textDocument()))
|
||||
, m_cppEditorDocument(qobject_cast<CppEditorDocument *>(q->textDocument()))
|
||||
, m_cppEditorOutline(new CppEditorOutline(q))
|
||||
, m_cppDocumentationCommentHelper(q)
|
||||
, m_localRenaming(q)
|
||||
@@ -148,7 +148,7 @@ CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
|
||||
{
|
||||
}
|
||||
|
||||
CppEditorWidget::CppEditorWidget(TextEditor::BaseTextDocumentPtr doc, CPPEditor *editor)
|
||||
CppEditorWidget::CppEditorWidget(TextEditor::BaseTextDocumentPtr doc, CppEditor *editor)
|
||||
{
|
||||
qRegisterMetaType<SemanticInfo>("CppTools::SemanticInfo");
|
||||
|
||||
@@ -163,9 +163,9 @@ CppEditorWidget::CppEditorWidget(TextEditor::BaseTextDocumentPtr doc, CPPEditor
|
||||
setParenthesesMatchingEnabled(true);
|
||||
setRevisionsVisible(true);
|
||||
|
||||
connect(d->m_cppEditorDocument, &CPPEditorDocument::codeWarningsUpdated,
|
||||
connect(d->m_cppEditorDocument, &CppEditorDocument::codeWarningsUpdated,
|
||||
this, &CppEditorWidget::onCodeWarningsUpdated);
|
||||
connect(d->m_cppEditorDocument, &CPPEditorDocument::ifdefedOutBlocksUpdated,
|
||||
connect(d->m_cppEditorDocument, &CppEditorDocument::ifdefedOutBlocksUpdated,
|
||||
this, &CppEditorWidget::onIfdefedOutBlocksUpdated);
|
||||
connect(d->m_cppEditorDocument, SIGNAL(cppDocumentUpdated(CPlusPlus::Document::Ptr)),
|
||||
this, SLOT(onCppDocumentUpdated()));
|
||||
@@ -229,7 +229,7 @@ CppEditorWidget::~CppEditorWidget()
|
||||
// non-inline destructor, see section "Forward Declared Pointers" of QScopedPointer.
|
||||
}
|
||||
|
||||
CppEditorWidget *CppEditorWidget::duplicate(CPPEditor *editor) const
|
||||
CppEditorWidget *CppEditorWidget::duplicate(CppEditor *editor) const
|
||||
{
|
||||
QTC_ASSERT(editor, return 0);
|
||||
|
||||
@@ -243,7 +243,7 @@ CppEditorWidget *CppEditorWidget::duplicate(CPPEditor *editor) const
|
||||
return widget;
|
||||
}
|
||||
|
||||
CPPEditorDocument *CppEditorWidget::cppEditorDocument() const
|
||||
CppEditorDocument *CppEditorWidget::cppEditorDocument() const
|
||||
{
|
||||
return d->m_cppEditorDocument;
|
||||
}
|
||||
@@ -564,16 +564,16 @@ void CppEditorWidget::keyPressEvent(QKeyEvent *e)
|
||||
TextEditor::BaseTextEditorWidget::keyPressEvent(e);
|
||||
}
|
||||
|
||||
Core::IEditor *CPPEditor::duplicate()
|
||||
Core::IEditor *CppEditor::duplicate()
|
||||
{
|
||||
CPPEditor *editor = new CPPEditor;
|
||||
CppEditor *editor = new CppEditor;
|
||||
CppEditorWidget *widget = qobject_cast<CppEditorWidget *>(editorWidget())->duplicate(editor);
|
||||
CppEditorPlugin::instance()->initializeEditor(widget);
|
||||
editor->configureCodeAssistant();
|
||||
return editor;
|
||||
}
|
||||
|
||||
bool CPPEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
bool CppEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
{
|
||||
if (!TextEditor::BaseTextEditor::open(errorString, fileName, realFileName))
|
||||
return false;
|
||||
|
||||
@@ -44,18 +44,18 @@ namespace CppTools { class SemanticInfo; }
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
class CPPEditorDocument;
|
||||
class CppEditorDocument;
|
||||
class CppEditorOutline;
|
||||
class CppEditorWidgetPrivate;
|
||||
class FollowSymbolUnderCursor;
|
||||
class FunctionDeclDefLink;
|
||||
|
||||
class CPPEditor : public TextEditor::BaseTextEditor
|
||||
class CppEditor : public TextEditor::BaseTextEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CPPEditor();
|
||||
CppEditor();
|
||||
|
||||
Core::IEditor *duplicate() QTC_OVERRIDE;
|
||||
|
||||
@@ -72,12 +72,12 @@ public:
|
||||
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
|
||||
|
||||
public:
|
||||
CppEditorWidget(TextEditor::BaseTextDocumentPtr doc, CPPEditor *editor);
|
||||
CppEditorWidget(TextEditor::BaseTextDocumentPtr doc, CppEditor *editor);
|
||||
~CppEditorWidget();
|
||||
|
||||
CppEditorWidget *duplicate(CPPEditor *editor) const;
|
||||
CppEditorWidget *duplicate(CppEditor *editor) const;
|
||||
|
||||
CPPEditorDocument *cppEditorDocument() const;
|
||||
CppEditorDocument *cppEditorDocument() const;
|
||||
CppEditorOutline *outline() const;
|
||||
|
||||
CppTools::SemanticInfo semanticInfo() const;
|
||||
|
||||
@@ -62,7 +62,7 @@ enum { processDocumentIntervalInMs = 150 };
|
||||
class CppEditorDocumentHandle : public CppTools::EditorDocumentHandle
|
||||
{
|
||||
public:
|
||||
CppEditorDocumentHandle(CppEditor::Internal::CPPEditorDocument *cppEditorDocument)
|
||||
CppEditorDocumentHandle(CppEditor::Internal::CppEditorDocument *cppEditorDocument)
|
||||
: m_cppEditorDocument(cppEditorDocument)
|
||||
, m_registrationFilePath(cppEditorDocument->filePath())
|
||||
{
|
||||
@@ -79,13 +79,13 @@ public:
|
||||
{ return m_cppEditorDocument->processor(); }
|
||||
|
||||
private:
|
||||
CppEditor::Internal::CPPEditorDocument * const m_cppEditorDocument;
|
||||
CppEditor::Internal::CppEditorDocument * const m_cppEditorDocument;
|
||||
// The file path of the editor document can change (e.g. by "Save As..."), so make sure
|
||||
// that un-registration happens with the path the document was registered.
|
||||
const QString m_registrationFilePath;
|
||||
};
|
||||
|
||||
CPPEditorDocument::CPPEditorDocument()
|
||||
CppEditorDocument::CppEditorDocument()
|
||||
: m_fileIsBeingReloaded(false)
|
||||
, m_isObjCEnabled(false)
|
||||
, m_cachedContentsRevision(-1)
|
||||
@@ -111,35 +111,35 @@ CPPEditorDocument::CPPEditorDocument()
|
||||
// See also onFilePathChanged() for more initialization
|
||||
}
|
||||
|
||||
CPPEditorDocument::~CPPEditorDocument()
|
||||
CppEditorDocument::~CppEditorDocument()
|
||||
{
|
||||
}
|
||||
|
||||
bool CPPEditorDocument::isObjCEnabled() const
|
||||
bool CppEditorDocument::isObjCEnabled() const
|
||||
{
|
||||
return m_isObjCEnabled;
|
||||
}
|
||||
|
||||
CppTools::CppCompletionAssistProvider *CPPEditorDocument::completionAssistProvider() const
|
||||
CppTools::CppCompletionAssistProvider *CppEditorDocument::completionAssistProvider() const
|
||||
{
|
||||
return m_completionAssistProvider;
|
||||
}
|
||||
|
||||
void CPPEditorDocument::semanticRehighlight()
|
||||
void CppEditorDocument::semanticRehighlight()
|
||||
{
|
||||
CppTools::BaseEditorDocumentProcessor *p = processor();
|
||||
QTC_ASSERT(p, return);
|
||||
p->semanticRehighlight(true);
|
||||
}
|
||||
|
||||
CppTools::SemanticInfo CPPEditorDocument::recalculateSemanticInfo()
|
||||
CppTools::SemanticInfo CppEditorDocument::recalculateSemanticInfo()
|
||||
{
|
||||
CppTools::BaseEditorDocumentProcessor *p = processor();
|
||||
QTC_ASSERT(p, CppTools::SemanticInfo());
|
||||
return p->recalculateSemanticInfo();
|
||||
}
|
||||
|
||||
QByteArray CPPEditorDocument::contentsText() const
|
||||
QByteArray CppEditorDocument::contentsText() const
|
||||
{
|
||||
QMutexLocker locker(&m_cachedContentsLock);
|
||||
|
||||
@@ -152,7 +152,7 @@ QByteArray CPPEditorDocument::contentsText() const
|
||||
return m_cachedContents;
|
||||
}
|
||||
|
||||
void CPPEditorDocument::applyFontSettings()
|
||||
void CppEditorDocument::applyFontSettings()
|
||||
{
|
||||
if (TextEditor::SyntaxHighlighter *highlighter = syntaxHighlighter()) {
|
||||
// Clear all additional formats since they may have changed
|
||||
@@ -166,13 +166,13 @@ void CPPEditorDocument::applyFontSettings()
|
||||
BaseTextDocument::applyFontSettings(); // rehighlights and updates additional formats
|
||||
}
|
||||
|
||||
void CPPEditorDocument::invalidateFormatterCache()
|
||||
void CppEditorDocument::invalidateFormatterCache()
|
||||
{
|
||||
CppTools::QtStyleCodeFormatter formatter;
|
||||
formatter.invalidateCache(document());
|
||||
}
|
||||
|
||||
void CPPEditorDocument::onMimeTypeChanged()
|
||||
void CppEditorDocument::onMimeTypeChanged()
|
||||
{
|
||||
const QString &mt = mimeType();
|
||||
m_isObjCEnabled = (mt == QLatin1String(CppTools::Constants::OBJECTIVE_C_SOURCE_MIMETYPE)
|
||||
@@ -180,19 +180,19 @@ void CPPEditorDocument::onMimeTypeChanged()
|
||||
m_completionAssistProvider = mm()->completionAssistProvider(mt);
|
||||
}
|
||||
|
||||
void CPPEditorDocument::onAboutToReload()
|
||||
void CppEditorDocument::onAboutToReload()
|
||||
{
|
||||
QTC_CHECK(!m_fileIsBeingReloaded);
|
||||
m_fileIsBeingReloaded = true;
|
||||
}
|
||||
|
||||
void CPPEditorDocument::onReloadFinished()
|
||||
void CppEditorDocument::onReloadFinished()
|
||||
{
|
||||
QTC_CHECK(m_fileIsBeingReloaded);
|
||||
m_fileIsBeingReloaded = false;
|
||||
}
|
||||
|
||||
void CPPEditorDocument::onFilePathChanged(const QString &oldPath, const QString &newPath)
|
||||
void CppEditorDocument::onFilePathChanged(const QString &oldPath, const QString &newPath)
|
||||
{
|
||||
Q_UNUSED(oldPath);
|
||||
|
||||
@@ -211,13 +211,13 @@ void CPPEditorDocument::onFilePathChanged(const QString &oldPath, const QString
|
||||
}
|
||||
}
|
||||
|
||||
void CPPEditorDocument::scheduleProcessDocument()
|
||||
void CppEditorDocument::scheduleProcessDocument()
|
||||
{
|
||||
m_processorRevision = document()->revision();
|
||||
m_processorTimer.start(processDocumentIntervalInMs);
|
||||
}
|
||||
|
||||
void CPPEditorDocument::processDocument()
|
||||
void CppEditorDocument::processDocument()
|
||||
{
|
||||
if (processor()->isParserRunning() || m_processorRevision != contentsRevision()) {
|
||||
m_processorTimer.start();
|
||||
@@ -231,36 +231,36 @@ void CPPEditorDocument::processDocument()
|
||||
processor()->run();
|
||||
}
|
||||
|
||||
void CPPEditorDocument::resetProcessor()
|
||||
void CppEditorDocument::resetProcessor()
|
||||
{
|
||||
releaseResources();
|
||||
processor(); // creates a new processor
|
||||
}
|
||||
|
||||
unsigned CPPEditorDocument::contentsRevision() const
|
||||
unsigned CppEditorDocument::contentsRevision() const
|
||||
{
|
||||
return document()->revision();
|
||||
}
|
||||
|
||||
void CPPEditorDocument::releaseResources()
|
||||
void CppEditorDocument::releaseResources()
|
||||
{
|
||||
if (m_processor)
|
||||
disconnect(m_processor.data(), 0, this, 0);
|
||||
m_processor.reset();
|
||||
}
|
||||
|
||||
CppTools::BaseEditorDocumentProcessor *CPPEditorDocument::processor()
|
||||
CppTools::BaseEditorDocumentProcessor *CppEditorDocument::processor()
|
||||
{
|
||||
if (!m_processor) {
|
||||
m_processor.reset(mm()->editorDocumentProcessor(this));
|
||||
connect(m_processor.data(), &CppTools::BaseEditorDocumentProcessor::codeWarningsUpdated,
|
||||
this, &CPPEditorDocument::codeWarningsUpdated);
|
||||
this, &CppEditorDocument::codeWarningsUpdated);
|
||||
connect(m_processor.data(), &CppTools::BaseEditorDocumentProcessor::ifdefedOutBlocksUpdated,
|
||||
this, &CPPEditorDocument::ifdefedOutBlocksUpdated);
|
||||
this, &CppEditorDocument::ifdefedOutBlocksUpdated);
|
||||
connect(m_processor.data(), &CppTools::BaseEditorDocumentProcessor::cppDocumentUpdated,
|
||||
this, &CPPEditorDocument::cppDocumentUpdated);
|
||||
this, &CppEditorDocument::cppDocumentUpdated);
|
||||
connect(m_processor.data(), &CppTools::BaseEditorDocumentProcessor::semanticInfoUpdated,
|
||||
this, &CPPEditorDocument::semanticInfoUpdated);
|
||||
this, &CppEditorDocument::semanticInfoUpdated);
|
||||
}
|
||||
|
||||
return m_processor.data();
|
||||
|
||||
@@ -44,15 +44,15 @@
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
class CPPEditorDocument : public TextEditor::BaseTextDocument
|
||||
class CppEditorDocument : public TextEditor::BaseTextDocument
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class CppEditorDocumentHandle;
|
||||
|
||||
public:
|
||||
explicit CPPEditorDocument();
|
||||
~CPPEditorDocument();
|
||||
explicit CppEditorDocument();
|
||||
~CppEditorDocument();
|
||||
|
||||
bool isObjCEnabled() const;
|
||||
CppTools::CppCompletionAssistProvider *completionAssistProvider() const;
|
||||
|
||||
@@ -63,8 +63,9 @@
|
||||
#include <QStringList>
|
||||
|
||||
using namespace Core;
|
||||
using namespace CppEditor;
|
||||
using namespace CppEditor::Internal;
|
||||
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
void registerQuickFixes(ExtensionSystem::IPlugin *plugIn);
|
||||
|
||||
@@ -75,30 +76,30 @@ enum { QUICKFIX_INTERVAL = 20 };
|
||||
CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
|
||||
m_owner(owner)
|
||||
{
|
||||
setId(CppEditor::Constants::CPPEDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", CppEditor::Constants::CPPEDITOR_DISPLAY_NAME));
|
||||
addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||
setId(Constants::CPPEDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::CPPEDITOR_DISPLAY_NAME));
|
||||
addMimeType(Constants::C_SOURCE_MIMETYPE);
|
||||
addMimeType(Constants::C_HEADER_MIMETYPE);
|
||||
addMimeType(Constants::CPP_SOURCE_MIMETYPE);
|
||||
addMimeType(Constants::CPP_HEADER_MIMETYPE);
|
||||
|
||||
new TextEditor::TextEditorActionHandler(this, CppEditor::Constants::C_CPPEDITOR,
|
||||
new TextEditor::TextEditorActionHandler(this, Constants::C_CPPEDITOR,
|
||||
TextEditor::TextEditorActionHandler::Format
|
||||
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::UnCollapseAll
|
||||
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||
|
||||
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_cpp.png", CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_c.png", CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_h.png", CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_cpp.png", Constants::CPP_SOURCE_MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_c.png", Constants::C_SOURCE_MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_h.png", Constants::CPP_HEADER_MIMETYPE);
|
||||
}
|
||||
}
|
||||
|
||||
IEditor *CppEditorFactory::createEditor()
|
||||
{
|
||||
CPPEditor *editor = new CPPEditor;
|
||||
CppEditorWidget *widget = new CppEditorWidget(BaseTextDocumentPtr(new CPPEditorDocument), editor);
|
||||
CppEditor *editor = new CppEditor;
|
||||
CppEditorWidget *widget = new CppEditorWidget(BaseTextDocumentPtr(new CppEditorDocument), editor);
|
||||
m_owner->initializeEditor(widget);
|
||||
editor->configureCodeAssistant();
|
||||
return editor;
|
||||
@@ -167,16 +168,16 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setProductType<CppHighlighter>();
|
||||
hf->setId(CppEditor::Constants::CPPEDITOR_ID);
|
||||
hf->addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||
hf->addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE);
|
||||
hf->addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
hf->addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||
hf->setId(Constants::CPPEDITOR_ID);
|
||||
hf->addMimeType(Constants::C_SOURCE_MIMETYPE);
|
||||
hf->addMimeType(Constants::C_HEADER_MIMETYPE);
|
||||
hf->addMimeType(Constants::CPP_SOURCE_MIMETYPE);
|
||||
hf->addMimeType(Constants::CPP_HEADER_MIMETYPE);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
m_quickFixProvider = new CppQuickFixAssistProvider;
|
||||
addAutoReleasedObject(m_quickFixProvider);
|
||||
CppEditor::Internal::registerQuickFixes(this);
|
||||
registerQuickFixes(this);
|
||||
|
||||
QString trCat = QCoreApplication::translate(Constants::WIZARD_CATEGORY, Constants::WIZARD_TR_CATEGORY);
|
||||
|
||||
@@ -208,9 +209,9 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
wizard->setId(QLatin1String("C.Header"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
Context context(CppEditor::Constants::C_CPPEDITOR);
|
||||
Context context(Constants::C_CPPEDITOR);
|
||||
|
||||
ActionContainer *contextMenu = ActionManager::createMenu(CppEditor::Constants::M_CONTEXT);
|
||||
ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT);
|
||||
|
||||
Command *cmd;
|
||||
ActionContainer *cppToolsMenu = ActionManager::actionContainer(CppTools::Constants::M_TOOLS_CPP);
|
||||
@@ -425,3 +426,6 @@ void CppEditorPlugin::openIncludeHierarchy()
|
||||
emit includeHierarchyRequested();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
#include <QDir>
|
||||
|
||||
using namespace CppEditor::Internal;
|
||||
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
namespace Tests {
|
||||
@@ -63,12 +65,9 @@ TestCase::~TestCase()
|
||||
{
|
||||
}
|
||||
|
||||
bool TestCase::openCppEditor(const QString &fileName,
|
||||
Internal::CPPEditor **editor,
|
||||
Internal::CppEditorWidget **editorWidget)
|
||||
bool TestCase::openCppEditor(const QString &fileName, CppEditor **editor, CppEditorWidget **editorWidget)
|
||||
{
|
||||
using namespace CppEditor::Internal;
|
||||
if (CPPEditor *e = dynamic_cast<CPPEditor *>(Core::EditorManager::openEditor(fileName))) {
|
||||
if (CppEditor *e = dynamic_cast<CppEditor *>(Core::EditorManager::openEditor(fileName))) {
|
||||
if (editor)
|
||||
*editor = e;
|
||||
if (editorWidget) {
|
||||
@@ -87,7 +86,7 @@ bool TestCase::openCppEditor(const QString &fileName,
|
||||
}
|
||||
|
||||
CPlusPlus::Document::Ptr TestCase::waitForRehighlightedSemanticDocument(
|
||||
Internal::CppEditorWidget *editorWidget)
|
||||
CppEditorWidget *editorWidget)
|
||||
{
|
||||
const QString filePath = editorWidget->textDocument()->filePath();
|
||||
auto processor = CppTools::BaseEditorDocumentProcessor::get(filePath);
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
#include <cpptools/cpptoolstestcase.h>
|
||||
|
||||
namespace CppEditor {
|
||||
|
||||
namespace Internal {
|
||||
class CPPEditor;
|
||||
|
||||
class CppEditor;
|
||||
class CppEditorWidget;
|
||||
|
||||
namespace Tests {
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
|
||||
public:
|
||||
int m_cursorPosition;
|
||||
Internal::CPPEditor *m_editor;
|
||||
Internal::CppEditorWidget *m_editorWidget;
|
||||
CppEditor *m_editor;
|
||||
CppEditorWidget *m_editorWidget;
|
||||
};
|
||||
|
||||
class TestCase : public CppTools::Tests::TestCase
|
||||
@@ -63,11 +63,11 @@ public:
|
||||
~TestCase();
|
||||
|
||||
static bool openCppEditor(const QString &fileName,
|
||||
Internal::CPPEditor **editor,
|
||||
Internal::CppEditorWidget **editorWidget = 0);
|
||||
CppEditor **editor,
|
||||
CppEditorWidget **editorWidget = 0);
|
||||
|
||||
static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument(
|
||||
Internal::CppEditorWidget *editorWidget);
|
||||
CppEditorWidget *editorWidget);
|
||||
};
|
||||
|
||||
} // namespace Tests
|
||||
|
||||
@@ -43,22 +43,22 @@
|
||||
#include <QSet>
|
||||
#include <QQueue>
|
||||
|
||||
using namespace CppEditor;
|
||||
using namespace CppEditor::Internal;
|
||||
using namespace CPlusPlus;
|
||||
|
||||
namespace {
|
||||
QStringList stripName(const QString &name) {
|
||||
QStringList all;
|
||||
all << name;
|
||||
int colonColon = 0;
|
||||
const int size = name.size();
|
||||
while ((colonColon = name.indexOf(QLatin1String("::"), colonColon)) != -1) {
|
||||
all << name.right(size - colonColon - 2);
|
||||
colonColon += 2;
|
||||
}
|
||||
return all;
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
static QStringList stripName(const QString &name)
|
||||
{
|
||||
QStringList all;
|
||||
all << name;
|
||||
int colonColon = 0;
|
||||
const int size = name.size();
|
||||
while ((colonColon = name.indexOf(QLatin1String("::"), colonColon)) != -1) {
|
||||
all << name.right(size - colonColon - 2);
|
||||
colonColon += 2;
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
CppElementEvaluator::CppElementEvaluator(TextEditor::BaseTextEditorWidget *editor) :
|
||||
@@ -78,7 +78,7 @@ void CppElementEvaluator::setLookupBaseClasses(const bool lookup)
|
||||
void CppElementEvaluator::setLookupDerivedClasses(const bool lookup)
|
||||
{ m_lookupDerivedClasses = lookup; }
|
||||
|
||||
// @todo: Consider refactoring code from CPPEditor::findLinkAt into here.
|
||||
// @todo: Consider refactoring code from CppEditor::findLinkAt into here.
|
||||
void CppElementEvaluator::execute()
|
||||
{
|
||||
clear();
|
||||
@@ -235,7 +235,7 @@ const QString &CppElementEvaluator::diagnosis() const
|
||||
return m_diagnosis;
|
||||
}
|
||||
|
||||
void CppEditor::Internal::CppElementEvaluator::clear()
|
||||
void CppElementEvaluator::clear()
|
||||
{
|
||||
m_element.clear();
|
||||
m_diagnosis.clear();
|
||||
@@ -470,3 +470,6 @@ CppEnumerator::CppEnumerator(CPlusPlus::EnumeratorDeclaration *declaration)
|
||||
if (!enumeratorValue.isEmpty())
|
||||
tooltip.append(QLatin1String(" = ") + enumeratorValue);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -136,7 +136,7 @@ void CppIncludeHierarchyWidget::perform()
|
||||
{
|
||||
showNoIncludeHierarchyLabel();
|
||||
|
||||
m_editor = qobject_cast<CPPEditor *>(Core::EditorManager::currentEditor());
|
||||
m_editor = qobject_cast<CppEditor *>(Core::EditorManager::currentEditor());
|
||||
if (!m_editor)
|
||||
return;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class FileName;
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
class CPPEditor;
|
||||
class CppEditor;
|
||||
class CppEditorWidget;
|
||||
class CppInclude;
|
||||
class CppIncludeLabel;
|
||||
|
||||
@@ -42,9 +42,11 @@
|
||||
Q_DECLARE_METATYPE(QList<QByteArray>)
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppEditor::Internal;
|
||||
using namespace CppTools;
|
||||
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
|
||||
QString toString(CppIncludeHierarchyModel &model, const QModelIndex &index, int indent = 0)
|
||||
@@ -69,7 +71,7 @@ QString toString(CppIncludeHierarchyModel &model)
|
||||
+ toString(model, model.index(1, 0));
|
||||
}
|
||||
|
||||
class IncludeHierarchyTestCase: public CppEditor::Internal::Tests::TestCase
|
||||
class IncludeHierarchyTestCase : public Tests::TestCase
|
||||
{
|
||||
public:
|
||||
IncludeHierarchyTestCase(const QList<QByteArray> &sourceList,
|
||||
@@ -95,7 +97,7 @@ public:
|
||||
|
||||
// Open Editor
|
||||
const QString fileName = QDir::tempPath() + QLatin1String("/file1.h");
|
||||
CPPEditor *editor;
|
||||
CppEditor *editor;
|
||||
QVERIFY(openCppEditor(fileName, &editor));
|
||||
closeEditorAtEndOfTestCase(editor);
|
||||
|
||||
@@ -182,3 +184,6 @@ void CppEditorPlugin::test_includehierarchy()
|
||||
|
||||
IncludeHierarchyTestCase(documents, expectedHierarchy);
|
||||
}
|
||||
|
||||
} // namespace CppEditor
|
||||
} // namespace Internal
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace TextEditor { class BaseTextEditor; }
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
class CPPEditor;
|
||||
class CppEditor;
|
||||
class CppIncludeHierarchyItem;
|
||||
|
||||
class CppIncludeHierarchyModel : public QAbstractItemModel
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
|
||||
using namespace CppEditor::Internal;
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
enum {
|
||||
debug = false
|
||||
@@ -185,14 +186,14 @@ bool CppOutlineWidget::syncCursor()
|
||||
|
||||
bool CppOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const
|
||||
{
|
||||
if (qobject_cast<CPPEditor*>(editor))
|
||||
if (qobject_cast<CppEditor*>(editor))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor *editor)
|
||||
{
|
||||
CPPEditor *cppEditor = qobject_cast<CPPEditor*>(editor);
|
||||
CppEditor *cppEditor = qobject_cast<CppEditor*>(editor);
|
||||
CppEditorWidget *cppEditorWidget = qobject_cast<CppEditorWidget*>(cppEditor->widget());
|
||||
QTC_ASSERT(cppEditorWidget, return 0);
|
||||
|
||||
@@ -200,3 +201,6 @@ TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -68,6 +68,6 @@ private:
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CPPEditor
|
||||
} // namespace CppEditor
|
||||
|
||||
#endif // CPPPREPROCESSORDIALOG_H
|
||||
|
||||
@@ -37,12 +37,13 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace CppEditor;
|
||||
using namespace CppEditor::Internal;
|
||||
using namespace TextEditor;
|
||||
using namespace CppTools;
|
||||
using namespace CPlusPlus;
|
||||
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
// -------------------------
|
||||
// CppQuickFixAssistProvider
|
||||
// -------------------------
|
||||
@@ -53,7 +54,7 @@ bool CppQuickFixAssistProvider::isAsynchronous() const
|
||||
|
||||
bool CppQuickFixAssistProvider::supportsEditor(Core::Id editorId) const
|
||||
{
|
||||
return editorId == CppEditor::Constants::CPPEDITOR_ID;
|
||||
return editorId == Constants::CPPEDITOR_ID;
|
||||
}
|
||||
|
||||
IAssistProcessor *CppQuickFixAssistProvider::createProcessor() const
|
||||
@@ -64,7 +65,7 @@ IAssistProcessor *CppQuickFixAssistProvider::createProcessor() const
|
||||
QList<TextEditor::QuickFixFactory *> CppQuickFixAssistProvider::quickFixFactories() const
|
||||
{
|
||||
QList<TextEditor::QuickFixFactory *> results;
|
||||
foreach (CppQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<CppEditor::CppQuickFixFactory>())
|
||||
foreach (CppQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<CppQuickFixFactory>())
|
||||
results.append(f);
|
||||
return results;
|
||||
}
|
||||
@@ -140,3 +141,6 @@ bool CppQuickFixAssistInterface::isCursorOn(const CPlusPlus::AST *ast) const
|
||||
{
|
||||
return currentFile()->isCursorOn(ast);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -70,13 +70,14 @@
|
||||
#include <cctype>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppEditor;
|
||||
using namespace CppEditor::Internal;
|
||||
using namespace CppTools;
|
||||
using namespace TextEditor;
|
||||
using Utils::ChangeSet;
|
||||
|
||||
void CppEditor::Internal::registerQuickFixes(ExtensionSystem::IPlugin *plugIn)
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
void registerQuickFixes(ExtensionSystem::IPlugin *plugIn)
|
||||
{
|
||||
plugIn->addAutoReleasedObject(new AddIncludeForUndefinedIdentifier);
|
||||
plugIn->addAutoReleasedObject(new AddIncludeForForwardDeclaration);
|
||||
@@ -5342,3 +5343,6 @@ void EscapeStringLiteral::match(const CppQuickFixInterface &interface, QuickFixO
|
||||
result.append(op);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -170,7 +170,7 @@ void CppTypeHierarchyWidget::perform()
|
||||
{
|
||||
showNoTypeHierarchyLabel();
|
||||
|
||||
CPPEditor *editor = qobject_cast<CPPEditor *>(Core::EditorManager::currentEditor());
|
||||
CppEditor *editor = qobject_cast<CppEditor *>(Core::EditorManager::currentEditor());
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ bool VirtualFunctionAssistProvider::isAsynchronous() const
|
||||
|
||||
bool VirtualFunctionAssistProvider::supportsEditor(Core::Id editorId) const
|
||||
{
|
||||
return editorId == CppEditor::Constants::CPPEDITOR_ID;
|
||||
return editorId == Constants::CPPEDITOR_ID;
|
||||
}
|
||||
|
||||
IAssistProcessor *VirtualFunctionAssistProvider::createProcessor() const
|
||||
|
||||
@@ -79,14 +79,15 @@
|
||||
|
||||
using namespace Core;
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppEditor;
|
||||
using namespace CppEditor::Internal;
|
||||
using namespace CppTools;
|
||||
using namespace TextEditor;
|
||||
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
|
||||
class TestActionsTestCase : public CppEditor::Internal::Tests::TestCase
|
||||
class TestActionsTestCase : public Tests::TestCase
|
||||
{
|
||||
public:
|
||||
class AbstractAction
|
||||
@@ -120,7 +121,7 @@ private:
|
||||
/// Move word camel case wise from current cursor position until given token (not included)
|
||||
/// and execute the tokenActions for each new position.
|
||||
static void moveWordCamelCaseToToken(TranslationUnit *translationUnit, const Token &token,
|
||||
CPPEditor *editor, const Actions &tokenActions);
|
||||
CppEditor *editor, const Actions &tokenActions);
|
||||
|
||||
static void undoAllChangesAndCloseAllEditors();
|
||||
|
||||
@@ -143,7 +144,7 @@ Actions singleAction(const ActionPointer &action)
|
||||
}
|
||||
|
||||
TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Actions &fileActions)
|
||||
: CppEditor::Internal::Tests::TestCase(/*runGarbageCollector=*/false)
|
||||
: Tests::TestCase(/*runGarbageCollector=*/false)
|
||||
{
|
||||
QVERIFY(succeededSoFar());
|
||||
|
||||
@@ -187,7 +188,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
|
||||
|
||||
// Open editor
|
||||
QCOMPARE(DocumentModel::openedDocuments().size(), 0);
|
||||
CPPEditor *editor;
|
||||
CppEditor *editor;
|
||||
CppEditorWidget *editorWidget;
|
||||
QVERIFY(openCppEditor(filePath, &editor, &editorWidget));
|
||||
|
||||
@@ -287,7 +288,7 @@ void TestActionsTestCase::executeActionsOnEditorWidget(CppEditorWidget *editorWi
|
||||
|
||||
void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationUnit,
|
||||
const Token &token,
|
||||
CPPEditor *editor,
|
||||
CppEditor *editor,
|
||||
const Actions &tokenActions)
|
||||
{
|
||||
QVERIFY(translationUnit);
|
||||
@@ -373,7 +374,7 @@ void SwitchDeclarationDefinitionTokenAction::run(CppEditorWidget *)
|
||||
IEditor *editorBefore = EditorManager::currentEditor();
|
||||
const int originalLine = editorBefore->currentLine();
|
||||
const int originalColumn = editorBefore->currentColumn();
|
||||
CppEditor::Internal::CppEditorPlugin::instance()->switchDeclarationDefinition();
|
||||
CppEditorPlugin::instance()->switchDeclarationDefinition();
|
||||
QApplication::processEvents();
|
||||
|
||||
// Go back
|
||||
@@ -394,7 +395,7 @@ public:
|
||||
|
||||
void FindUsagesTokenAction::run(CppEditorWidget *)
|
||||
{
|
||||
CppEditor::Internal::CppEditorPlugin::instance()->findUsages();
|
||||
CppEditorPlugin::instance()->findUsages();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
@@ -407,7 +408,7 @@ public:
|
||||
|
||||
void RenameSymbolUnderCursorTokenAction::run(CppEditorWidget *)
|
||||
{
|
||||
CppEditor::Internal::CppEditorPlugin::instance()->renameSymbolUnderCursor();
|
||||
CppEditorPlugin::instance()->renameSymbolUnderCursor();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
@@ -420,7 +421,7 @@ public:
|
||||
|
||||
void OpenTypeHierarchyTokenAction::run(CppEditorWidget *)
|
||||
{
|
||||
CppEditor::Internal::CppEditorPlugin::instance()->openTypeHierarchy();
|
||||
CppEditorPlugin::instance()->openTypeHierarchy();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
@@ -474,7 +475,7 @@ void RunAllQuickFixesTokenAction::run(CppEditorWidget *editorWidget)
|
||||
return;
|
||||
|
||||
foreach (CppQuickFixFactory *quickFixFactory, quickFixFactories) {
|
||||
TextEditor::QuickFixOperations operations;
|
||||
QuickFixOperations operations;
|
||||
// Some Quick Fixes pop up a dialog and are therefore inappropriate for this test.
|
||||
// Where possible, use a guiless version of the factory.
|
||||
if (qobject_cast<InsertVirtualMethods *>(quickFixFactory)) {
|
||||
@@ -567,3 +568,6 @@ void CppEditorPlugin::test_moveTokenWiseThroughEveryFileAndTriggerQuickFixes()
|
||||
{
|
||||
TestActionsTestCase(singleAction(ActionPointer(new RunAllQuickFixesTokenAction)));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -71,7 +71,7 @@ bool GlslCompleter::contextAllowsElectricCharacters(const QTextCursor &cursor) c
|
||||
const Token tk = SimpleLexer::tokenAt(cursor.block().text(), cursor.positionInBlock(),
|
||||
BackwardsScanner::previousBlockState(cursor.block()));
|
||||
|
||||
// XXX Duplicated from CPPEditor::isInComment to avoid tokenizing twice
|
||||
// XXX Duplicated from CppEditor::isInComment to avoid tokenizing twice
|
||||
if (tk.isComment()) {
|
||||
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user