CPP-8004 Set CLion's project name from CMake's ${PROJECT_NAME}: also update cached names in RecentProjectsManagerBase.state (used in File | Open Recent...)

This commit is contained in:
Anton Makeev
2016-12-12 17:02:57 +01:00
parent e7fbb6d8fe
commit f3144c51dd
2 changed files with 10 additions and 4 deletions
@@ -520,9 +520,7 @@ public abstract class RecentProjectsManagerBase extends RecentProjectsManager im
@Override
public void projectClosing(Project project) {
synchronized (myStateLock) {
myState.names.put(getProjectPath(project), getProjectDisplayName(project));
}
updateProjectName(project);
}
@Override
@@ -538,6 +536,13 @@ public abstract class RecentProjectsManagerBase extends RecentProjectsManager im
}
}
public void updateProjectName(Project project) {
synchronized (myStateLock) {
myState.names.put(getProjectPath(project), getProjectDisplayName(project));
}
clearNameCache();
}
@NotNull
public String getProjectName(@NotNull String path) {
String cached = myNameCache.get(path);
@@ -16,6 +16,7 @@
package com.intellij.openapi.project.impl;
import com.intellij.ide.RecentProjectsManager;
import com.intellij.ide.RecentProjectsManagerBase;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.startup.StartupManagerEx;
import com.intellij.openapi.application.ApplicationManager;
@@ -134,7 +135,7 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project
public void setProjectName(@NotNull String projectName) {
if (!projectName.equals(myName)) {
myName = projectName;
RecentProjectsManager.getInstance().clearNameCache();
((RecentProjectsManagerBase)RecentProjectsManager.getInstance()).updateProjectName(this);
StartupManager.getInstance(this).runWhenProjectIsInitialized((DumbAwareRunnable)() -> {
if (isDisposed()) return;