forked from qt-creator/qt-creator
Rename IFile->IDocument and FileManager->DocumentManager
And adapt the other API respectively. Change-Id: I1e04e555409be09242db6890f9e013396f83aeed Reviewed-by: Bill King <bill.king@nokia.com> Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
#include <cplusplus/BackwardsScanner.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
@@ -719,7 +719,7 @@ bool CppCompletionAssistProcessor::accepts() const
|
||||
const int start = startOfOperator(pos, &token, /*want function call=*/ true);
|
||||
if (start != pos) {
|
||||
if (token == T_POUND) {
|
||||
const int column = pos - m_interface->document()->findBlock(start).position();
|
||||
const int column = pos - m_interface->textDocument()->findBlock(start).position();
|
||||
if (column != 1)
|
||||
return false;
|
||||
}
|
||||
@@ -734,7 +734,7 @@ bool CppCompletionAssistProcessor::accepts() const
|
||||
const QChar firstCharacter = m_interface->characterAt(startOfName);
|
||||
if (firstCharacter.isLetter() || firstCharacter == QLatin1Char('_')) {
|
||||
// Finally check that we're not inside a comment or string (code copied from startOfOperator)
|
||||
QTextCursor tc(m_interface->document());
|
||||
QTextCursor tc(m_interface->textDocument());
|
||||
tc.setPosition(pos);
|
||||
|
||||
SimpleLexer tokenize;
|
||||
@@ -818,7 +818,7 @@ int CppCompletionAssistProcessor::startOfOperator(int pos,
|
||||
|
||||
int start = pos - activationSequenceChar(ch, ch2, ch3, kind, wantFunctionCall);
|
||||
if (start != pos) {
|
||||
QTextCursor tc(m_interface->document());
|
||||
QTextCursor tc(m_interface->textDocument());
|
||||
tc.setPosition(pos);
|
||||
|
||||
// Include completion: make sure the quote character is the first one on the line
|
||||
@@ -944,8 +944,8 @@ int CppCompletionAssistProcessor::startCompletionHelper()
|
||||
&m_model->m_completionOperator,
|
||||
/*want function call =*/ true);
|
||||
|
||||
const Core::IFile *file = m_interface->file();
|
||||
QString fileName = file->fileName();
|
||||
const Core::IDocument *document = m_interface->document();
|
||||
QString fileName = document->fileName();
|
||||
|
||||
if (m_model->m_completionOperator == T_DOXY_COMMENT) {
|
||||
for (int i = 1; i < T_DOXY_LAST_TAG; ++i)
|
||||
@@ -965,7 +965,7 @@ int CppCompletionAssistProcessor::startCompletionHelper()
|
||||
|| m_model->m_completionOperator == T_ANGLE_STRING_LITERAL
|
||||
|| m_model->m_completionOperator == T_SLASH) {
|
||||
|
||||
QTextCursor c(m_interface->document());
|
||||
QTextCursor c(m_interface->textDocument());
|
||||
c.setPosition(endOfExpression);
|
||||
if (completeInclude(c))
|
||||
m_startPosition = startOfName;
|
||||
@@ -973,7 +973,7 @@ int CppCompletionAssistProcessor::startCompletionHelper()
|
||||
}
|
||||
|
||||
ExpressionUnderCursor expressionUnderCursor;
|
||||
QTextCursor tc(m_interface->document());
|
||||
QTextCursor tc(m_interface->textDocument());
|
||||
|
||||
if (m_model->m_completionOperator == T_COMMA) {
|
||||
tc.setPosition(endOfExpression);
|
||||
@@ -1017,7 +1017,7 @@ int CppCompletionAssistProcessor::startCompletionHelper()
|
||||
}
|
||||
|
||||
int line = 0, column = 0;
|
||||
Convenience::convertPosition(m_interface->document(), startOfExpression, &line, &column);
|
||||
Convenience::convertPosition(m_interface->textDocument(), startOfExpression, &line, &column);
|
||||
return startCompletionInternal(fileName, line, column, expression, endOfExpression);
|
||||
}
|
||||
|
||||
@@ -1029,7 +1029,7 @@ bool CppCompletionAssistProcessor::tryObjCCompletion()
|
||||
if (m_interface->characterAt(end) != QLatin1Char(']'))
|
||||
return false;
|
||||
|
||||
QTextCursor tc(m_interface->document());
|
||||
QTextCursor tc(m_interface->textDocument());
|
||||
tc.setPosition(end);
|
||||
BackwardsScanner tokens(tc);
|
||||
if (tokens[tokens.startToken() - 1].isNot(T_RBRACKET))
|
||||
@@ -1042,14 +1042,14 @@ bool CppCompletionAssistProcessor::tryObjCCompletion()
|
||||
const int startPos = tokens[start].begin() + tokens.startPosition();
|
||||
const QString expr = m_interface->textAt(startPos, m_interface->position() - startPos);
|
||||
|
||||
Document::Ptr thisDocument = m_interface->snapshot().document(m_interface->file()->fileName());
|
||||
Document::Ptr thisDocument = m_interface->snapshot().document(m_interface->document()->fileName());
|
||||
if (! thisDocument)
|
||||
return false;
|
||||
|
||||
m_model->m_typeOfExpression->init(thisDocument, m_interface->snapshot());
|
||||
|
||||
int line = 0, column = 0;
|
||||
Convenience::convertPosition(m_interface->document(), m_interface->position(), &line, &column);
|
||||
Convenience::convertPosition(m_interface->textDocument(), m_interface->position(), &line, &column);
|
||||
Scope *scope = thisDocument->scopeAt(line, column);
|
||||
if (!scope)
|
||||
return false;
|
||||
@@ -1171,7 +1171,7 @@ bool CppCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
|
||||
|
||||
// Make completion for all relevant includes
|
||||
QStringList includePaths = m_interface->includePaths();
|
||||
const QString ¤tFilePath = QFileInfo(m_interface->file()->fileName()).path();
|
||||
const QString ¤tFilePath = QFileInfo(m_interface->document()->fileName()).path();
|
||||
if (!includePaths.contains(currentFilePath))
|
||||
includePaths.append(currentFilePath);
|
||||
|
||||
@@ -1232,8 +1232,8 @@ bool CppCompletionAssistProcessor::objcKeywordsWanted() const
|
||||
if (!m_objcEnabled)
|
||||
return false;
|
||||
|
||||
const Core::IFile *file = m_interface->file();
|
||||
QString fileName = file->fileName();
|
||||
const Core::IDocument *document = m_interface->document();
|
||||
QString fileName = document->fileName();
|
||||
|
||||
const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase();
|
||||
return mdb->findByFile(fileName).type() == CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE;
|
||||
@@ -1291,7 +1291,7 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName
|
||||
--index;
|
||||
index = findStartOfName(index);
|
||||
|
||||
QTextCursor tc(m_interface->document());
|
||||
QTextCursor tc(m_interface->textDocument());
|
||||
tc.setPosition(index);
|
||||
|
||||
ExpressionUnderCursor expressionUnderCursor;
|
||||
@@ -1824,7 +1824,7 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl
|
||||
|
||||
// get current line and column
|
||||
int lineSigned = 0, columnSigned = 0;
|
||||
Convenience::convertPosition(m_interface->document(), m_interface->position(), &lineSigned, &columnSigned);
|
||||
Convenience::convertPosition(m_interface->textDocument(), m_interface->position(), &lineSigned, &columnSigned);
|
||||
unsigned line = lineSigned, column = columnSigned;
|
||||
|
||||
// find a scope that encloses the current location, starting from the lastVisibileSymbol
|
||||
@@ -1837,7 +1837,7 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl
|
||||
// declaration, we should be certain that it isn't.
|
||||
bool autocompleteSignature = false;
|
||||
|
||||
QTextCursor tc(m_interface->document());
|
||||
QTextCursor tc(m_interface->textDocument());
|
||||
tc.setPosition(endOfExpression);
|
||||
BackwardsScanner bs(tc);
|
||||
const int startToken = bs.startToken();
|
||||
|
||||
@@ -145,14 +145,14 @@ private:
|
||||
class CppCompletionAssistInterface : public TextEditor::DefaultAssistInterface
|
||||
{
|
||||
public:
|
||||
CppCompletionAssistInterface(QTextDocument *document,
|
||||
CppCompletionAssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
Core::IFile *file,
|
||||
Core::IDocument *document,
|
||||
TextEditor::AssistReason reason,
|
||||
const CPlusPlus::Snapshot &snapshot,
|
||||
const QStringList &includePaths,
|
||||
const QStringList &frameworkPaths)
|
||||
: TextEditor::DefaultAssistInterface(document, position, file, reason)
|
||||
: TextEditor::DefaultAssistInterface(textDocument, position, document, reason)
|
||||
, m_snapshot(snapshot)
|
||||
, m_includePaths(includePaths)
|
||||
, m_frameworkPaths(frameworkPaths)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cpptoolseditorsupport.h"
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <texteditor/codeassist/iassistinterface.h>
|
||||
|
||||
@@ -64,7 +64,7 @@ TextEditor::IAssistInterface *CppCompletionSupport::createAssistInterface(Projec
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(
|
||||
document,
|
||||
position,
|
||||
m_editorSupport->textEditor()->file(),
|
||||
m_editorSupport->textEditor()->document(),
|
||||
reason,
|
||||
modelManager->snapshot(),
|
||||
includePaths,
|
||||
|
||||
@@ -42,7 +42,7 @@ class QTextDocument;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IFile;
|
||||
class IDocument;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -131,7 +131,7 @@ void CppCurrentDocumentFilter::onDocumentUpdated(Document::Ptr doc)
|
||||
void CppCurrentDocumentFilter::onCurrentEditorChanged(Core::IEditor * currentEditor)
|
||||
{
|
||||
if (currentEditor) {
|
||||
m_currentFileName = currentEditor->file()->fileName();
|
||||
m_currentFileName = currentEditor->document()->fileName();
|
||||
} else {
|
||||
m_currentFileName.clear();
|
||||
}
|
||||
@@ -141,7 +141,7 @@ void CppCurrentDocumentFilter::onCurrentEditorChanged(Core::IEditor * currentEdi
|
||||
void CppCurrentDocumentFilter::onEditorAboutToClose(Core::IEditor * editorAboutToClose)
|
||||
{
|
||||
if (!editorAboutToClose) return;
|
||||
if (m_currentFileName == editorAboutToClose->file()->fileName()) {
|
||||
if (m_currentFileName == editorAboutToClose->document()->fileName()) {
|
||||
m_currentFileName.clear();
|
||||
m_itemsOfCurrentDoc.clear();
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
|
||||
it.next();
|
||||
TextEditor::ITextEditor *textEditor = it.key();
|
||||
CppEditorSupport *editorSupport = it.value();
|
||||
QString fileName = textEditor->file()->fileName();
|
||||
QString fileName = textEditor->document()->fileName();
|
||||
workingCopy.insert(fileName, editorSupport->contents(), editorSupport->editorRevision());
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,7 @@ void CppModelManager::updateEditor(Document::Ptr doc)
|
||||
|
||||
QList<Core::IEditor *> openedEditors = Core::ICore::editorManager()->openedEditors();
|
||||
foreach (Core::IEditor *editor, openedEditors) {
|
||||
if (editor->file()->fileName() == fileName) {
|
||||
if (editor->document()->fileName() == fileName) {
|
||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||
if (! textEditor)
|
||||
continue;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "cpptoolseditorsupport.h"
|
||||
#include "cppmodelmanager.h"
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
@@ -137,7 +137,7 @@ void CppEditorSupport::updateDocumentNow()
|
||||
} else {
|
||||
_updateDocumentTimer->stop();
|
||||
|
||||
QStringList sourceFiles(_textEditor->file()->fileName());
|
||||
QStringList sourceFiles(_textEditor->document()->fileName());
|
||||
_cachedContents = _textEditor->contents().toUtf8();
|
||||
_documentParser = _modelManager->refreshSourceFiles(sourceFiles);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
|
||||
#include <QtConcurrentRun>
|
||||
@@ -112,7 +112,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
Core::VcsManager *vcsManager = Core::ICore::vcsManager();
|
||||
connect(vcsManager, SIGNAL(repositoryChanged(QString)),
|
||||
m_modelManager, SLOT(updateModifiedSourceFiles()));
|
||||
connect(Core::FileManager::instance(), SIGNAL(filesChangedInternally(QStringList)),
|
||||
connect(Core::DocumentManager::instance(), SIGNAL(filesChangedInternally(QStringList)),
|
||||
m_modelManager, SLOT(updateSourceFiles(QStringList)));
|
||||
addAutoReleasedObject(m_modelManager);
|
||||
|
||||
@@ -163,7 +163,7 @@ void CppToolsPlugin::switchHeaderSource()
|
||||
{
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
Core::IEditor *editor = editorManager->currentEditor();
|
||||
QString otherFile = correspondingHeaderOrSource(editor->file()->fileName());
|
||||
QString otherFile = correspondingHeaderOrSource(editor->document()->fileName());
|
||||
if (!otherFile.isEmpty())
|
||||
editorManager->openEditor(otherFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user