forked from qt-creator/qt-creator
DiffEditorManager simplify
by using EditorManager::openEditorWithContents Change-Id: I2850648bff0f5b8f01254b9c7ce9539c1262f576 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
#include "diffeditorcontroller.h"
|
||||
#include "diffeditordocument.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -82,6 +84,21 @@ QString DiffEditorController::makePatch(bool revert, bool addPrefix) const
|
||||
return m_document->makePatch(m_diffFileIndex, m_chunkIndex, revert, addPrefix);
|
||||
}
|
||||
|
||||
Core::IDocument *DiffEditorController::findOrCreateDocument(const QString &vcsId,
|
||||
const QString &displayName)
|
||||
{
|
||||
QString preferredDisplayName = displayName;
|
||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||
Constants::DIFF_EDITOR_ID, &preferredDisplayName, QByteArray(), vcsId);
|
||||
return editor ? editor->document() : 0;
|
||||
}
|
||||
|
||||
DiffEditorController *DiffEditorController::controller(Core::IDocument *document)
|
||||
{
|
||||
auto doc = qobject_cast<Internal::DiffEditorDocument *>(document);
|
||||
return doc ? doc->controller() : 0;
|
||||
}
|
||||
|
||||
void DiffEditorController::setDiffFiles(const QList<FileData> &diffFileList,
|
||||
const QString &workingDirectory)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user