mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-119826 Do not require confirmation each time I open an IPR file
CPP-7665 Cannot open *.cmake/CMakeLists.txt using File | Open - project is opened instead
This commit is contained in:
@@ -17,6 +17,7 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.highlighter.ProjectFileType;
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -90,10 +91,23 @@ public class OpenFileAction extends AnAction implements DumbAware {
|
||||
|
||||
// try to open as a project - unless the file is an .ipr of the current one
|
||||
if ((project == null || !file.equals(project.getProjectFile())) && OpenProjectFileChooserDescriptor.isProjectFile(file)) {
|
||||
Project openedProject = ProjectUtil.openOrImport(file.getPath(), project, false);
|
||||
if (openedProject != null) {
|
||||
FileChooserUtil.setLastOpenedFile(openedProject, file);
|
||||
return;
|
||||
int answer = file.getFileType() instanceof ProjectFileType
|
||||
? Messages.YES
|
||||
: Messages.showYesNoCancelDialog(project,
|
||||
IdeBundle.message("message.open.file.is.project", file.getName()),
|
||||
IdeBundle.message("title.open.project"),
|
||||
IdeBundle.message("message.open.file.is.project.open.as.project"),
|
||||
IdeBundle.message("message.open.file.is.project.open.as.file"),
|
||||
IdeBundle.message("button.cancel"),
|
||||
Messages.getQuestionIcon());
|
||||
if (answer == Messages.CANCEL) return;
|
||||
|
||||
if (answer == Messages.YES) {
|
||||
Project openedProject = ProjectUtil.openOrImport(file.getPath(), project, false);
|
||||
if (openedProject != null) {
|
||||
FileChooserUtil.setLastOpenedFile(openedProject, file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -427,6 +427,9 @@ title.popup.new.element.same.place=New in This Directory
|
||||
command.go.to.next.split=Go to next split
|
||||
message.occurrence.N.of.M=Occurrence {0} of {1}
|
||||
error.dir.contains.no.project=''{0}'' does not contain a project
|
||||
message.open.file.is.project={0} is a project file.\nWould you like to open this project?
|
||||
message.open.file.is.project.open.as.project=Open as &Project
|
||||
message.open.file.is.project.open.as.file=Open as &File
|
||||
error.files.of.this.type.cannot.be.opened=Files of this type cannot be opened in {0}
|
||||
title.cannot.open.file=Cannot Open File
|
||||
title.cannot.open.project=Cannot Open Project
|
||||
|
||||
Reference in New Issue
Block a user