boolean (@NotNull JavaScratchConfiguration configuration, @NotNull ConfigurationContext context, @NotNull Ref<PsiElement> sourceElement) { final Location location = context.getLocation(); if (location != null) { final VirtualFile vFile = location.getVirtualFile(); if (vFile != null && ScratchUtil.isScratch(vFile)) { final PsiFile psiFile = location.getPsiElement().getContainingFile(); if (psiFile != null && psiFile.getLanguage() == JavaLanguage.INSTANCE) { configuration.setScratchFileUrl(vFile.getUrl()); return super.setupConfigurationFromContext(configuration, context, sourceElement); } } } return false; }