Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
302,400
void (@NotNull PsiElement context, @NotNull String message) { myHost.addMessage(context, message, Validator.ValidationHost.ErrorType.ERROR); }
onMessage
302,401
ErrorHandler (XmlDocument doc, Validator.ValidationHost host) { final XmlTag rootTag = doc.getRootTag(); if (rootTag == null) { return null; } return new MyErrorHandler(doc, host); }
create
302,402
void (XmlFile file) { final XmlFile schema = getRngSchema(file); if (schema == null) return; final VirtualFile instanceFile = file.getVirtualFile(); final VirtualFile schemaFile = schema.getVirtualFile(); if (instanceFile == null || schemaFile == null) { return; } doRun(file.getProject(), instanceFile, schemaFile); }
doValidate
302,403
boolean (XmlFile file) { return getRngSchema(file) != null; }
isAvailable
302,404
XmlFile (XmlFile file) { final RngElementDescriptor descriptor = getRootDescriptor(file); if (descriptor == null) return null; final PsiElement element = descriptor.getDeclaration(); final XmlFile schema = PsiTreeUtil.getParentOfType(element, XmlFile.class); if (schema == null) return null; return schema; }
getRngSchema
302,405
RngElementDescriptor (PsiFile file) { try { if (file instanceof XmlFile) { final XmlElementDescriptor descriptor = ((XmlFile)file).getDocument().getRootTag().getDescriptor(); if (descriptor instanceof RngElementDescriptor) { return (RngElementDescriptor)descriptor; } } } catch (NullPointerException e1) { // OK } return...
getRootDescriptor
302,406
void (final Project project, final VirtualFile instanceFile, final VirtualFile schemaFile) { saveFiles(instanceFile, schemaFile); final MessageViewHelper helper = new MessageViewHelper( project, RelaxngBundle.message("relaxng.message-viewer.tab-title.validate-relax-ng"), KEY); helper.openMessageView(() -> doRun(project...
doRun
302,407
void () { future.cancel(true); }
stopProcess
302,408
boolean () { return future.isDone(); }
isProcessStopped
302,409
void (VirtualFile instanceFile, VirtualFile schemaFile, org.xml.sax.ErrorHandler eh) { final SchemaReader sr = FileTypeRegistry.getInstance().isFileOfType(schemaFile, RncFileType.getInstance()) ? CompactSchemaReader.getInstance() : new AutoSchemaReader(); final PropertyMapBuilder properties = new PropertyMapBuilder(); ...
doValidation
302,410
void (VirtualFile... files) { // ensure the validation/conversion runs on the current content final FileDocumentManager mgr = FileDocumentManager.getInstance(); for (VirtualFile f : files) { final Document document = mgr.getDocument(f); if (document != null) { mgr.saveDocument(document); } } }
saveFiles
302,411
void () { ContentManagerUtil.cleanupContents(null, myProject, myContentName); }
close
302,412
void () { CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand(myProject, () -> { MessageView messageView = MessageView.getInstance(myProject); Content content = ContentFactory.getInstance().createContent(myErrorsView.getComponent(), myContentName, true); content.putUserDa...
openMessageViewImpl
302,413
void () { }
stopProcess
302,414
boolean () { return true; }
isProcessStopped
302,415
void (@NotNull ContentManagerEvent event) { if (event.getContent() == myContent) { if (myErrorsView.canControlProcess()) { myErrorsView.stopProcess(); } myErrorsView = null; Objects.requireNonNull(myContent.getManager()).removeContentManagerListener(this); myContent.release(); myContent = null; } }
contentRemoved
302,416
void (@NotNull ContentManagerEvent event) { if (event.getContent() == myContent && myErrorsView != null && myErrorsView.canControlProcess() && !myErrorsView.isProcessStopped()) { if (!MessageDialogBuilder.yesNo(RelaxngBundle.message("relaxng.message-viewer.warning.message", myContentName), RelaxngBundle.message("relaxn...
contentRemoveQuery
302,417
void (@NotNull ContentManagerEvent event) { final Content eventContent = event.getContent(); if (!eventContent.equals(myContent)) { return; } myMessageView.getContentManager().removeContentManagerListener(this); NewErrorTreeViewPanel errorTreeView = eventContent.getUserData(myKey); if (errorTreeView != null) { Disposer...
contentRemoved
302,418
void (SAXParseException e) { myHadErrorOrWarning = true; processError(e, true); }
warning
302,419
void (SAXParseException e) { myHadErrorOrWarning = true; processError(e, false); }
error
302,420
void (SAXParseException e) { myHadErrorOrWarning = true; processError(e, false); }
fatalError
302,421
boolean () { return myHadErrorOrWarning; }
hadErrorOrWarning
302,422
void (@NotNull AnActionEvent e) { final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); final Project project = e.getData(CommonDataKeys.PROJECT); if (files != null && project != null) { final SchemaType type = getInputType(project, files); e.getPresentation().setEnabled(type != null); if (type == S...
update
302,423
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
302,424
SchemaType (Project project, VirtualFile... files) { if (files.length == 0) return null; final VirtualFile file = files[0]; final FileType type = file.getFileType(); if (type == XmlFileType.INSTANCE) { final PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile instanceof XmlFile) { final XmlDoc...
getInputType
302,425
void (@NotNull AnActionEvent e) { final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); final Project project = e.getData(CommonDataKeys.PROJECT); if (file != null && project != null) { final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); assert files != null; final SchemaType type = get...
actionPerformed
302,426
JComponent () { return myRoot; }
getRoot
302,427
void (Map<String, ?> inputOptions) { myDisableAbstractElements.setSelected(inputOptions.get(DISABLE_ABSTRACT_ELEMENTS) == Boolean.TRUE); final Object o = inputOptions.get(ANY_PROCESS_CONTENTS); if (o != null) { myAnyProcessContents.setSelectedItem(o); } final Object o2 = inputOptions.get(ANY_ATTRIBUTE_PROCESS_CONTENTS)...
setOptions
302,428
void (@NotNull DocumentEvent e) { myPropertyChangeSupport.firePropertyChange(OUTPUT_PATH, null, getOutputDestination()); }
textChanged
302,429
void (ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { final SchemaType type = getOutputType(); myPropertyChangeSupport.firePropertyChange(OUTPUT_TYPE, null, type); myLineLength.setEnabled(type == SchemaType.DTD || type == SchemaType.RNC); } }
itemStateChanged
302,430
SchemaType () { if (myOutputRng.isSelected()) { return SchemaType.RNG; } else if (myOutputRnc.isSelected()) { return SchemaType.RNC; } else if (myOutputXsd.isSelected()) { return SchemaType.XSD; } else { assert myOutputDtd.isSelected(); return SchemaType.DTD; } }
getOutputType
302,431
String () { return (String)myEncoding.getSelectedItem(); }
getOutputEncoding
302,432
int () { return parseInt(myIndent.getText().trim()); }
getIndent
302,433
int (String s) { try { return s.length() > 0 ? Integer.parseInt(s) : -1; } catch (NumberFormatException e) { return -1; } }
parseInt
302,434
int () { return parseInt(myLineLength.getText()); }
getLineLength
302,435
String () { return myOutputDestination.getText(); }
getOutputDestination
302,436
void (List<? super String> inputParams, List<? super String> outputParams) { setParams(myInputOptions, inputParams); if (getOutputType() == SchemaType.XSD) { setParams(myOutputOptions, outputParams); } }
addAdvancedSettings
302,437
void (Map<String, ?> map, List<? super String> inputParams) { final Set<String> set = map.keySet(); for (String s : set) { final Object value = map.get(s); if (value == Boolean.TRUE) { inputParams.add(s); } else if (value == Boolean.FALSE) { inputParams.add("no-" + s); } else if (value != null) { inputParams.add(s + "=...
setParams
302,438
JComponent () { return myRoot; }
getRoot
302,439
JComponent () { return myOutputDestination; }
getPreferredFocusedComponent
302,440
void (String name, PropertyChangeListener listener) { myPropertyChangeSupport.addPropertyChangeListener(name, listener); }
addPropertyChangeListener
302,441
void () { final AdvancedOptionsDialog dialog = new AdvancedOptionsDialog(myProject, myInputType, getOutputType()); dialog.setOptions(myInputOptions, myOutputOptions); if (dialog.showAndGet()) { myInputOptions = dialog.getInputOptions(); myOutputOptions = dialog.getOutputOptions(); } }
showAdvancedSettings
302,442
boolean () { return getOutputType() == SchemaType.XSD || myInputType == SchemaType.DTD; }
hasAdvancedSettings
302,443
void (SAXParseException e) { myMessageViewHelper.processError(e, true); }
warning
302,444
void (SAXParseException e) { myMessageViewHelper.processError(e, false); }
error
302,445
void (SAXParseException e) { myMessageViewHelper.processError(e, false); }
fatalError
302,446
void (SchemaType inputType, IdeaErrorHandler errorHandler, VirtualFile... inputFiles) { if (inputFiles.length == 0) { throw new IllegalArgumentException(); } try { final InputFormat inFormat = getInputFormat(inputType); if (inputFiles.length > 1) { if (!(inFormat instanceof MultiInputFormat)) { throw new IllegalArgumen...
convert
302,447
OutputFormat (SchemaType outputType) { return switch (outputType) { case DTD -> new DtdOutputFormat(); case RNC -> new RncOutputFormat(); case RNG -> new RngOutputFormat(); case XSD -> new XsdOutputFormat(); default -> { assert false : "Unsupported output type: " + outputType; yield null; } }; }
getOutputFormat
302,448
InputFormat (SchemaType type) { return switch (type) { case DTD -> new DtdInputFormat(); case RNC -> new CompactParseInputFormat(); case RNG -> new SAXParseInputFormat(); case XML -> new XmlInputFormat(); default -> { assert false : "Unsupported input type: " + type; yield null; } }; }
getInputFormat
302,449
JComponent () { JComponent root; if (myInputOptions != null && myOutputOptions != null) { root = new JBTabbedPane(); ((JTabbedPane)root).addTab(CommonBundle.message("title.input"), myInputOptions.getRoot()); ((JTabbedPane)root).addTab(CommonBundle.message("title.output"), myOutputOptions.getRoot()); } else if (myInputO...
createCenterPanel
302,450
void (Map<String, ?> inputOptions, Map<String, ?> outputOptions) { if (myInputOptions != null) { myInputOptions.setOptions(inputOptions); } else { myInputOptions_ = inputOptions; } if (myOutputOptions != null) { myOutputOptions.setOptions(outputOptions); } else { myOutputOptions_ = outputOptions; } }
setOptions
302,451
void (ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { myAttlistDefine.setEnabled(false); } else { myAttlistDefine.setEnabled(true); } }
itemStateChanged
302,452
void (@NotNull AnActionEvent e) { if (myNamespaceMap.getModel().getRowCount() == 0 || myNamespaceMap.getSelectedRow() == -1) { e.getPresentation().setEnabled(false); } else { e.getPresentation().setEnabled(true); } }
update
302,453
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
302,454
void (@NotNull AnActionEvent e) { ((NamespaceMapModel)myNamespaceMap.getModel()).removeRow(myNamespaceMap.getSelectedRow()); }
actionPerformed
302,455
JComponent () { return myRoot; }
getRoot
302,456
void (HashMap<String, Object> map, String option, JTextField field) { final String colonReplacement = field.getText(); if (colonReplacement != null && colonReplacement.trim().length() > 0) { map.put(option, colonReplacement); } }
setText
302,457
void (Map<String, ?> inputOptions) { if (inputOptions.containsKey(COLON_REPLACEMENT)) { myColonReplacement.setText((String)inputOptions.get(COLON_REPLACEMENT)); } myInlineAttlistCheckBox.setSelected(inputOptions.get(INLINE_ATTLIST) == Boolean.TRUE); if (inputOptions.containsKey(ELEMENT_DEFINE)) { myElementDefine.setTex...
setOptions
302,458
void (@NotNull PsiElement element) { if (element instanceof XmlElementDecl) { final String s = ((XmlElementDecl)element).getName(); if (s != null) { final String[] parts = s.split(":"); if (parts.length > 1) { map.put(XMLNS + ":" + parts[0], null); } } } else if (element instanceof XmlAttributeDecl) { final String s = ...
visitElement
302,459
String (int column) { return column == 0 ? RelaxngBundle.message("prefix") : "URI"; //NON-NLS }
getColumnName
302,460
int () { return myList.size(); }
getRowCount
302,461
int () { return 2; }
getColumnCount
302,462
boolean (int rowIndex, int columnIndex) { return columnIndex == 1; }
isCellEditable
302,463
void (Object aValue, int rowIndex, int columnIndex) { myList.get(rowIndex)[columnIndex] = (String)aValue; }
setValueAt
302,464
Object (int rowIndex, int columnIndex) { return myList.get(rowIndex)[columnIndex]; }
getValueAt
302,465
void (String prefix, String uri) { myList.add(new String[]{ prefix, uri }); fireTableRowsInserted(myList.size() - 1, myList.size() - 1); }
addMapping
302,466
void (int row) { myList.remove(row); fireTableRowsDeleted(row - 1, row - 1); }
removeRow
302,467
List<String[]> () { return myList; }
getData
302,468
void (ActionEvent e) { mySettings.showAdvancedSettings(); }
actionPerformed
302,469
JComponent () { return mySettings.getPreferredFocusedComponent(); }
getPreferredFocusedComponent
302,470
JComponent () { return mySettings.getRoot(); }
createCenterPanel
302,471
ConvertSchemaSettings () { return mySettings; }
getSettings
302,472
void (PropertyChangeEvent evt) { if (ConvertSchemaSettingsImpl.OUTPUT_TYPE.equals(evt.getPropertyName())) { myAdvancedAction.setEnabled(mySettings.hasAdvancedSettings()); } else if (ConvertSchemaSettingsImpl.OUTPUT_PATH.equals(evt.getPropertyName())) { getOKAction().setEnabled(((String)evt.getNewValue()).trim().length(...
propertyChange
302,473
void (CommonElement pattern) { }
visitElement
302,474
void (Pattern pattern) { visitElement(pattern); }
visitPattern
302,475
void (Grammar pattern) { visitElement(pattern); }
visitGrammar
302,476
void (Define<?, ?> define) { visitElement(define); }
visitDefine
302,477
void (Ref ref) { visitElement(ref); }
visitRef
302,478
void (Div div) { visitElement(div); }
visitDiv
302,479
void (Include inc) { visitElement(inc); }
visitInclude
302,480
XmlElementDescriptor (XmlTag childTag) { final List<DElementPattern> patterns = new ArrayList<>(); for (DElementPattern pattern : myPatterns) { patterns.addAll(ChildElementFinder.find(2, pattern)); } // TODO: filter out impossible variants: /* while this needs both variants of <choice>-children <element><choice><caret>...
findElementDescriptor
302,481
XmlElementDescriptor[] (XmlTag context) { final Set<XmlElementDescriptor> descriptors = new LinkedHashSet<>(Arrays.asList(super.getElementsDescriptors(context))); for (DElementPattern pattern : myPatterns) { final List<DElementPattern> list = ChildElementFinder.find(2, pattern); descriptors.addAll(Arrays.asList(myNsDes...
getElementsDescriptors
302,482
XmlAttributeDescriptor (String namespace, String localName) { final QName qname = new QName(namespace, localName); return computeAttributeDescriptor(AttributeFinder.find(qname, myPatterns)); }
getAttributeDescriptor
302,483
XmlAttributeDescriptor[] (@Nullable XmlTag context) { return computeAttributeDescriptors(AttributeFinder.find(myPatterns)); }
collectAttributeDescriptors
302,484
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; final CompositeDescriptor that = (CompositeDescriptor)o; if (!Arrays.equals(myPatterns, that.myPatterns)) return false; return true; }
equals
302,485
int () { int result = super.hashCode(); result = 31 * result + Arrays.hashCode(myPatterns); return result; }
hashCode
302,486
DElementPattern[] () { return myPatterns; }
getElementPatterns
302,487
XmlElementDescriptor (@NotNull XmlTag tag) { if (myPattern == null) { return null; } XmlTag _tag = tag; final LinkedList<XmlTag> chain = new LinkedList<>(); while (_tag != null) { chain.addFirst(_tag); _tag = _tag.getParentTag(); } XmlElementDescriptor desc; do { desc = findRootDescriptor(chain.removeFirst()); } while ...
getElementDescriptor
302,488
XmlElementDescriptor (final XmlTag tag) { return getElementDescriptor(tag.getLocalName(), tag.getNamespace()); }
findRootDescriptor
302,489
XmlElementDescriptor (QName qName) { XmlElementDescriptor descriptor = findDescriptor(qName, ContainerUtil.findAll(ChildElementFinder.find(-1, myPattern), NamedPatternFilter.INSTANCE)); return descriptor != null ? descriptor : findDescriptor(qName, ChildElementFinder.find(myPattern)); }
findRootDescriptorInner
302,490
XmlElementDescriptor (XmlTag tag, List<? extends DElementPattern> list) { final QName qName = new QName(tag.getNamespace(), tag.getLocalName()); return findDescriptor(qName, list); }
findDescriptor
302,491
XmlElementDescriptor (final QName qName, List<? extends DElementPattern> list) { int max = -1; DElementPattern maxPattern = null; for (DElementPattern pattern : list) { final NameClass nameClass = pattern.getName(); if (nameClass.contains(qName)) { final int spec = nameClass.containsSpecificity(qName); if (spec > max) ...
findDescriptor
302,492
XmlElementDescriptor (@NotNull XmlElementDescriptor descriptor) { return descriptor; }
initDescriptor
302,493
XmlFile () { return myFile; }
getDescriptorFile
302,494
String (PsiElement context) { return getName(); }
getName
302,495
String () { return getDescriptorFile().getName(); }
getName
302,496
void (@NotNull PsiElement context, @NotNull final ValidationHost host) { final XmlDocument doc = PsiTreeUtil.getContextOfType(context, XmlDocument.class, false); if (doc == null) { return; } final XmlTag rootTag = doc.getRootTag(); if (rootTag == null) { return; } // RNG XML itself is validated by parsing it with Jing,...
validate
302,497
XmlElementDescriptor (String localName, String namespace) { final QName qName = new QName(namespace, localName); CachedValue<XmlElementDescriptor> cachedValue = myDescriptorsMap.get(qName); if (cachedValue == null) { cachedValue = CachedValuesManager.getManager(myElement.getProject()).createCachedValue(() -> { final Xm...
getElementDescriptor
302,498
Void (DRefPattern p) { if (myDepth < myTargetDepth || myTargetDepth == -1) { return super.onRef(p); } return null; }
onRef
302,499
Void (DElementPattern p) { myDepth++; try { if (myDepth == myTargetDepth || myTargetDepth == -1) { myRoots.add(p); return myTargetDepth != -1 ? null : super.onElement(p); } else { return super.onElement(p); } } finally { myDepth--; } }
onElement