Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
301,800
Set<String> () { final TreeSet<String> result = new TreeSet<>(); result.add("*/*"); // IANA Media Types: http://www.iana.org/assignments/media-types/media-types.xhtml readMediaTypes(result, "application"); readMediaTypes(result, "audio"); readMediaTypes(result, "image"); readMediaTypes(result, "message"); readMediaTypes(result, "model"); readMediaTypes(result, "multipart"); readMediaTypes(result, "text"); readMediaTypes(result, "video"); return result; }
loadContentTypes
301,801
void (TreeSet<? super String> result, final String category) { final InputStream stream = MimeTypeDictionary.class.getResourceAsStream("mimeTypes/" + category + ".csv"); String csv = ""; try { csv = stream != null ? FileUtil.loadTextAndClose(stream) : ""; } catch (IOException e) { Logger.getInstance(MimeTypeDictionary.class).error(e); } final String[] lines = StringUtil.splitByLines(csv); for (String line : lines) { if (Strings.areSameInstance(line, lines[0])) continue; final String[] split = line.split(","); if (split.length > 1) { result.add(!split[1].isEmpty() ? split[1] : withCategory(category, split[0])); } } }
readMediaTypes
301,802
String (String category, String name) { final int whitespacePosition = name.indexOf(' '); return category + "/" + (whitespacePosition > 0 ? name.substring(0, whitespacePosition) : name); }
withCategory
301,803
boolean (String key) { return INSTANCE.containsKey(key); }
hasKey
301,804
String () { return "completion"; }
getTestDataPath
301,805
void () { doTestCompletion("element-completion-root.xml", "?xml version=\"1.0\" encoding=\"\" ?>", "bar", "baz", "completion-1", "completion-2", "completion-3", "foo", "x"); }
testElementCompletionRoot
301,806
void () { doTestCompletion("element-completion-1.xml", new String[]{ "foo" }); }
testElementCompletion1
301,807
void () { doTestCompletion("element-completion-2.xml", "foo", "bar", "baz"); }
testElementCompletion2
301,808
void () { final WebEditorOptions options = WebEditorOptions.getInstance(); final boolean oldValue = options.isAutomaticallyInsertRequiredAttributes(); try { options.setAutomaticallyInsertRequiredAttributes(false); doTestCompletion("element-completion-3", "xml"); } finally { options.setAutomaticallyInsertRequiredAttributes(oldValue); } }
testElementCompletion3
301,809
String () { return "completion"; }
getTestDataPath
301,810
void () { myTestFixture.testCompletionTyping("html5_1.xml", "\n", "html5_1_after.xml"); }
testHtml5_1
301,811
void () { doTestCompletion("html5_2"); }
testHtml5_2
301,812
void () { doTestCompletion("html5_3"); }
testHtml5_3
301,813
void () { doTestCompletion("html5_4"); }
testHtml5_4
301,814
void () { doTestCompletion("html5_5"); }
testHtml5_5
301,815
void () { doTestCompletion("html5_6"); }
testHtml5_6
301,816
void () { doTestCompletion("html5_7"); }
testHtml5_7
301,817
void () { doTestCompletion("html5_8"); }
testHtml5_8
301,818
void () { doTestCompletion("html5_9"); }
testHtml5_9
301,819
void () { doTestCompletion("html5_10"); }
testHtml5_10
301,820
void () { myTestFixture.testCompletionTyping("/html5_11.xml", "\n", "/html5_11_after.xml"); }
testHtml5_11
301,821
void () { doTestCompletion("html5_12"); }
testHtml5_12
301,822
void () { myTestFixture.testCompletionTyping("/html5_13.xml", "\n", "/html5_13_after.xml"); }
testHtml5_13
301,823
void () { doTestCompletion("html5_14"); }
testHtml5_14
301,824
void () { myTestFixture.testCompletionTyping("/html5_15.xml", "\n", "/html5_15_after.xml"); }
testHtml5_15
301,825
void () { myTestFixture.testCompletionTyping("html5_16.xml", "\n", "html5_16_after.xml"); }
testHtml5_16
301,826
void () { myTestFixture.testCompletionTyping("html5_overwritten_attributes.xml", "a\n", "html5_overwritten_attributes_after.xml"); }
testHtml5_overwritten_attributes
301,827
void () { doTest(true); }
testExternal
301,828
void () { doTest(true); }
testMain
301,829
void () { doTest(true); }
testElements
301,830
void () { doTest(true); }
testProperties
301,831
void () { doTest(true); }
testDatatype
301,832
void () { doTest(true); }
testRelaxNG
301,833
void () { doTest(true); }
testDocbook
301,834
String () { return "highlighting/rnc"; }
getTestDataPath
301,835
void () { doHighlightingTest("backward-include-ref.rnc"); }
testBackwardIncludeRef
301,836
void () { doHighlightingTest("unused-define.rnc"); }
testInspectionUnusedDefine
301,837
void () { doHighlightingTest("suppressed-unused-define.rnc"); }
testInspectionSuppressedUnusedDefine
301,838
void () { doHighlightingTest("used-define.rnc"); }
testInspectionUsedDefine
301,839
void () { myTestFixture.configureByFiles("include1.rnc", "include1_1.rnc", "include1_2.rnc"); doCustomHighlighting(true, false); }
testInclude1
301,840
CodeInsightTestFixture (@NotNull IdeaTestFixtureFactory factory) { return createContentFixture(factory); }
createFixture
301,841
String () { return "rename/rnc"; }
getTestDataPath
301,842
void () { doTestRename("rename-definition-1", "bar"); }
testRenameDefinition1
301,843
void () { doTestRename("rename-definition-2", "element"); }
testRenameDefinition2
301,844
void () { doTestRename("rename-definition-3", "bar"); }
testRenameDefinition3
301,845
void () { doTestRename("rename-ns-prefix-1", "bar"); }
testRenameNsPrefix1
301,846
void () { doTestRename("rename-datatype-prefix-1", "bar"); }
testRenameDatatypePrefix1
301,847
void () { myTestFixture.copyFileToProject("rename-in-include-ref.rnc"); final Project project = myTestFixture.getProject(); final RefactoringFactory factory = RefactoringFactory.getInstance(project); String fullPath = myTestFixture.getTempDirPath() + "/" + "rename-in-include-ref.rnc"; final VirtualFile copy = LocalFileSystem.getInstance().refreshAndFindFileByPath(fullPath.replace(File.separatorChar, '/')); assert copy != null : "file " + fullPath + " not found"; final PsiFile file = PsiManager.getInstance(project).findFile(copy); assertNotNull(file); myTestFixture.configureByFile("rename-in-include.rnc"); final RenameRefactoring refactoring = factory.createRename(file, "rename-after.rnc"); refactoring.setPreviewUsages(false); refactoring.setSearchInComments(false); refactoring.setSearchInNonJavaFiles(true); refactoring.run(); myTestFixture.checkResultByFile("rename-in-include_after.rnc"); assertEquals("rename-after.rnc", file.getName()); }
testRenameIncludedFile
301,848
void (String name, String newName) { doTestRename(name, "rnc", newName); }
doTestRename
301,849
String () { return "completion/rnc"; }
getTestDataPath
301,850
void () { doTestCompletion("complete-keyword-1", "rnc"); }
testCompleteKeyword1
301,851
void () { doTestCompletion("complete-keyword-2", "rnc"); }
testCompleteKeyword2
301,852
void () { doTestCompletion("complete-ref-1", "rnc"); }
testCompleteRef1
301,853
void () { doTestCompletion("complete-ref-2", "rnc"); }
testCompleteRef2
301,854
void () { doTestCompletion("complete-ref-3", "rnc"); }
testCompleteRef3
301,855
void () { doTestCompletion("complete-ref-4", "rnc"); }
testCompleteRef4
301,856
String () { return PlatformTestUtil.getCommunityPath() + "/xml/relaxng/testData/parsing"; }
getTestDataPath
301,857
String (String relativeTestDataPath) { return FileUtil.toSystemDependentName(getTestDataBasePath() + relativeTestDataPath); }
toAbsolutePath
301,858
String () { return PlatformTestUtil.getCommunityPath() + "/xml/relaxng/testData/"; }
getTestDataBasePath
301,859
CodeInsightTestFixture (@NotNull IdeaTestFixtureFactory factory) { final TestFixtureBuilder<IdeaProjectTestFixture> builder = factory.createLightFixtureBuilder(getTestName(false)); final IdeaProjectTestFixture fixture = builder.getFixture(); return factory.createCodeInsightFixture(fixture); }
createFixture
301,860
CodeInsightTestFixture (IdeaTestFixtureFactory factory) { TestFixtureBuilder<IdeaProjectTestFixture> builder = factory.createFixtureBuilder(getName()); EmptyModuleFixtureBuilder<?> moduleBuilder = builder.addModule(EmptyModuleFixtureBuilder.class); IdeaProjectTestFixture fixture = builder.getFixture(); CodeInsightTestFixture testFixture = factory.createCodeInsightFixture(fixture); moduleBuilder.addContentRoot(testFixture.getTempDirPath()); moduleBuilder.addSourceRoot("/"); return testFixture; }
createContentFixture
301,861
CodeInsightTestFixture () { return myTestFixture; }
getFixture
301,862
void () { ExternalResourceManagerEx.getInstanceEx().addIgnoredResources(Collections.singletonList("urn:test:undefined"), getTestRootDisposable()); }
init
301,863
void (String s) { doCustomHighlighting(s, true, false); // myTestFixture.testHighlighting(true, false, true, s); }
doHighlightingTest
301,864
void (String name) { doCustomHighlighting(name, true, true); }
doExternalToolHighlighting
301,865
void (String name, final boolean checkWeakWarnings, final Boolean includeExternalToolPass) { myTestFixture.configureByFile(name); doCustomHighlighting(checkWeakWarnings, includeExternalToolPass); }
doCustomHighlighting
301,866
void (boolean checkWeakWarnings, Boolean includeExternalToolPass) { final PsiFile file = myTestFixture.getFile(); final Document doc = myTestFixture.getEditor().getDocument(); ExpectedHighlightingData data = new ExpectedHighlightingData(doc, true, checkWeakWarnings, false); data.init(); PsiDocumentManager.getInstance(myTestFixture.getProject()).commitAllDocuments(); Collection<HighlightInfo> highlights1 = doHighlighting(includeExternalToolPass); data.checkResult(file, highlights1, doc.getText()); }
doCustomHighlighting
301,867
Collection<HighlightInfo> (final Boolean externalToolPass) { final Project project = myTestFixture.getProject(); PsiDocumentManager.getInstance(project).commitAllDocuments(); final Editor editor = myTestFixture.getEditor(); int[] ignore = externalToolPass == null || externalToolPass ? new int[]{ Pass.LINE_MARKERS, Pass.LOCAL_INSPECTIONS, Pass.SLOW_LINE_MARKERS, Pass.POPUP_HINTS, Pass.UPDATE_ALL, Pass.UPDATE_FOLDING, } : new int[]{Pass.EXTERNAL_TOOLS}; return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false); }
doHighlighting
301,868
void (String name, String ext) { myTestFixture.testCompletion(name + "." + ext, name + "_after." + ext); }
doTestCompletion
301,869
void (String before, String... variants) { myTestFixture.testCompletionVariants(before, variants); }
doTestCompletion
301,870
void (String before) { doTestCompletion(before, "xml"); }
doTestCompletion
301,871
void (String name, String ext, String newName) { myTestFixture.testRename(name + "." + ext, name + "_after." + ext, newName); }
doTestRename
301,872
void (String file, String ext) { final PsiReference psiReference = myTestFixture.getReferenceAtCaretPositionWithAssertion(file + "." + ext); assertNull("Reference", psiReference.resolve()); assertTrue(psiReference.getClass().getName() + " is not a QuickFixProvider", psiReference instanceof LocalQuickFixProvider); final LocalQuickFix[] fixes = ((LocalQuickFixProvider)psiReference).getQuickFixes(); assertTrue("One action expected", fixes != null && fixes.length == 1); final Project project = myTestFixture.getProject(); final ProblemDescriptor problemDescriptor = InspectionManager.getInstance(project).createProblemDescriptor(psiReference.getElement(), "Foo", fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true); WriteCommandAction.writeCommandAction(project, myTestFixture.getFile()).run(() -> fixes[0].applyFix(project, problemDescriptor)); myTestFixture.checkResultByFile(file + "_after." + ext); }
doTestQuickFix
301,873
String () { return "parsing"; }
getTestDataPath
301,874
void () { doTestHighlighting("simple.rnc"); }
testParseSimple
301,875
void () { doTestHighlighting("escaped.rnc"); }
testParseEscaped
301,876
void () { doTestHighlighting("escaped-broken-1.rnc"); }
testParseEscapedBroken1
301,877
void () { doTestHighlighting("escaped-broken-2.rnc"); }
testParseEscapedBroken2
301,878
void () { doTestHighlighting("escaped-broken-3.rnc"); }
testParseEscapedBroken3
301,879
void () { doTestHighlighting("escaped-broken-4.rnc"); }
testParseEscapedBroken4
301,880
void () { doTestHighlighting("escaped-broken-5.rnc"); }
testParseEscapedBroken5
301,881
void (String s) { doExternalToolHighlighting(s); }
doTestHighlighting
301,882
String () { return "highlighting/rnc"; }
getTestDataPath
301,883
void () { doHighlightingTest("ref-3.rnc"); }
testRef3
301,884
void () { doHighlightingTest("undefined-ref.rnc"); }
testUndefinedRef
301,885
void () { doTestQuickFix("create-definition-1", "rnc"); }
testCreateDefintion1
301,886
void () { doTestQuickFix("create-definition-2", "rnc"); }
testCreateDefintion2
301,887
void () { doHighlightingTest("ns-prefix.rnc"); }
testNsPrefix
301,888
void () { doHighlightingTest("ns-prefix-keyword.rnc"); }
testNsPrefixKeyword
301,889
void () { doHighlightingTest("unresolved-ns-prefix-1.rnc"); }
testUnresolvedNsPrefix1
301,890
void () { doHighlightingTest("unresolved-ns-prefix-2.rnc"); }
testUnresolvedNsPrefix2
301,891
void () { doHighlightingTest("unresolved-ns-prefix-3.rnc"); }
testUnresolvedNsPrefix3
301,892
void () { doTestQuickFix("create-ns-prefix-1", "rnc"); }
testCreateNsPrefix
301,893
void () { doHighlightingTest("datatype-prefix.rnc"); }
testDatatypePrefix
301,894
void () { doHighlightingTest("unresolved-datatype-prefix-1.rnc"); }
testUnresolvedDatatypePrefix1
301,895
void () { doHighlightingTest("unresolved-datatype-prefix-2.rnc"); }
testUnresolvedDatatypePrefix2
301,896
void () { doTestQuickFix("create-datatypes-prefix-1", "rnc"); }
testCreateDatatypesPrefix
301,897
void () { doHighlightingTest("unresolved-include.rnc"); }
testUnresolvedInclude
301,898
void () { doHighlightingTest("unresolved-external.rnc"); }
testUnresolvedExternal
301,899
void () { doHighlightingTest("parent-ref.rnc"); }
testParentRef