Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
301,200
void () { myFixture.configureByFile("spring-beans_3.0.xsd"); doTest("springAtCaret.xml", "bean"); }
testSpringAtCaret
301,201
void () { myFixture.configureByFile("spring-beans_3.0.xsd"); doTest("springAfterBean.xml", "bean"); }
testSpringAfterBean
301,202
void () { myFixture.configureByFile("spring-beans_3.0.xsd"); doTest("springAlias.xml", "alias"); }
testSpringAlias
301,203
void () { doTest("initParam.xml", "context-param"); }
testInitParam
301,204
void () { doTest("try_to_generate_in_tag_name.xml", "context-param"); }
testInTagName
301,205
void (String file, String tagName) { GenerateXmlTagAction.TEST_THREAD_LOCAL.set(tagName); CodeInsightTestUtil.doActionTest(new GenerateXmlTagAction(), file, myFixture); }
doTest
301,206
String () { return "/xml/tests/testData/generateTag"; }
getBasePath
301,207
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + getBasePath(); }
getTestDataPath
301,208
void () { myFixture.copyDirectoryToProject("", ""); Project project = getProject(); Collection<String> tags = XmlTagNamesIndex.getAllTagNames(project); assertTrue(tags.size() > 26); Collection<VirtualFile> files = XmlTagNamesIndex.getFilesByTagName("bean", project); assertEquals(1, files.size()); Module module = Module...
testTagNameIndex
301,209
void () { myFixture.copyDirectoryToProject("", ""); final List<IndexedRelevantResource<String, XsdNamespaceBuilder>> files = XmlNamespaceIndex.getResourcesByNamespace(NS, getProject(), getModule()); assertEquals(2, files.size()); IndexedRelevantResource<String, XsdNamespaceBuilder> resource = XmlNamespaceIndex.guessSch...
testNamespaceIndex
301,210
void () { myFixture.copyDirectoryToProject("", ""); final List<IndexedRelevantResource<String, XsdNamespaceBuilder>> files = XmlNamespaceIndex.getResourcesByNamespace("foo.dtd", getProject(), getModule()); assertEquals(2, files.size()); PsiFile file = myFixture.configureByFile("foo.xml"); assertTrue(XmlNamespaceIndex.g...
testGuessDTD
301,211
void () { myFixture.copyDirectoryToProject("", ""); String namespace = "http://www.liquibase.org/xml/ns/dbchangelog"; List<IndexedRelevantResource<String, XsdNamespaceBuilder>> resources = XmlNamespaceIndex.getResourcesByNamespace(namespace, getProject(), getModule()); assertEquals(2, resources.size()); assertEquals("d...
testGuessByLocation
301,212
String () { return "/xml/tests/testData/index"; }
getBasePath
301,213
void () { myFixture.copyDirectoryToProject("", ""); final Project project = getProject(); final List<Set<SchemaTypeInfo>> childrenOfType = SchemaTypeInheritanceIndex.getWorker(project, null).apply("http://a.b.c", "baseSimpleType"); Assert.assertNotNull(childrenOfType); final Set<SchemaTypeInfo> expected = new HashSet<>...
testIndex
301,214
String () { return "/xml/tests/testData/index"; }
getBasePath
301,215
boolean () { return true; }
isCommunity
301,216
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root xmlns:ns="http://ns.com" attr2="value2" attr1="value1" attr3="value3"/>"""); map.put("expected", """ <root attr1="value1" attr2="value2" attr3="value3" xmlns:ns="http://ns.com"/>"""); map.put("rules", new ArrayList<...
testAttributeSorting1
301,217
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr3="value3" attr2="value2" attr1="value1" xmlns:ns="http://ns.com"/>"""); map.put("expected", """ <root attr1="value1" attr2="value2" attr3="value3" xmlns:ns="http://ns.com"/>"""); map.put("rules", new ArrayList<...
testAttributeSorting2
301,218
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" attr2="value2" attr1="value1"> <tag1 attr2="value2" attr1="value1"> <tag2 attr1="value1" attr2="value2"/> <tag3 attr2="value2" attr1="value1" xmlns:ns3="http://n...
testAttributeSorting3
301,219
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr3="value3" attr2="value2" attr1="value1" xmlns:ns="http://ns.com"/>"""); map.put("expected", """ <root xmlns:ns="http://ns.com" attr1="value1" attr2="value2" attr3="value3"/>"""); map.put("rules", new ArrayList<...
testAttributeSorting4
301,220
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr1="value1" ns1:attr2="value2" xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" ns1:attr1="value1"> <tag1 ns2:attr2="value2" attr2="value2" attr1="value1" ns2:attr1="value1" ns1:attr2="value2" ns1:attr1="val...
testAttributeSortingByNamespace1
301,221
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr1="value1" ns1:attr2="value2" xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" ns1:attr1="value1"> <tag1 ns2:attr2="value2" attr2="value2" attr1="value1" ns2:attr1="value1" ns1:attr2="value2" ns1:attr1="val...
testAttributeSortingByNamespace2
301,222
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr1="value1" ns1:attr2="value2" xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" ns1:attr1="value1"> <tag1 ns2:attr2="value2" attr2="value2" attr1="value1" ns2:attr1="value1" ns1:attr2="value2" ns1:attr1="val...
testAttributeSortingByNamespace3
301,223
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr1="value1" ns1:attr2="value2" xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" ns1:attr1="value1"> <tag1 ns2:attr2="value2" attr2="value2" attr1="value1" ns2:attr1="value1" ns1:attr2="value2" ns1:attr1="val...
testAttributeSortingByNamespace4
301,224
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr1="value1" ns1:attr2="value2" xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" ns1:attr1="value1"> <tag1 ns2:attr2="value2" attr2="value2" attr1="value1" ns2:attr1="value1" ns1:attr2="value2" ns1:attr1="val...
testAttributeSortingByNamespace5
301,225
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root attr1="value1" ns1:attr2="value2" xmlns:ns1="http://ns1.com" xmlns:ns2="http://ns2.com" ns1:attr1="value1"> <tag1 ns2:attr2="value2" attr2="value2" attr1="value1" ns2:attr1="value1" ns1:attr2="value2" ns1:attr1="val...
testAttributeSortingByNamespace6
301,226
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root> <meta></meta> <title></title> </root> """); map.put("expected", """ <root> <title></title> <meta></meta> </root> """); map.put("rules", new ArrayList<>( Arrays.asList(ruleWithOrder(BY_NAME, nameRule("title"))))); d...
testTagSorting
301,227
void () { LinkedHashMap<String, Serializable> map = new LinkedHashMap<>(3); map.put("initial", """ <root beta=""> <meta></meta> <title></title> </root> """); map.put("expected", """ <root beta=""> <title></title> <meta></meta> </root> """); map.put("rules", new ArrayList<>( Arrays.asList(ruleWithOrder(BY_NAME, nameRule...
testTagAndAttrSorting
301,228
StdArrangementMatchRule (@NotNull String filter) { return new StdArrangementMatchRule( new StdArrangementEntryMatcher(new ArrangementAtomMatchCondition(StdArrangementTokens.Regexp.XML_NAMESPACE, filter))); }
namespaceRule
301,229
StdArrangementMatchRule (@NotNull String nameFilter, @NotNull String namespaceFilter) { return AbstractRearrangerTest.rule(new ArrangementAtomMatchCondition(StdArrangementTokens.Regexp.NAME, nameFilter), new ArrangementAtomMatchCondition(StdArrangementTokens.Regexp.XML_NAMESPACE, namespaceFilter)); }
compositeRule
301,230
boolean () { return ENABLED && super.shouldRunTest(); }
shouldRunTest
301,231
void () { PropertyChecker.checkScenarios(actionsOnXmlFiles(CheckHighlighterConsistency.randomEditsWithHighlighterChecks)); }
testIncrementalHighlighterUpdate
301,232
void () { PropertyChecker.checkScenarios(actionsOnXmlFiles(MadTestingUtil::randomEditsWithReparseChecks)); }
testReparse
301,233
Supplier<MadTestingAction> (Function<? super PsiFile, ? extends Generator<? extends MadTestingAction>> fileActions) { return MadTestingUtil.actionsOnFileContents(myFixture, PathManager.getHomePath(), f -> FileTypeManager.getInstance().getFileTypeByFileName(f.getName()) == XmlFileType.INSTANCE, fileActions); }
actionsOnXmlFiles
301,234
String (String[] args) { var flags = new HashSet<String>(); var opts = new HashSet<String>(); flags.add("h"); flags.add("help"); flags.add("usage"); flags.add("license"); flags.add("version"); flags.add("dl"); flags.add("noupa"); flags.add("nopvr"); flags.add("partial"); opts.add("name"); CommandLine cl = new CommandLi...
generate
301,235
XmlElementDescriptor (XmlTag tag, String elementName) { final PsiMetaData metaData = tag.getMetaData(); if (metaData instanceof XmlNSDescriptorImpl nsDescriptor) { return nsDescriptor.getElementDescriptor(elementName, nsDescriptor.getDefaultNamespace()); } return null; }
getDescriptor
301,236
List<String> (XmlTag rootTag) { PsiMetaData metaData = rootTag.getMetaData(); if (metaData instanceof XmlNSDescriptorImpl nsDescriptor) { List<String> elementDescriptors = new ArrayList<>(); XmlElementDescriptor[] rootElementsDescriptors = nsDescriptor.getRootElementsDescriptors(PsiTreeUtil.getParentOfType(rootTag, Xml...
addVariantsFromRootTag
301,237
String (@NotNull XmlFile file, @NotNull final Map<String, String> scannedToFileName, final @NotNull SchemaReferenceProcessor schemaReferenceProcessor) { final String fileName = file.getName(); String previous = scannedToFileName.get(fileName); if (previous != null) return previous; scannedToFileName.put(fileName, fileN...
processAndSaveAllSchemas
301,238
void (@NotNull PsiElement psiElement) { super.visitElement(psiElement); if (psiElement instanceof LeafPsiElement) { final String text = psiElement.getText(); result.append(text); } }
visitElement
301,239
void (@NotNull XmlAttribute xmlAttribute) { boolean replaced = false; if (xmlAttribute.isNamespaceDeclaration()) { replaced = true; final String value = xmlAttribute.getValue(); result.append(xmlAttribute.getText()).append(" "); if (!scannedToFileName.containsKey(value)) { final XmlNSDescriptor nsDescriptor = xmlAttrib...
visitXmlAttribute
301,240
CodeInsightActionHandler () { return new CodeInsightActionHandler(){ @Override public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final XmlDocument document = findSuitableXmlDocument(file); if (document != null) { final @NonNls StringBuilder buffer = new StringBuilder(); buffe...
getHandler
301,241
void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final XmlDocument document = findSuitableXmlDocument(file); if (document != null) { final @NonNls StringBuilder buffer = new StringBuilder(); buffer.append("<!DOCTYPE ").append(document.getRootTag().getName()).append(" [\n"); buffer.append...
invoke
301,242
void (@NotNull AnActionEvent event) { super.update(event); if (ActionPlaces.isPopupPlace(event.getPlace())) { Presentation presentation = event.getPresentation(); presentation.setVisible(presentation.isEnabled()); } }
update
301,243
boolean (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { return file.getLanguage() == XMLLanguage.INSTANCE && findSuitableXmlDocument(file) != null; }
isValidForFile
301,244
String (String filename) { File f = new File(filename); if (! f.exists()) return filename; int dot = filename.lastIndexOf('.'); // we believe file has some ext. For instance, ".wsdl" String name = filename.substring(0, dot); String ext = filename.substring(dot); int num = 0; do { f = new File(name + ++num + ext); } whi...
findFreeFileName
301,245
void () { String msg = doValidateWithData(); setOKActionEnabled(msg == null); status.setText(msg == null ? "" : msg); status.setForeground(JBColor.RED); }
validateData
301,246
void (JComboBox combo, List<String> lastValues) { combo.setModel(new DefaultComboBoxModel(ArrayUtilRt.toStringArray(lastValues))); if (combo.getItemCount() != 0) { combo.setSelectedIndex(0); combo.getEditor().selectAll(); } }
configureComboBox
301,247
void (@NlsSafe String url) { generateFromUrl.setText(url); }
setFileUrl
301,248
void () { super.doOKAction(); if (myOkAction != null) { myOkAction.run(); } }
doOKAction
301,249
void (Runnable okAction) { myOkAction = okAction; }
setOkAction
301,250
void (JLabel textComponent, JComponent component) { textComponent.setLabelFor(component); if (component instanceof JTextField) { ((JTextField)component).getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { validateData(); } @Override public void removeUpdate(D...
doInitFor
301,251
void (DocumentEvent e) { validateData(); }
insertUpdate
301,252
void (DocumentEvent e) { validateData(); }
removeUpdate
301,253
void (DocumentEvent e) { validateData(); }
changedUpdate
301,254
void (ActionEvent e) { validateData(); }
actionPerformed
301,255
void (KeyEvent e) { validateData(); }
keyTyped
301,256
JLabel () { return generateFromUrlText; }
getUrlText
301,257
JLabel () { return statusText; }
getStatusTextField
301,258
JLabel () { return status; }
getStatusField
301,259
JComponent () { return panel; }
createCenterPanel
301,260
String () { return resultSchemaFileName.getText(); }
getTargetSchemaName
301,261
String () { if (! new File(generateFromUrl.getText()).exists()) { return XmlBundle.message("instance.document.file.is.not.exist"); } if (!generateFromUrl.getText().endsWith(".xml")) { return XmlBundle.message("instance.document.file.should.have.xml.extension"); } try { int i = Integer.parseInt(getEnumerationsLimit()); ...
doValidateWithData
301,262
String () { return "webservices.GenerateSchemaFromInstanceDocument"; }
getHelpId
301,263
String () { return XmlBundle.message("local.elements.global.complex.types.option.name"); }
getLocalElementsGlobalComplexTypes
301,264
String () { return XmlBundle.message("local.elements.types.option.name"); }
getLocalElementsTypes
301,265
String () { return XmlBundle.message("global.elements.local.types.option.name"); }
getGlobalElementsLocalTypes
301,266
void (@NotNull AnActionEvent e) { final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); final boolean enabled = isAcceptableFile(file); e.getPresentation().setEnabled(enabled); if (ActionPlaces.isPopupPlace(e.getPlace())) { e.getPresentation().setVisible(enabled); } }
update
301,267
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
301,268
void (@NotNull AnActionEvent e) { final Project project = e.getProject(); final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); final GenerateSchemaFromInstanceDocumentDialog dialog = new GenerateSchemaFromInstanceDocumentDialog(project, file); dialog.setOkAction(() -> doAction(project, dialog)); dialog.show...
actionPerformed
301,269
void (final Project project, final GenerateSchemaFromInstanceDocumentDialog dialog) { FileDocumentManager.getInstance().saveAllDocuments(); final String url = dialog.getUrl().getText(); final VirtualFile relativeFile = VfsUtilCore.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(url), null); V...
doAction
301,270
void (int status) { throw new SecurityException(); }
checkExit
301,271
void (Permission perm) { }
checkPermission
301,272
boolean (VirtualFile file) { return file != null && "xml".equalsIgnoreCase(file.getExtension()); }
isAcceptableFile
301,273
ValidateXmlHandler (final @NotNull PsiFile file) { for (ValidateXmlHandler handler : ValidateXmlHandler.EP_NAME.getExtensionList()) { if (handler.isAvailable((XmlFile)file)) { return handler; } } ValidateXmlActionHandler handler = new ValidateXmlActionHandler(true); handler.setErrorReporter(new StdErrorReporter(handler...
getHandler
301,274
void (@NotNull AnActionEvent e) { final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE); if (psiFile != null && psiFile.getVirtualFile() != null) { doRunAction(psiFile); } }
actionPerformed
301,275
void (final @NotNull PsiFile psiFile) { CommandProcessor.getInstance().executeCommand( psiFile.getProject(), () -> { final Runnable action = () -> { try { psiFile.putUserData(runningValidationKey, ""); PsiDocumentManager.getInstance(psiFile.getProject()).commitAllDocuments(); getHandler(psiFile).doValidate((XmlFile)psi...
doRunAction
301,276
void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); PsiElement psiElement = event.getData(CommonDataKeys.PSI_FILE); boolean visible = psiElement instanceof XmlFile; presentation.setVisible(visible); boolean enabled = psiElement instanceof XmlFile; if (enabled) { final PsiFile cont...
update
301,277
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
301,278
void (JLabel textComponent, JComponent component) { textComponent.setLabelFor(component); if (component instanceof JTextField) { ((JTextField)component).getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { validateData(); } @Override public void removeUpdate(D...
doInitFor
301,279
void (DocumentEvent e) { validateData(); }
insertUpdate
301,280
void (DocumentEvent e) { validateData(); }
removeUpdate
301,281
void (DocumentEvent e) { validateData(); }
changedUpdate
301,282
void (ActionEvent e) { validateData(); }
actionPerformed
301,283
void (DocumentEvent e) { validateData(); }
insertUpdate
301,284
void (DocumentEvent e) { validateData(); }
removeUpdate
301,285
void (DocumentEvent e) { validateData(); }
changedUpdate
301,286
void (KeyEvent e) { validateData(); }
keyTyped
301,287
void () { String msg = doValidateWithData(); setOKActionEnabled(msg == null); status.setText(msg == null ? "" : msg); status.setForeground(JBColor.RED); }
validateData
301,288
void (JComboBox combo, List<String> lastValues) { // without -editor.selectAll- no focus combo.setModel(new DefaultComboBoxModel(ArrayUtilRt.toStringArray(lastValues))); }
configureComboBox
301,289
void () { String uri = generateFromUrl.getText(); boolean hasPrevious = (previousUri != null && previousUri.equals(uri)); final PsiFile psifile = findFile(uri); List<String> myRootValues; if (psifile == null) { configureComboBox(rootElementChooser, Collections.emptyList()); return; } final XmlTag rootTag = getRootTag(p...
updateFile
301,290
XmlTag (PsiFile psifile) { XmlFile xmlFile = null; if (psifile instanceof XmlFile) { xmlFile = (XmlFile)psifile; } else if (psifile.getViewProvider() instanceof TemplateLanguageFileViewProvider viewProvider) { if (viewProvider.getPsi(viewProvider.getTemplateDataLanguage()) instanceof XmlFile) { xmlFile = (XmlFile)viewP...
getRootTag
301,291
PsiFile (String uri) { final VirtualFile file = uri != null ? VfsUtilCore.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(uri), null) : null; return file != null ? PsiManager.getInstance(myProject).findFile(file) : null; }
findFile
301,292
String () { return outputFileName.getText(); }
getOutputFileName
301,293
Boolean () { updateFile(); return rootElementChooser.getSelectedItem() != null; }
areCurrentParametersStillValid
301,294
String () { String rootElementName = getElementName(); if (rootElementName == null || rootElementName.isEmpty()) { return XmlBundle.message("schema2.instance.no.valid.root.element.name.validation.error"); } final PsiFile psiFile = findFile(getUrl().getText()); if (psiFile instanceof XmlFile) { final XmlTag tag = getRoo...
doValidateWithData
301,295
boolean (VirtualFile virtualFile) { return GenerateInstanceDocumentFromSchemaAction.isAcceptableFileForGenerateSchemaFromInstanceDocument(virtualFile); }
isAcceptableFile
301,296
JLabel () { return generateFromUrlText; }
getUrlText
301,297
JLabel () { return statusText; }
getStatusTextField
301,298
JLabel () { return status; }
getStatusField
301,299
JComponent () { return panel; }
createCenterPanel