diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp
index 3cb6162d4fc052a39fdeec95b392f571306efdb8..40b71bed69870875d8678b15d25e2c3c79c8c803 100644
--- a/src/libs/qmljs/qmljsdocument.cpp
+++ b/src/libs/qmljs/qmljsdocument.cpp
@@ -254,9 +254,7 @@ void Snapshot::insert(const Document::Ptr &document)
         const QString fileName = document->fileName();
         const QString path = document->path();
 
-        Document::Ptr old = _documents.value(fileName);
-        if (old)
-            _documentsByPath.remove(path, old);
+        remove(fileName);
         _documentsByPath.insert(path, document);
         _documents.insert(fileName, document);
     }
@@ -267,6 +265,15 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
     _libraries.insert(QDir::cleanPath(path), info);
 }
 
+void Snapshot::remove(const QString &fileName)
+{
+    Document::Ptr doc = _documents.value(fileName);
+    if (!doc.isNull()) {
+        _documentsByPath.remove(doc->path(), doc);
+        _documents.remove(fileName);
+    }
+}
+
 Document::Ptr Snapshot::documentFromSource(const QString &code,
                                            const QString &fileName) const
 {
diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h
index c81c513290267ac1ee87ecb2597e562d757cee33..51b4e5665ff665067c70d1c2789b78001edf06fa 100644
--- a/src/libs/qmljs/qmljsdocument.h
+++ b/src/libs/qmljs/qmljsdocument.h
@@ -148,6 +148,7 @@ public:
 
     void insert(const Document::Ptr &document);
     void insertLibraryInfo(const QString &path, const LibraryInfo &info);
+    void remove(const QString &fileName);
 
     Document::Ptr document(const QString &fileName) const;
     QList<Document::Ptr> documentsInDirectory(const QString &path) const;
diff --git a/src/plugins/qmljseditor/qmljsmodelmanager.cpp b/src/plugins/qmljseditor/qmljsmodelmanager.cpp
index 58f44fb07fc72b5fd409b56ee96eea25c9ad30bd..405f94d1c37b7bd8ce04cd64c277806eecd17970 100644
--- a/src/plugins/qmljseditor/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljseditor/qmljsmodelmanager.cpp
@@ -164,6 +164,16 @@ void ModelManager::fileChangedOnDisk(const QString &path)
                       this, true);
 }
 
+void ModelManager::removeFiles(const QStringList &files)
+{
+    emit aboutToRemoveFiles(files);
+
+    QMutexLocker locker(&m_mutex);
+
+    foreach (const QString &file, files)
+        _snapshot.remove(file);
+}
+
 void ModelManager::emitDocumentChangedOnDisk(Document::Ptr doc)
 { emit documentChangedOnDisk(doc); }
 
diff --git a/src/plugins/qmljseditor/qmljsmodelmanager.h b/src/plugins/qmljseditor/qmljsmodelmanager.h
index 4377731d4eb94e9062157471d48f06363ded2994..0585356109839f3a3e72f6466ece9520ac0307fe 100644
--- a/src/plugins/qmljseditor/qmljsmodelmanager.h
+++ b/src/plugins/qmljseditor/qmljsmodelmanager.h
@@ -57,6 +57,7 @@ public:
     virtual void updateSourceFiles(const QStringList &files,
                                    bool emitDocumentOnDiskChanged);
     virtual void fileChangedOnDisk(const QString &path);
+    virtual void removeFiles(const QStringList &files);
 
     void emitDocumentUpdated(QmlJS::Document::Ptr doc);
     void emitLibraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
@@ -69,7 +70,6 @@ Q_SIGNALS:
     void projectPathChanged(const QString &projectPath);
     void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
 
-
 private Q_SLOTS:
     // this should be executed in the GUI thread.
     void onDocumentUpdated(QmlJS::Document::Ptr doc);
diff --git a/src/plugins/qmljseditor/qmljsmodelmanagerinterface.h b/src/plugins/qmljseditor/qmljsmodelmanagerinterface.h
index 0f502227dc973a3c657d60df89c5710e211e9e2e..a39a7d2e176ea7875f8e8019269d07dce7e9b245 100644
--- a/src/plugins/qmljseditor/qmljsmodelmanagerinterface.h
+++ b/src/plugins/qmljseditor/qmljsmodelmanagerinterface.h
@@ -56,6 +56,7 @@ public:
     virtual void updateSourceFiles(const QStringList &files,
                                    bool emitDocumentOnDiskChanged) = 0;
     virtual void fileChangedOnDisk(const QString &path) = 0;
+    virtual void removeFiles(const QStringList &files) = 0;
 
     virtual void setProjectImportPaths(const QStringList &importPaths) = 0;
     virtual QStringList importPaths() const = 0;
diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
index 0080c629198ea009cefa63b5d5e9c93db7f2f89e..d6a8256a25d3905fdea6ebad281876abf84bc3f2 100644
--- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
@@ -169,8 +169,15 @@ void FileFilterBaseItem::updateFileList()
         newFiles += filesInSubTree(QDir(m_defaultDir), QDir(projectDir), &dirsToBeWatched);
 
     if (newFiles != m_files) {
+        QSet<QString> addedFiles = newFiles;
+        QSet<QString> removedFiles = m_files;
+        QSet<QString> unchanged = newFiles;
+        unchanged.intersect(m_files);
+        addedFiles.subtract(unchanged);
+        removedFiles.subtract(unchanged);
+
         m_files = newFiles;
-        emit filesChanged();
+        emit filesChanged(addedFiles, removedFiles);
     }
 
     // update watched directories
diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h
index 8ded6d75de97d3f68323d83186de53922da53c5a..bcfa22d242173d5f3d9db642bfabdcfc7e0b2cad 100644
--- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h
+++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h
@@ -45,7 +45,7 @@ signals:
     void directoryChanged();
     void recursiveChanged();
     void pathsChanged();
-    void filesChanged();
+    void filesChanged(const QSet<QString> &added, const QSet<QString> &removed);
     void filterChanged();
 
 private slots:
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
index 0be5f30f98cd3d477e5ea050086d653aa6cc6e51..19408dbb091726348fec41b1343738d325b86efb 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
@@ -72,7 +72,8 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
         FileFilterBaseItem *fileFilter = qobject_cast<FileFilterBaseItem*>(contentElement);
         if (fileFilter) {
             fileFilter->setDefaultDirectory(directoryPath);
-            connect(fileFilter, SIGNAL(filesChanged()), this, SIGNAL(qmlFilesChanged()));
+            connect(fileFilter, SIGNAL(filesChanged(QSet<QString>, QSet<QString>)),
+                    this, SIGNAL(qmlFilesChanged(QSet<QString>, QSet<QString>)));
         }
     }
 
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h
index 1271146aaaf5f8f331442a34818fbbbdaf6d02bd..32a2f1df53bb12241a386738dd53382157218b73 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h
@@ -44,7 +44,7 @@ public:
     bool matchesFile(const QString &filePath) const;
 
 signals:
-    void qmlFilesChanged();
+    void qmlFilesChanged(const QSet<QString> &, const QSet<QString> &);
     void sourceDirectoryChanged();
     void importPathsChanged();
 
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 0b2afe68ac096c57ae8f2fb69fdb748a197abee2..0daf385c7bd3b512a6fd5695f5b28a5ea2b4f531 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -94,7 +94,8 @@ void QmlProject::parseProject(RefreshOptions options)
                 if (component->isReady()
                     && qobject_cast<QmlProjectItem*>(component->create())) {
                     m_projectItem = qobject_cast<QmlProjectItem*>(component->create());
-                    connect(m_projectItem.data(), SIGNAL(qmlFilesChanged()), this, SLOT(refreshFiles()));
+                    connect(m_projectItem.data(), SIGNAL(qmlFilesChanged(QSet<QString>, QSet<QString>)),
+                            this, SLOT(refreshFiles(QSet<QString>, QSet<QString>)));
                     connect(m_projectItem.data(), SIGNAL(importPathsChanged()), this, SLOT(refreshImportPaths()));
                     refreshImportPaths();
                 } else {
@@ -121,20 +122,10 @@ void QmlProject::parseProject(RefreshOptions options)
 
 void QmlProject::refresh(RefreshOptions options)
 {
-    const QSet<QString> oldFiles = m_files.toSet();
-
     parseProject(options);
 
     if (options & Files)
         m_rootNode->refresh();
-
-    const QSet<QString> newFiles = m_files.toSet();
-    QStringList removedPaths;
-    foreach (const QString &oldFile, oldFiles)
-        if (!newFiles.contains(oldFile))
-            removedPaths.append(oldFile);
-    if (!removedPaths.isEmpty())
-        emit filesRemovedFromProject(removedPaths);
 }
 
 QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
@@ -188,9 +179,11 @@ void QmlProject::refreshProjectFile()
     refresh(QmlProject::ProjectFile | Files);
 }
 
-void QmlProject::refreshFiles()
+void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString> &removed)
 {
     refresh(Files);
+    if (!removed.isEmpty())
+        m_modelManager->removeFiles(removed.toList());
 }
 
 void QmlProject::refreshImportPaths()
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index bab39524c42bf3801c1ea953e59db856436c270b..132622e27ff9d17d5f071c6cabf11b77790158db 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -101,12 +101,9 @@ public:
 
     bool addFiles(const QStringList &filePaths);
 
-signals:
-    void filesRemovedFromProject(const QStringList removedPaths);
-
 private slots:
     void refreshProjectFile();
-    void refreshFiles();
+    void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
     void refreshImportPaths();
 
 protected:
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp b/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp
index a1d3092bdb9ba20d14f8fa2d33510c8a15197a77..cd8cc19f3ac59a2cd481db73aba5cfcc1e1fd849 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp
@@ -79,14 +79,8 @@ ProjectExplorer::Project *Manager::openProject(const QString &fileName)
         }
     }
 
-    if (fileInfo.isFile()) {
-        QmlProject *project = new QmlProject(this, fileName);
-        QmlTaskManager *taskManager = QmlTaskManager::instance();
-        if (taskManager)
-            connect(project, SIGNAL(filesRemovedFromProject(QStringList)),
-                    taskManager, SLOT(documentsRemoved(const QStringList)));
-        return project;
-    }
+    if (fileInfo.isFile())
+        return new QmlProject(this, fileName);
 
     return 0;
 }
diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
index f58d3ecb5e542a3b6242611cbede3d638e3e6908..144d5d00880f12eef4a2a7dbec5fa271c901307b 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
@@ -103,6 +103,8 @@ void QmlProjectPlugin::extensionsInitialized()
     Q_ASSERT(modelManager);
     connect(modelManager, SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)),
             m_qmlTaskManager, SLOT(documentChangedOnDisk(QmlJS::Document::Ptr)));
+    connect(modelManager, SIGNAL(aboutToRemoveFiles(QStringList)),
+            m_qmlTaskManager, SLOT(documentsRemoved(QStringList)));
 }
 
 } // namespace Internal