unchecking "Confirm window to open project in" works (IDEA-60332); some refactoring

This commit is contained in:
Dmitry Jemerov
2010-11-03 19:24:03 +03:00
parent eaf9b562fa
commit c4e12776d5
4 changed files with 10 additions and 3 deletions
@@ -191,7 +191,7 @@ public class NewProjectUtil {
if (openProjects.length > 0) {
final GeneralSettings settings = GeneralSettings.getInstance();
int exitCode = settings.getConfirmOpenNewProject();
if (exitCode < 0) {
if (exitCode == GeneralSettings.OPEN_PROJECT_ASK) {
exitCode = Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.new.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe")}, 1, 0,
Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
@@ -490,6 +490,10 @@ public class GeneralSettings implements NamedJDOMExternalizable, ExportableAppli
myConfirmOpenNewProject = confirmOpenNewProject;
}
public static final int OPEN_PROJECT_ASK = -1;
public static final int OPEN_PROJECT_NEW_WINDOW = 0;
public static final int OPEN_PROJECT_SAME_WINDOW = 1;
public boolean isSearchInBackground() {
return mySearchInBackground;
}
@@ -51,7 +51,10 @@ public class GeneralSettingsConfigurable extends CompositeConfigurable<Searchabl
settings.setSaveOnFrameDeactivation(myComponent.myChkSaveOnFrameDeactivation.isSelected());
settings.setConfirmExit(myComponent.myConfirmExit.isSelected());
if (myComponent.myConfirmFrameToOpenCheckBox.isSelected()) {
settings.setConfirmOpenNewProject(-1);
settings.setConfirmOpenNewProject(GeneralSettings.OPEN_PROJECT_ASK);
}
else if (settings.getConfirmOpenNewProject() == GeneralSettings.OPEN_PROJECT_ASK) {
settings.setConfirmOpenNewProject(GeneralSettings.OPEN_PROJECT_NEW_WINDOW);
}
// AutoSave in inactive
settings.setAutoSaveIfInactive(myComponent.myChkAutoSaveIfInactive.isSelected());
@@ -183,7 +183,7 @@ public class ProjectUtil {
public static int confirmOpenNewProject() {
final GeneralSettings settings = GeneralSettings.getInstance();
if (settings.getConfirmOpenNewProject() < 0) {
if (settings.getConfirmOpenNewProject() == GeneralSettings.OPEN_PROJECT_ASK) {
return Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe"),
CommonBundle.getCancelButtonText()}, 1, 0, Messages.getQuestionIcon(),