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 @@ ...@@ -540,7 +540,7 @@
name to the user, convert it back to native format with name to the user, convert it back to native format with
QDir::toNativeSeparators. 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 makes sure that paths are clean and absolute and also takes Windows
case-insensitivity into account (even if it is an expensive operation). case-insensitivity into account (even if it is an expensive operation).
......
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
\row \row
\o Add a new editor type. \o Add a new editor type.
\o Such as an editor for XML files. \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 \row
\o Add a new wizard. \o Add a new wizard.
......
...@@ -98,7 +98,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() ...@@ -98,7 +98,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
editorWidget->convertPosition(pos, &line, &column); editorWidget->convertPosition(pos, &line, &column);
const CPlusPlus::Snapshot &snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot(); 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) QTC_ASSERT(doc, return 0)
// fetch the expression's code // fetch the expression's code
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/ifile.h> #include <coreplugin/idocument.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
...@@ -62,7 +62,7 @@ Project *AutotoolsManager::openProject(const QString &fileName, QString *errorSt ...@@ -62,7 +62,7 @@ Project *AutotoolsManager::openProject(const QString &fileName, QString *errorSt
// Check whether the project is already open or not. // Check whether the project is already open or not.
ProjectExplorerPlugin *projectExplorer = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *projectExplorer = ProjectExplorerPlugin::instance();
foreach (Project *pi, projectExplorer->session()->projects()) { 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") *errorString = tr("Failed opening project '%1': Project already open")
.arg(QDir::toNativeSeparators(canonicalFilePath)); .arg(QDir::toNativeSeparators(canonicalFilePath));
return 0; return 0;
......
...@@ -133,7 +133,7 @@ QString AutotoolsProject::id() const ...@@ -133,7 +133,7 @@ QString AutotoolsProject::id() const
return QLatin1String(Constants::AUTOTOOLS_PROJECT_ID); return QLatin1String(Constants::AUTOTOOLS_PROJECT_ID);
} }
Core::IFile *AutotoolsProject::file() const Core::IDocument *AutotoolsProject::document() const
{ {
return m_file; return m_file;
} }
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
QString displayName() const; QString displayName() const;
QString id() const; QString id() const;
Core::IFile *file() const; Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const; ProjectExplorer::IProjectManager *projectManager() const;
AutotoolsTarget *activeTarget() const; AutotoolsTarget *activeTarget() const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets(); QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
......
...@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager; ...@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal; using namespace AutotoolsProjectManager::Internal;
AutotoolsProjectFile::AutotoolsProjectFile(AutotoolsProject *project, const QString &fileName) : AutotoolsProjectFile::AutotoolsProjectFile(AutotoolsProject *project, const QString &fileName) :
Core::IFile(project), Core::IDocument(project),
m_project(project), m_project(project),
m_fileName(fileName) m_fileName(fileName)
{ {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#ifndef AUTOTOOLSPROJECTFILE_H #ifndef AUTOTOOLSPROJECTFILE_H
#define AUTOTOOLSPROJECTFILE_H #define AUTOTOOLSPROJECTFILE_H
#include <coreplugin/ifile.h> #include <coreplugin/idocument.h>
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
...@@ -43,7 +43,7 @@ namespace Internal { ...@@ -43,7 +43,7 @@ namespace Internal {
class AutotoolsProject; class AutotoolsProject;
/** /**
* @brief Implementation of the Core::IFile interface. * @brief Implementation of the Core::IDocument interface.
* *
* Is used in AutotoolsProject and describes the root * Is used in AutotoolsProject and describes the root
* of a project. In the context of autotools the implementation * of a project. In the context of autotools the implementation
...@@ -52,7 +52,7 @@ class AutotoolsProject; ...@@ -52,7 +52,7 @@ class AutotoolsProject;
* *
* @see AutotoolsProject * @see AutotoolsProject
*/ */
class AutotoolsProjectFile : public Core::IFile class AutotoolsProjectFile : public Core::IDocument
{ {
Q_OBJECT Q_OBJECT
......
...@@ -39,7 +39,7 @@ using namespace AutotoolsProjectManager; ...@@ -39,7 +39,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal; using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IFile *projectFile) : AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
ProjectNode(projectFile->fileName()), ProjectNode(projectFile->fileName()),
m_project(project), m_project(project),
m_projectFile(projectFile) m_projectFile(projectFile)
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define AUTOTOOLSPROJECTNODE_H #define AUTOTOOLSPROJECTNODE_H
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <coreplugin/ifile.h> #include <coreplugin/idocument.h>
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
...@@ -57,7 +57,7 @@ class AutotoolsProjectNode : public ProjectExplorer::ProjectNode ...@@ -57,7 +57,7 @@ class AutotoolsProjectNode : public ProjectExplorer::ProjectNode
Q_OBJECT Q_OBJECT
public: public:
AutotoolsProjectNode(AutotoolsProject *project, Core::IFile *projectFile); AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile);
bool hasBuildTargets() const; bool hasBuildTargets() const;
QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const; QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
private: private:
AutotoolsProject *m_project; AutotoolsProject *m_project;
Core::IFile *m_projectFile; Core::IDocument *m_projectFile;
// TODO: AutotoolsProject calls the protected method addFileNodes() from AutotoolsProjectNode. // TODO: AutotoolsProject calls the protected method addFileNodes() from AutotoolsProjectNode.
// Instead of this friend declaration, a public interface might be preferable. // Instead of this friend declaration, a public interface might be preferable.
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/filemanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <locator/commandlocator.h> #include <locator/commandlocator.h>
...@@ -617,9 +617,9 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit ...@@ -617,9 +617,9 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
{ {
if (!m_changeLog) if (!m_changeLog)
return true; return true;
Core::IFile *editorFile = submitEditor->file(); Core::IDocument *editorDocument = submitEditor->document();
const CommitEditor *commitEditor = qobject_cast<const CommitEditor *>(submitEditor); const CommitEditor *commitEditor = qobject_cast<const CommitEditor *>(submitEditor);
if (!editorFile || !commitEditor) if (!editorDocument || !commitEditor)
return true; return true;
bool dummyPrompt = m_bazaarSettings.boolValue(BazaarSettings::promptOnSubmitKey); bool dummyPrompt = m_bazaarSettings.boolValue(BazaarSettings::promptOnSubmitKey);
...@@ -641,7 +641,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit ...@@ -641,7 +641,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
QStringList files = commitEditor->checkedFiles(); QStringList files = commitEditor->checkedFiles();
if (!files.empty()) { if (!files.empty()) {
//save the commit message //save the commit message
if (!Core::FileManager::saveFile(editorFile)) if (!Core::DocumentManager::saveDocument(editorDocument))
return false; return false;
//rewrite entries of the form 'file => newfile' to 'newfile' because //rewrite entries of the form 'file => newfile' to 'newfile' because
...@@ -665,7 +665,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit ...@@ -665,7 +665,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
// Whether local commit or not // Whether local commit or not
if (commitWidget->isLocalOptionEnabled()) if (commitWidget->isLocalOptionEnabled())
extraOptions += QLatin1String("--local"); extraOptions += QLatin1String("--local");
m_client->commit(m_submitRepository, files, editorFile->fileName(), extraOptions); m_client->commit(m_submitRepository, files, editorDocument->fileName(), extraOptions);
} }
return true; return true;
} }
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/ifile.h> #include <coreplugin/idocument.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <find/ifindsupport.h> #include <find/ifindsupport.h>
...@@ -185,12 +185,12 @@ private: ...@@ -185,12 +185,12 @@ private:
}; };
class BinEditorFile : public Core::IFile class BinEditorDocument : public Core::IDocument
{ {
Q_OBJECT Q_OBJECT
public: public:
BinEditorFile(BinEditor *parent) : BinEditorDocument(BinEditor *parent) :
Core::IFile(parent) Core::IDocument(parent)
{ {
m_editor = parent; m_editor = parent;
connect(m_editor, SIGNAL(dataRequested(Core::IEditor*,quint64)), connect(m_editor, SIGNAL(dataRequested(Core::IEditor*,quint64)),
...@@ -202,7 +202,7 @@ public: ...@@ -202,7 +202,7 @@ public:
connect(m_editor, SIGNAL(endOfFileRequested(Core::IEditor*)), this, connect(m_editor, SIGNAL(endOfFileRequested(Core::IEditor*)), this,
SLOT(handleEndOfFileRequested(Core::IEditor*))); SLOT(handleEndOfFileRequested(Core::IEditor*)));
} }
~BinEditorFile() {} ~BinEditorDocument() {}
QString mimeType() const { QString mimeType() const {
return QLatin1String(Constants::C_BINEDITOR_MIMETYPE); return QLatin1String(Constants::C_BINEDITOR_MIMETYPE);
...@@ -296,7 +296,7 @@ public: ...@@ -296,7 +296,7 @@ public:
bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); } bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); }
bool isReadOnly() const { bool isFileReadOnly() const {
if (m_editor->isMemoryView() || m_fileName.isEmpty()) if (m_editor->isMemoryView() || m_fileName.isEmpty())
return false; return false;
const QFileInfo fi(m_fileName); const QFileInfo fi(m_fileName);
...@@ -332,7 +332,7 @@ public: ...@@ -332,7 +332,7 @@ public:
{ {
setWidget(editor); setWidget(editor);
m_editor = 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(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(Constants::C_BINEDITOR); m_context.add(Constants::C_BINEDITOR);
m_addressEdit = new QLineEdit; m_addressEdit = new QLineEdit;
...@@ -373,7 +373,7 @@ public: ...@@ -373,7 +373,7 @@ public:
QTC_ASSERT(fileName == realFileName, return false); // The bineditor can do no autosaving QTC_ASSERT(fileName == realFileName, return false); // The bineditor can do no autosaving
return m_file->open(errorString, fileName); 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; } Core::Id id() const { return Core::Constants::K_DEFAULT_BINARY_EDITOR_ID; }
QString displayName() const { return m_displayName; } QString displayName() const { return m_displayName; }
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); } void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
...@@ -401,7 +401,7 @@ private slots: ...@@ -401,7 +401,7 @@ private slots:
private: private:
BinEditor *m_editor; BinEditor *m_editor;
QString m_displayName; QString m_displayName;
BinEditorFile *m_file; BinEditorDocument *m_file;
QToolBar *m_toolBar; QToolBar *m_toolBar;
QLineEdit *m_addressEdit; QLineEdit *m_addressEdit;
}; };
...@@ -426,11 +426,11 @@ QString BinEditorFactory::displayName() const ...@@ -426,11 +426,11 @@ QString BinEditorFactory::displayName() const
return tr(Constants::C_BINEDITOR_DISPLAY_NAME); 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::EditorManager *em = Core::EditorManager::instance();
Core::IEditor *iface = em->openEditor(fileName, id()); Core::IEditor *iface = em->openEditor(fileName, id());
return iface ? iface->file() : 0; return iface ? iface->document() : 0;
} }
Core::IEditor *BinEditorFactory::createEditor(QWidget *parent) Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
......
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
Core::IEditor *createEditor(QWidget *parent); Core::IEditor *createEditor(QWidget *parent);
Core::Id id() const; Core::Id id() const;
QString displayName() const; QString displayName() const;
Core::IFile *open(const QString &fileName); Core::IDocument *open(const QString &fileName);
private: private:
const QStringList m_mimeTypes; const QStringList m_mimeTypes;
......
...@@ -393,7 +393,7 @@ void BookmarkManager::toggleBookmark() ...@@ -393,7 +393,7 @@ void BookmarkManager::toggleBookmark()
if (!editor) if (!editor)
return; return;
toggleBookmark(editor->file()->fileName(), editor->currentLine()); toggleBookmark(editor->document()->fileName(), editor->currentLine());
} }
void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber) void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
...@@ -508,7 +508,7 @@ void BookmarkManager::documentPrevNext(bool next) ...@@ -508,7 +508,7 @@ void BookmarkManager::documentPrevNext(bool next)
{ {
TextEditor::ITextEditor *editor = currentTextEditor(); TextEditor::ITextEditor *editor = currentTextEditor();
int editorLine = editor->currentLine(); int editorLine = editor->currentLine();
QFileInfo fi(editor->file()->fileName()); QFileInfo fi(editor->document()->fileName());
if (!m_bookmarksMap.contains(fi.path())) if (!m_bookmarksMap.contains(fi.path()))
return; return;
...@@ -615,7 +615,7 @@ BookmarkManager::State BookmarkManager::state() const ...@@ -615,7 +615,7 @@ BookmarkManager::State BookmarkManager::state() const
if (!editor) if (!editor)
return HasBookMarks; return HasBookMarks;
const QFileInfo fi(editor->file()->fileName()); const QFileInfo fi(editor->document()->fileName());
const DirectoryFileBookmarksMap::const_iterator dit = m_bookmarksMap.constFind(fi.path()); const DirectoryFileBookmarksMap::const_iterator dit = m_bookmarksMap.constFind(fi.path());
if (dit == m_bookmarksMap.constEnd()) if (dit == m_bookmarksMap.constEnd())
...@@ -757,8 +757,8 @@ void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor, ...@@ -757,8 +757,8 @@ void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor,
int line, int line,
TextEditor::ITextEditor::MarkRequestKind kind) TextEditor::ITextEditor::MarkRequestKind kind)
{ {
if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->file()) if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->document())
toggleBookmark(textEditor->file()->fileName(), line); toggleBookmark(textEditor->document()->fileName(), line);
} }
// BookmarkViewFactory // BookmarkViewFactory
......
...@@ -200,7 +200,7 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor, ...@@ -200,7 +200,7 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
int lineNumber, QMenu *menu) int lineNumber, QMenu *menu)
{ {
m_bookmarkMarginActionLineNumber = lineNumber; m_bookmarkMarginActionLineNumber = lineNumber;
m_bookmarkMarginActionFileName = editor->file()->fileName(); m_bookmarkMarginActionFileName = editor->document()->fileName();
menu->addAction(m_bookmarkMarginAction); menu->addAction(m_bookmarkMarginAction);
} }
......
...@@ -312,9 +312,9 @@ void Manager::gotoLocations(const QList<QVariant> &list) ...@@ -312,9 +312,9 @@ void Manager::gotoLocations(const QList<QVariant> &list)
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor(); Core::IEditor *editor = Core::EditorManager::instance()->currentEditor();
if (editor) { if (editor) {
// get current file name // get current file name
Core::IFile *file = editor->file(); Core::IDocument *document = editor->document();
if (file) if (document)
fileName = file->fileName(); fileName = document->fileName();
// if text file - what is current position? // if text file - what is current position?
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <coreplugin/ifile.h> #include <coreplugin/idocument.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QStandardItem> #include <QStandardItem>
...@@ -236,8 +236,8 @@ ParserTreeItem::ConstPtr Parser::parse() ...@@ -236,8 +236,8 @@ ParserTreeItem::ConstPtr Parser::parse()
QString prjName(prj->displayName()); QString prjName(prj->displayName());
QString prjType(prjName); QString prjType(prjName);
if (prj->file()) if (prj->document())
prjType = prj->file()->fileName(); prjType = prj->document()->fileName();
SymbolInformation inf(prjName, prjType); SymbolInformation inf(prjName, prjType);
QStringList projectList = addProjectNode(item, prj->rootProjectNode()); QStringList projectList = addProjectNode(item, prj->rootProjectNode());
......
...@@ -79,7 +79,7 @@ Core::Id CMakeEditor::id() const ...@@ -79,7 +79,7 @@ Core::Id CMakeEditor::id() const
void CMakeEditor::markAsChanged() void CMakeEditor::markAsChanged()
{ {
if (!file()->isModified())