summaryrefslogtreecommitdiff
path: root/src/plugins/qmljstools
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-07-07 09:18:40 +0200
committerEike Ziller <eike.ziller@digia.com>2014-07-07 09:19:03 +0200
commit62aea4728f6200e5e1659cc4c185e1e1bf3e50ed (patch)
tree9c580c4c310e953c7f88ca08a5da93081a1e1c09 /src/plugins/qmljstools
parent45fa5f9ccb67f01596e919b2e6e7b0275dc19362 (diff)
parentb435f7bfe83dd5c2eec05a06c7233e5098e78f8c (diff)
downloadqt-creator-62aea4728f6200e5e1659cc4c185e1e1bf3e50ed.tar.gz
Merge remote-tracking branch 'origin/3.2'
Change-Id: I05f76a4f5134c4edd91a79b757bcce9d6e7c258b
Diffstat (limited to 'src/plugins/qmljstools')
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp10
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.h3
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.cpp2
3 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index da51a627ac..3c5a53806d 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -222,6 +222,8 @@ void ModelManager::delayedInitialization()
connect(ProjectExplorer::SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(removeProjectInfo(ProjectExplorer::Project*)));
+ connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
+ SLOT(updateDefaultProjectInfo()));
QmlJS::ViewerContext qbsVContext;
qbsVContext.language = Language::QmlQbs;
@@ -257,13 +259,15 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
return workingCopy;
}
-ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfo() const
+void ModelManager::updateDefaultProjectInfo()
{
- // needs to be performed in the ui therad (change?)
+ // needs to be performed in the ui therad
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectExplorerPlugin::currentProject();
- return defaultProjectInfoForProject(currentProject);
+ ProjectInfo newDefaultProjectInfo = defaultProjectInfoForProject(currentProject);
+ setDefaultProject(projectInfo(currentProject,newDefaultProjectInfo), currentProject);
}
+
// Check whether fileMimeType is the same or extends knownMimeType
bool ModelManager::matchesMimeType(const MimeType &fileMimeType, const MimeType &knownMimeType)
{
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h
index 2b8233a66f..efc8de8bb5 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.h
+++ b/src/plugins/qmljstools/qmljsmodelmanager.h
@@ -70,9 +70,10 @@ public:
protected:
QHash<QString, QmlJS::Language::Enum> languageForSuffix() const QTC_OVERRIDE;
void writeMessageInternal(const QString &msg) const QTC_OVERRIDE;
- ModelManagerInterface::ProjectInfo defaultProjectInfo() const QTC_OVERRIDE;
WorkingCopy workingCopyInternal() const QTC_OVERRIDE;
void addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const QTC_OVERRIDE;
+private slots:
+ void updateDefaultProjectInfo();
private:
void loadDefaultQmlTypeDescriptions();
static bool matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType);
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
index f5a73ef060..4ef9bb2206 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
@@ -124,7 +124,7 @@ QmlJSRefactoringFile::QmlJSRefactoringFile(const QString &fileName, const QShare
: RefactoringFile(fileName, data)
{
// the RefactoringFile is invalid if its not for a file with qml or js code
- if (ModelManagerInterface::guessLanguageOfFile(fileName) == Language::Unknown)
+ if (ModelManagerInterface::guessLanguageOfFile(fileName) == Language::NoLanguage)
m_fileName.clear();
}