IDEA-124394 Exception while creating New File w/o extension

This commit is contained in:
peter
2014-04-28 14:29:51 +02:00
parent 933194da2c
commit 9929113aed
2 changed files with 5 additions and 7 deletions
@@ -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));
}
@@ -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;
}