Commit d66acb51 authored by Eike Ziller's avatar Eike Ziller

Rename IFile->IDocument and FileManager->DocumentManager

And adapt the other API respectively.

Change-Id: I1e04e555409be09242db6890f9e013396f83aeed
Reviewed-by: default avatarBill King <bill.king@nokia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 266da356
......@@ -540,7 +540,7 @@
name to the user, convert it back to native format with
QDir::toNativeSeparators.
When comparing file names, consider using FileManager::fixFileName which
When comparing file names, consider using DocumentManager::fixFileName which
makes sure that paths are clean and absolute and also takes Windows
case-insensitivity into account (even if it is an expensive operation).
......
......@@ -186,7 +186,7 @@
\row
\o Add a new editor type.
\o Such as an editor for XML files.
\o \l{Core::IEditorFactory}, \l{Core::IEditor}, \l{Core::IFile}
\o \l{Core::IEditorFactory}, \l{Core::IEditor}, \l{Core::IDocument}
\row
\o Add a new wizard.
......
......@@ -98,7 +98,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
editorWidget->convertPosition(pos, &line, &column);
const CPlusPlus::Snapshot &snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
CPlusPlus::Document::Ptr doc = snapshot.document(editor->file()->fileName());
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->fileName());
QTC_ASSERT(doc, return 0)
// fetch the expression's code
......
......@@ -37,7 +37,7 @@
#include "autotoolsprojectconstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/ifile.h>
#include <coreplugin/idocument.h>
#include <coreplugin/messagemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
......@@ -62,7 +62,7 @@ Project *AutotoolsManager::openProject(const QString &fileName, QString *errorSt
// Check whether the project is already open or not.
ProjectExplorerPlugin *projectExplorer = ProjectExplorerPlugin::instance();
foreach (Project *pi, projectExplorer->session()->projects()) {
if (canonicalFilePath == pi->file()->fileName()) {
if (canonicalFilePath == pi->document()->fileName()) {
*errorString = tr("Failed opening project '%1': Project already open")
.arg(QDir::toNativeSeparators(canonicalFilePath));
return 0;
......
......@@ -133,7 +133,7 @@ QString AutotoolsProject::id() const
return QLatin1String(Constants::AUTOTOOLS_PROJECT_ID);
}
Core::IFile *AutotoolsProject::file() const
Core::IDocument *AutotoolsProject::document() const
{
return m_file;
}
......
......@@ -78,7 +78,7 @@ public:
QString displayName() const;
QString id() const;
Core::IFile *file() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
AutotoolsTarget *activeTarget() const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
......
......@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
AutotoolsProjectFile::AutotoolsProjectFile(AutotoolsProject *project, const QString &fileName) :
Core::IFile(project),
Core::IDocument(project),
m_project(project),
m_fileName(fileName)
{
......
......@@ -35,7 +35,7 @@
#ifndef AUTOTOOLSPROJECTFILE_H
#define AUTOTOOLSPROJECTFILE_H
#include <coreplugin/ifile.h>
#include <coreplugin/idocument.h>
namespace AutotoolsProjectManager {
namespace Internal {
......@@ -43,7 +43,7 @@ namespace Internal {
class AutotoolsProject;
/**
* @brief Implementation of the Core::IFile interface.
* @brief Implementation of the Core::IDocument interface.
*
* Is used in AutotoolsProject and describes the root
* of a project. In the context of autotools the implementation
......@@ -52,7 +52,7 @@ class AutotoolsProject;
*
* @see AutotoolsProject
*/
class AutotoolsProjectFile : public Core::IFile
class AutotoolsProjectFile : public Core::IDocument
{
Q_OBJECT
......
......@@ -39,7 +39,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IFile *projectFile) :
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
ProjectNode(projectFile->fileName()),
m_project(project),
m_projectFile(projectFile)
......
......@@ -36,7 +36,7 @@
#define AUTOTOOLSPROJECTNODE_H
#include <projectexplorer/projectnodes.h>
#include <coreplugin/ifile.h>
#include <coreplugin/idocument.h>
namespace AutotoolsProjectManager {
namespace Internal {
......@@ -57,7 +57,7 @@ class AutotoolsProjectNode : public ProjectExplorer::ProjectNode
Q_OBJECT
public:
AutotoolsProjectNode(AutotoolsProject *project, Core::IFile *projectFile);
AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile);
bool hasBuildTargets() const;
QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
......@@ -79,7 +79,7 @@ public:
private:
AutotoolsProject *m_project;
Core::IFile *m_projectFile;
Core::IDocument *m_projectFile;
// TODO: AutotoolsProject calls the protected method addFileNodes() from AutotoolsProjectNode.
// Instead of this friend declaration, a public interface might be preferable.
......
......@@ -50,7 +50,7 @@
#include <coreplugin/vcsmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <locator/commandlocator.h>
......@@ -617,9 +617,9 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
{
if (!m_changeLog)
return true;
Core::IFile *editorFile = submitEditor->file();
Core::IDocument *editorDocument = submitEditor->document();
const CommitEditor *commitEditor = qobject_cast<const CommitEditor *>(submitEditor);
if (!editorFile || !commitEditor)
if (!editorDocument || !commitEditor)
return true;
bool dummyPrompt = m_bazaarSettings.boolValue(BazaarSettings::promptOnSubmitKey);
......@@ -641,7 +641,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
QStringList files = commitEditor->checkedFiles();
if (!files.empty()) {
//save the commit message
if (!Core::FileManager::saveFile(editorFile))
if (!Core::DocumentManager::saveDocument(editorDocument))
return false;
//rewrite entries of the form 'file => newfile' to 'newfile' because
......@@ -665,7 +665,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
// Whether local commit or not
if (commitWidget->isLocalOptionEnabled())
extraOptions += QLatin1String("--local");
m_client->commit(m_submitRepository, files, editorFile->fileName(), extraOptions);
m_client->commit(m_submitRepository, files, editorDocument->fileName(), extraOptions);
}
return true;
}
......
......@@ -58,7 +58,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h>
#include <coreplugin/ifile.h>
#include <coreplugin/idocument.h>
#include <coreplugin/mimedatabase.h>
#include <extensionsystem/pluginmanager.h>
#include <find/ifindsupport.h>
......@@ -185,12 +185,12 @@ private:
};
class BinEditorFile : public Core::IFile
class BinEditorDocument : public Core::IDocument
{
Q_OBJECT
public:
BinEditorFile(BinEditor *parent) :
Core::IFile(parent)
BinEditorDocument(BinEditor *parent) :
Core::IDocument(parent)
{
m_editor = parent;
connect(m_editor, SIGNAL(dataRequested(Core::IEditor*,quint64)),
......@@ -202,7 +202,7 @@ public:
connect(m_editor, SIGNAL(endOfFileRequested(Core::IEditor*)), this,
SLOT(handleEndOfFileRequested(Core::IEditor*)));
}
~BinEditorFile() {}
~BinEditorDocument() {}
QString mimeType() const {
return QLatin1String(Constants::C_BINEDITOR_MIMETYPE);
......@@ -296,7 +296,7 @@ public:
bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); }
bool isReadOnly() const {
bool isFileReadOnly() const {
if (m_editor->isMemoryView() || m_fileName.isEmpty())
return false;
const QFileInfo fi(m_fileName);
......@@ -332,7 +332,7 @@ public:
{
setWidget(editor);
m_editor = editor;
m_file = new BinEditorFile(m_editor);
m_file = new BinEditorDocument(m_editor);
m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(Constants::C_BINEDITOR);
m_addressEdit = new QLineEdit;
......@@ -373,7 +373,7 @@ public:
QTC_ASSERT(fileName == realFileName, return false); // The bineditor can do no autosaving
return m_file->open(errorString, fileName);
}
Core::IFile *file() { return m_file; }
Core::IDocument *document() { return m_file; }
Core::Id id() const { return Core::Constants::K_DEFAULT_BINARY_EDITOR_ID; }
QString displayName() const { return m_displayName; }
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
......@@ -401,7 +401,7 @@ private slots:
private:
BinEditor *m_editor;
QString m_displayName;
BinEditorFile *m_file;
BinEditorDocument *m_file;
QToolBar *m_toolBar;
QLineEdit *m_addressEdit;
};
......@@ -426,11 +426,11 @@ QString BinEditorFactory::displayName() const
return tr(Constants::C_BINEDITOR_DISPLAY_NAME);
}
Core::IFile *BinEditorFactory::open(const QString &fileName)
Core::IDocument *BinEditorFactory::open(const QString &fileName)
{
Core::EditorManager *em = Core::EditorManager::instance();
Core::IEditor *iface = em->openEditor(fileName, id());
return iface ? iface->file() : 0;
return iface ? iface->document() : 0;
}
Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
......
......@@ -108,7 +108,7 @@ public:
Core::IEditor *createEditor(QWidget *parent);
Core::Id id() const;
QString displayName() const;
Core::IFile *open(const QString &fileName);
Core::IDocument *open(const QString &fileName);
private:
const QStringList m_mimeTypes;
......
......@@ -393,7 +393,7 @@ void BookmarkManager::toggleBookmark()
if (!editor)
return;
toggleBookmark(editor->file()->fileName(), editor->currentLine());
toggleBookmark(editor->document()->fileName(), editor->currentLine());
}
void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
......@@ -508,7 +508,7 @@ void BookmarkManager::documentPrevNext(bool next)
{
TextEditor::ITextEditor *editor = currentTextEditor();
int editorLine = editor->currentLine();
QFileInfo fi(editor->file()->fileName());
QFileInfo fi(editor->document()->fileName());
if (!m_bookmarksMap.contains(fi.path()))
return;
......@@ -615,7 +615,7 @@ BookmarkManager::State BookmarkManager::state() const
if (!editor)
return HasBookMarks;
const QFileInfo fi(editor->file()->fileName());
const QFileInfo fi(editor->document()->fileName());
const DirectoryFileBookmarksMap::const_iterator dit = m_bookmarksMap.constFind(fi.path());
if (dit == m_bookmarksMap.constEnd())
......@@ -757,8 +757,8 @@ void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor,
int line,
TextEditor::ITextEditor::MarkRequestKind kind)
{
if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->file())
toggleBookmark(textEditor->file()->fileName(), line);
if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->document())
toggleBookmark(textEditor->document()->fileName(), line);
}
// BookmarkViewFactory
......
......@@ -200,7 +200,7 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
int lineNumber, QMenu *menu)
{
m_bookmarkMarginActionLineNumber = lineNumber;
m_bookmarkMarginActionFileName = editor->file()->fileName();
m_bookmarkMarginActionFileName = editor->document()->fileName();
menu->addAction(m_bookmarkMarginAction);
}
......
......@@ -312,9 +312,9 @@ void Manager::gotoLocations(const QList<QVariant> &list)
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor();
if (editor) {
// get current file name
Core::IFile *file = editor->file();
if (file)
fileName = file->fileName();
Core::IDocument *document = editor->document();
if (document)
fileName = document->fileName();
// if text file - what is current position?
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
......
......@@ -48,7 +48,7 @@
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <coreplugin/ifile.h>
#include <coreplugin/idocument.h>
#include <utils/qtcassert.h>
#include <QStandardItem>
......@@ -236,8 +236,8 @@ ParserTreeItem::ConstPtr Parser::parse()
QString prjName(prj->displayName());
QString prjType(prjName);
if (prj->file())
prjType = prj->file()->fileName();
if (prj->document())
prjType = prj->document()->fileName();
SymbolInformation inf(prjName, prjType);
QStringList projectList = addProjectNode(item, prj->rootProjectNode());
......
......@@ -79,7 +79,7 @@ Core::Id CMakeEditor::id() const
void CMakeEditor::markAsChanged()
{
if (!file()->isModified())
if (!document()->isModified())
return;
if (m_infoBarShown)
return;
......@@ -87,7 +87,7 @@ void CMakeEditor::markAsChanged()
Core::InfoBarEntry info(QLatin1String("CMakeEditor.RunCMake"),
tr("Changes to cmake files are shown in the project tree after building."));
info.setCustomButtonInfo(tr("Build now"), this, SLOT(build()));
file()->infoBar()->addInfo(info);
document()->infoBar()->addInfo(info);
}
void CMakeEditor::build()
......@@ -97,7 +97,7 @@ void CMakeEditor::build()
foreach (ProjectExplorer::Project *p, projects) {
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
if (cmakeProject) {
if (cmakeProject->isProjectFile(file()->fileName())) {
if (cmakeProject->isProjectFile(document()->fileName())) {
ProjectExplorer::ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
break;
}
......
......@@ -58,10 +58,10 @@ QString CMakeEditorFactory::displayName() const
return tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME);
}
Core::IFile *CMakeEditorFactory::open(const QString &fileName)
Core::IDocument *CMakeEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
return iface ? iface->file() : 0;
return iface ? iface->document() : 0;
}
Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent)
......
......@@ -57,7 +57,7 @@ public:
QStringList mimeTypes() const;
Core::Id id() const;
QString displayName() const;
Core::IFile *open(const QString &fileName);
Core::IDocument *open(const QString &fileName);
Core::IEditor *createEditor(QWidget *parent);
private:
......
......@@ -75,8 +75,8 @@ QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Loca
if (cmakeProject) {
foreach (CMakeBuildTarget ct, cmakeProject->buildTargets()) {
if (ct.title.contains(entry)) {
Locator::FilterEntry entry(this, ct.title, cmakeProject->file()->fileName());
entry.extraInfo = cmakeProject->file()->fileName();
Locator::FilterEntry entry(this, ct.title, cmakeProject->document()->fileName());
entry.extraInfo = cmakeProject->document()->fileName();
result.append(entry);
}
}
......@@ -95,7 +95,7 @@ void CMakeLocatorFilter::accept(Locator::FilterEntry selection) const
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects();
foreach (ProjectExplorer::Project *p, projects) {
cmakeProject = qobject_cast<CMakeProject *>(p);
if (cmakeProject && cmakeProject->file()->fileName() == selection.internalData.toString())
if (cmakeProject && cmakeProject->document()->fileName() == selection.internalData.toString())
break;
cmakeProject = 0;
}
......
......@@ -197,8 +197,8 @@ bool CMakeProject::parseCMakeLists()
return false;
foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors())
if (isProjectFile(editor->file()->fileName()))
editor->file()->infoBar()->removeInfo(QLatin1String("CMakeEditor.RunCMake"));
if (isProjectFile(editor->document()->fileName()))
editor->document()->infoBar()->removeInfo(QLatin1String("CMakeEditor.RunCMake"));
// Find cbp file
CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
......@@ -481,7 +481,7 @@ QString CMakeProject::id() const
return QLatin1String(Constants::CMAKEPROJECT_ID);
}
Core::IFile *CMakeProject::file() const
Core::IDocument *CMakeProject::document() const
{
return m_file;
}
......@@ -692,7 +692,7 @@ void CMakeProject::editorChanged(Core::IEditor *editor)
disconnect(m_lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
if (m_dirtyUic) {
const QString contents = formWindowEditorContents(m_lastEditor);
updateCodeModelSupportFromEditor(m_lastEditor->file()->fileName(), contents);
updateCodeModelSupportFromEditor(m_lastEditor->document()->fileName(), contents);
m_dirtyUic = false;
}
}
......@@ -713,7 +713,7 @@ void CMakeProject::editorAboutToClose(Core::IEditor *editor)
disconnect(m_lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
if (m_dirtyUic) {
const QString contents = formWindowEditorContents(m_lastEditor);
updateCodeModelSupportFromEditor(m_lastEditor->file()->fileName(), contents);
updateCodeModelSupportFromEditor(m_lastEditor->document()->fileName(), contents);
m_dirtyUic = false;
}
}
......@@ -744,7 +744,7 @@ void CMakeProject::buildStateChanged(ProjectExplorer::Project *project)
// CMakeFile
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
: Core::IFile(parent), m_project(parent), m_fileName(fileName)
: Core::IDocument(parent), m_project(parent), m_fileName(fileName)
{
}
......@@ -797,7 +797,7 @@ void CMakeFile::rename(const QString &newName)
// Can't happen....
}
Core::IFile::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
Core::IDocument::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
{
Q_UNUSED(state)
Q_UNUSED(type)
......
......@@ -43,7 +43,7 @@
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildconfiguration.h>
#include <coreplugin/ifile.h>
#include <coreplugin/idocument.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
......@@ -81,7 +81,7 @@ public:
QString displayName() const;
QString id() const;
Core::IFile *file() const;
Core::IDocument *document() const;
CMakeManager *projectManager() const;
CMakeTarget *activeTarget() const;
......@@ -193,7 +193,7 @@ private:
QString m_compiler;
};
class CMakeFile : public Core::IFile
class CMakeFile : public Core::IDocument
{
Q_OBJECT
public:
......
......@@ -38,7 +38,7 @@
#include "command_p.h"
#include "commandsfile.h"
#include "coreconstants.h"
#include "filemanager.h"
#include "documentmanager.h"
#include "icore.h"
#include "id.h"
......
......@@ -23,7 +23,6 @@ SOURCES += mainwindow.cpp \
fancyactionbar.cpp \
fancytabwidget.cpp \
generalsettings.cpp \
filemanager.cpp \
id.cpp \
messagemanager.cpp \
messageoutputwindow.cpp \
......@@ -71,7 +70,6 @@ SOURCES += mainwindow.cpp \
fileiconprovider.cpp \
mimedatabase.cpp \
icore.cpp \
ifile.cpp \
infobar.cpp \
editormanager/ieditor.cpp \
dialogs/ioptionspage.cpp \
......@@ -94,8 +92,10 @@ SOURCES += mainwindow.cpp \
mimetypesettings.cpp \
dialogs/promptoverwritedialog.cpp \
fileutils.cpp \
textfile.cpp \
featureprovider.cpp
featureprovider.cpp \
idocument.cpp \
textdocument.cpp \
documentmanager.cpp
HEADERS += mainwindow.h \
editmode.h \
......@@ -103,7 +103,6 @@ HEADERS += mainwindow.h \
fancyactionbar.h \
fancytabwidget.h \
generalsettings.h \
filemanager.h \
id.h \
messagemanager.h \
messageoutputwindow.h \
......@@ -141,9 +140,7 @@ HEADERS += mainwindow.h \
progressmanager/progressmanager.h \
icontext.h \
icore.h \
ifile.h \
infobar.h \
ifilefactory.h \
imode.h \
ioutputpane.h \
coreconstants.h \
......@@ -190,9 +187,12 @@ HEADERS += mainwindow.h \
dialogs/promptoverwritedialog.h \
fileutils.h \
externaltoolmanager.h \
textfile.h \
generatedfile.h \
featureprovider.h
featureprovider.h \
idocument.h \
idocumentfactory.h \
textdocument.h \
documentmanager.h
FORMS += dialogs/newdialog.ui \
actionmanager/commandmappings.ui \
......
......@@ -213,8 +213,8 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
bool mimeEditorAvailable = false;