mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-124394 Exception while creating New File w/o extension
This commit is contained in:
@@ -170,12 +170,7 @@ public class CreateFileAction extends CreateElementActionBase implements DumbAwa
|
||||
|
||||
final PsiDirectory psiDirectory = getDirectory();
|
||||
|
||||
final FileType type = FileTypeChooser.getKnownFileTypeOrAssociate(new FakeVirtualFile(psiDirectory.getVirtualFile(), getFileName(inputString)) {
|
||||
@Override
|
||||
public boolean isDirectory() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
final FileType type = FileTypeChooser.getKnownFileTypeOrAssociate(new FakeVirtualFile(psiDirectory.getVirtualFile(), getFileName(inputString)),
|
||||
psiDirectory.getProject());
|
||||
return type != null && super.canClose(getFileName(inputString));
|
||||
}
|
||||
|
||||
+4
-1
@@ -44,6 +44,7 @@ import com.intellij.openapi.vfs.newvfs.FileAttribute;
|
||||
import com.intellij.openapi.vfs.newvfs.FileSystemInterface;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.StubVirtualFile;
|
||||
import com.intellij.psi.SingleRootFileViewProvider;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.util.*;
|
||||
@@ -407,7 +408,9 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
|
||||
fileType = getFileTypeByFileName(file.getNameSequence());
|
||||
if (fileType != UnknownFileType.INSTANCE) return fileType;
|
||||
|
||||
fileType = getOrDetectFromContent(file);
|
||||
if (!(file instanceof StubVirtualFile)) {
|
||||
fileType = getOrDetectFromContent(file);
|
||||
}
|
||||
|
||||
return fileType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user