ios: fix refactoring (adding to qrc) in the common case

Task-number:QTCREATORBUG-11548
Change-Id: I6224b8745bf87981f5b305328294437cc51a7e7f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Fawzi Mohamed
2014-04-02 03:17:41 +02:00
parent 2326cf7d96
commit 0c68cbbaa9

View File

@@ -40,6 +40,9 @@
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljsutils.h>
#include <qmljstools/qmljsrefactoringchanges.h>
#include <projectexplorer/session.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/project.h>
#include <QCoreApplication>
#include <QDir>
@@ -108,6 +111,16 @@ public:
if (!refactoring.createFile(newFileName, txt))
return;
if (path == QFileInfo(fileName()).path()) {
// hack for the common case, next version should use the wizard
ProjectExplorer::Node * oldFileNode = ProjectExplorer::SessionManager::nodeForFile(fileName());
if (oldFileNode) {
ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode();
if (containingFolder)
containingFolder->addFiles(QStringList(newFileName));
}
}
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(path);
if (versionControl
&& versionControl->supportsOperation(Core::IVersionControl::AddOperation)) {