mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use remembered value of "open in new window" also when opening a new project; rename option (IDEA-58404)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
package com.intellij.ide.impl;
|
||||
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.util.newProjectWizard.AddModuleWizard;
|
||||
import com.intellij.ide.util.projectWizard.ProjectBuilder;
|
||||
@@ -188,13 +189,16 @@ public class NewProjectUtil {
|
||||
public static void closePreviousProject(final Project projectToClose) {
|
||||
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
if (openProjects.length > 0) {
|
||||
int 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());
|
||||
final GeneralSettings settings = GeneralSettings.getInstance();
|
||||
int exitCode = settings.getConfirmOpenNewProject();
|
||||
if (exitCode < 0) {
|
||||
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());
|
||||
}
|
||||
if (exitCode == 1) { // "No" option
|
||||
ProjectUtil.closeProject(projectToClose != null ? projectToClose : openProjects[openProjects.length - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</constraints>
|
||||
<properties>
|
||||
<margin top="2" left="0" bottom="2" right="2"/>
|
||||
<text value="Confirm frame to open project in"/>
|
||||
<text value="Confirm window to open project in"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
|
||||
@@ -150,16 +150,7 @@ public class ProjectUtil {
|
||||
}
|
||||
|
||||
if (!forceOpenInNewFrame && openProjects.length > 0) {
|
||||
final GeneralSettings settings = GeneralSettings.getInstance();
|
||||
int exitCode;
|
||||
if (settings.getConfirmOpenNewProject() < 0) {
|
||||
exitCode = 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(),
|
||||
new ProjectNewWindowDoNotAskOption());
|
||||
} else {
|
||||
exitCode = settings.getConfirmOpenNewProject();
|
||||
}
|
||||
int exitCode = confirmOpenNewProject();
|
||||
if (exitCode == 1) { // "No" option
|
||||
if (!closeProject(projectToClose != null ? projectToClose : openProjects[openProjects.length - 1])) return null;
|
||||
}
|
||||
@@ -190,6 +181,18 @@ public class ProjectUtil {
|
||||
return project;
|
||||
}
|
||||
|
||||
public static int confirmOpenNewProject() {
|
||||
final GeneralSettings settings = GeneralSettings.getInstance();
|
||||
if (settings.getConfirmOpenNewProject() < 0) {
|
||||
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(),
|
||||
new ProjectNewWindowDoNotAskOption());
|
||||
} else {
|
||||
return settings.getConfirmOpenNewProject();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isSameProject(String path, Project p) {
|
||||
final IProjectStore projectStore = ((ProjectEx)p).getStateStore();
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
*/
|
||||
package com.intellij.platform;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.impl.ProjectNewWindowDoNotAskOption;
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -29,7 +25,6 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.project.impl.ProjectManagerImpl;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
@@ -78,17 +73,7 @@ public class PlatformProjectOpenProcessor extends ProjectOpenProcessor {
|
||||
|
||||
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
if (!forceOpenInNewFrame && openProjects.length > 0) {
|
||||
final GeneralSettings settings = GeneralSettings.getInstance();
|
||||
int exitCode;
|
||||
if (settings.getConfirmOpenNewProject() < 0) {
|
||||
exitCode = 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(),
|
||||
new ProjectNewWindowDoNotAskOption());
|
||||
}
|
||||
else {
|
||||
exitCode = settings.getConfirmOpenNewProject();
|
||||
}
|
||||
int exitCode = ProjectUtil.confirmOpenNewProject();
|
||||
if (exitCode == 1) { // "No" option
|
||||
if (!ProjectUtil.closeProject(projectToClose != null ? projectToClose : openProjects[openProjects.length - 1])) return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user