lastProjectLocation is not roamable, so, must be moved to RecentProjectsManager

This commit is contained in:
Vladimir Krivosheev
2014-10-17 14:21:19 +02:00
parent b96ba23fc9
commit e4abcd9443
6 changed files with 30 additions and 9 deletions
@@ -93,7 +93,7 @@ public class WizardContext extends UserDataHolderBase {
if (myProjectFileDirectory != null) {
return myProjectFileDirectory;
}
final String lastProjectLocation = GeneralSettings.getInstance().getLastProjectCreationLocation();
final String lastProjectLocation = RecentProjectsManagerBase.getInstance().getLastProjectCreationLocation();
if (lastProjectLocation != null) {
return lastProjectLocation.replace('/', File.separatorChar);
}
@@ -48,7 +48,6 @@ public class GeneralSettings implements NamedJDOMExternalizable, ExportableAppli
private final PropertyChangeSupport myPropertyChangeSupport;
private boolean myUseDefaultBrowser = true;
private boolean myConfirmExtractFiles = true;
private String myLastProjectLocation;
private boolean mySearchInBackground;
private boolean myConfirmExit = true;
private int myConfirmOpenNewProject = OPEN_PROJECT_ASK;
@@ -103,15 +102,21 @@ public class GeneralSettings implements NamedJDOMExternalizable, ExportableAppli
return myBrowserPath;
}
@SuppressWarnings("unused")
@Deprecated
/**
* @return a path pointing to a directory where the last project was created or null if not available
* Use RecentProjectsManagerBase
*/
public String getLastProjectCreationLocation() {
return myLastProjectLocation;
return null;
}
@SuppressWarnings("unused")
@Deprecated
/**
* Use RecentProjectsManagerBase
*/
public void setLastProjectCreationLocation(String lastProjectLocation) {
myLastProjectLocation = lastProjectLocation;
}
public void setBrowserPath(String browserPath) {
@@ -57,6 +57,8 @@ public abstract class RecentProjectsManagerBase implements ProjectManagerListene
public Map<String, String> names = ContainerUtil.newLinkedHashMap();
public String lastPath;
public String lastProjectLocation;
void validateRecentProjects() {
//noinspection StatementWithEmptyBody
while (recentPaths.remove(null)) ;
@@ -126,6 +128,17 @@ public abstract class RecentProjectsManagerBase implements ProjectManagerListene
}
}
/**
* @return a path pointing to a directory where the last project was created or null if not available
*/
public String getLastProjectCreationLocation() {
return myState.lastProjectLocation;
}
public void setLastProjectCreationLocation(String lastProjectLocation) {
myState.lastProjectLocation = lastProjectLocation;
}
public String getLastProjectPath() {
synchronized (myStateLock) {
return myState.lastPath;
@@ -18,6 +18,7 @@ package com.intellij.ide.impl;
import com.intellij.CommonBundle;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.RecentProjectsManagerBase;
import com.intellij.ide.highlighter.ProjectFileType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
@@ -75,7 +76,7 @@ public class ProjectUtil {
LOG.info(e);
return;
}
GeneralSettings.getInstance().setLastProjectCreationLocation(path.replace(File.separatorChar, '/'));
RecentProjectsManagerBase.getInstance().setLastProjectCreationLocation(path.replace(File.separatorChar, '/'));
}
/**
@@ -275,7 +276,7 @@ public class ProjectUtil {
}
public static String getBaseDir() {
final String lastProjectLocation = GeneralSettings.getInstance().getLastProjectCreationLocation();
final String lastProjectLocation = RecentProjectsManagerBase.getInstance().getLastProjectCreationLocation();
if (lastProjectLocation != null) {
return lastProjectLocation.replace('/', File.separatorChar);
}
@@ -16,6 +16,7 @@
package com.intellij.platform;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.RecentProjectsManagerBase;
import com.intellij.idea.ActionsBundle;
import com.intellij.internal.statistic.UsageTrigger;
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
@@ -96,7 +97,7 @@ public class NewDirectoryProjectAction extends AnAction implements DumbAware {
return null;
}
}
GeneralSettings.getInstance().setLastProjectCreationLocation(location.getParent());
RecentProjectsManagerBase.getInstance().setLastProjectCreationLocation(location.getParent());
final Object finalSettings = settings;
return PlatformProjectOpenProcessor.doOpenProject(baseDir, null, false, -1, new ProjectOpenedCallback() {
@Override
@@ -16,6 +16,7 @@
package com.jetbrains.python.newProject.actions;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.RecentProjectsManagerBase;
import com.intellij.ide.util.projectWizard.WebProjectTemplate;
import com.intellij.internal.statistic.UsageTrigger;
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
@@ -133,7 +134,7 @@ public class GenerateProjectCallback implements NullableConsumer<AbstractProject
String generatorName = generator == null ? "empty" : ConvertUsagesUtil.ensureProperKey(generator.getName());
UsageTrigger.trigger("NewDirectoryProjectAction." + generatorName);
GeneralSettings.getInstance().setLastProjectCreationLocation(location.getParent());
RecentProjectsManagerBase.getInstance().setLastProjectCreationLocation(location.getParent());
return PlatformProjectOpenProcessor.doOpenProject(baseDir, null, false, -1, new ProjectOpenedCallback() {
@Override