DiffEditorManager simplify

by using EditorManager::openEditorWithContents

Change-Id: I2850648bff0f5b8f01254b9c7ce9539c1262f576
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Nikita Baryshnikov
2015-04-06 15:01:05 +03:00
parent 7c083eadee
commit 147dad8944
11 changed files with 27 additions and 202 deletions

View File

@@ -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)
{