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 null; }
|
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, instanceFile, schemaFile)); final Future<?> future = ApplicationManager.getApplication().executeOnPooledThread( () -> ApplicationManager.getApplication().runReadAction(() -> { final MessageViewHelper.ErrorHandler eh = helper.new ErrorHandler(); doValidation(instanceFile, schemaFile, eh); SwingUtilities.invokeLater( () -> { if (!eh.hadErrorOrWarning()) { SwingUtilities.invokeLater( () -> { helper.close(); WindowManager.getInstance().getStatusBar(project).setInfo( XmlBundle.message("xml.validate.no.errors.detected.status.message")); } ); } } ); })); helper.setProcessController(new NewErrorTreeViewPanel.ProcessController() { @Override public void stopProcess() { future.cancel(true); } @Override public boolean isProcessStopped() { return future.isDone(); } }); }
|
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(); ValidateProperty.ERROR_HANDLER.put(properties, eh); // TODO: should some options dialog displayed before validating? RngProperty.CHECK_ID_IDREF.add(properties); try { final String schemaPath = VfsUtilCore.fixIDEAUrl(schemaFile.getUrl()); try { final ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), sr); final InputSource in = ValidationDriver.uriOrFileInputSource(schemaPath); in.setEncoding(schemaFile.getCharset().name()); if (driver.loadSchema(in)) { final String path = VfsUtilCore.fixIDEAUrl(instanceFile.getUrl()); try { driver.validate(ValidationDriver.uriOrFileInputSource(path)); } catch (IOException e1) { eh.fatalError(new SAXParseException(e1.getMessage(), null, UriOrFile.fileToUri(path), -1, -1, e1)); } } } catch (SAXParseException e1) { eh.fatalError(e1); } catch (IOException e1) { eh.fatalError(new SAXParseException(e1.getMessage(), null, UriOrFile.fileToUri(schemaPath), -1, -1, e1)); } } catch (SAXException | MalformedURLException e1) { // huh? Logger.getInstance(RngValidateHandler.class.getName()).error(e1); } }
|
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.putUserData(myKey, myErrorsView); messageView.getContentManager().addContent(content); messageView.getContentManager().setSelectedContent(content); messageView.getContentManager().addContentManagerListener(new CloseListener(content, myContentName, myErrorsView)); ContentManagerUtil.cleanupContents(content, myProject, myContentName); messageView.getContentManager().addContentManagerListener(new MyContentDisposer(content, messageView, myKey)); }, ExecutionBundle.message("open.message.view"), null); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null); }
|
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("relaxng.message-viewer.warning.title", myContentName)) .ask(myErrorsView)) { event.consume(); } } }
|
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.dispose(errorTreeView); } eventContent.putUserData(myKey, null); }
|
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 == SchemaType.XML) { e.getPresentation().setText(RelaxngBundle.message("relaxng.convert-schema.action.title.xml-files", files.length)); } else { e.getPresentation().setText(RelaxngBundle.message("relaxng.convert-schema.action.title.non-xml")); } } else { e.getPresentation().setEnabled(false); } }
|
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 XmlDocument document = ((XmlFile)psiFile).getDocument(); if (document != null && document.getRootTag() != null) { final XmlTag rootTag = document.getRootTag(); assert rootTag != null; final String uri = rootTag.getNamespace(); if (RelaxNgMetaDataContributor.RNG_NAMESPACE.equals(uri) && files.length == 1) { return SchemaType.RNG; } } } if (files.length > 1) { for (VirtualFile virtualFile : files) { if (!FileTypeRegistry.getInstance().isFileOfType(virtualFile, XmlFileType.INSTANCE) || getInputType(project, virtualFile) != null) { return null; } } } return SchemaType.XML; } else if (type == DTDFileType.INSTANCE && files.length == 1) { return SchemaType.DTD; } else if (type == RncFileType.getInstance() && files.length == 1) { return SchemaType.RNC; } return null; }
|
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 = getInputType(project, files); final ConvertSchemaDialog dialog = new ConvertSchemaDialog(project, type, file); if (!dialog.showAndGet()) { return; } RngValidateHandler.saveFiles(files); final ConvertSchemaSettings settings = dialog.getSettings(); final IdeaErrorHandler errorHandler = new IdeaErrorHandler(project); new IdeaDriver(settings, project).convert(type, errorHandler, files); final VirtualFile output = LocalFileSystem.getInstance().findFileByIoFile(new File(settings.getOutputDestination())); if (output != null) { output.refresh(false, true); } } }
|
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); if (o2 != null) { myAnyAttributeProcessContents.setSelectedItem(o2); } }
|
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 + "=" + value); } } }
|
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 IllegalArgumentException(); } } final VirtualFile inputFile = inputFiles[0]; final SchemaType type = settings.getOutputType(); final String outputType = StringUtil.toLowerCase(type.toString()); final ArrayList<String> inputParams = new ArrayList<>(); if (inputType != SchemaType.DTD) { final Charset charset = inputFile.getCharset(); inputParams.add("encoding=" + charset.name()); } final ArrayList<String> outputParams = new ArrayList<>(); settings.addAdvancedSettings(inputParams, outputParams); // System.out.println("INPUT: " + inputParams); // System.out.println("OUTPUT: " + outputParams); final SchemaCollection sc; final String input = inputFile.getPath(); final String uri = UriOrFile.toUri(input); try { if (inFormat instanceof MultiInputFormat format) { final String[] uris = new String[inputFiles.length]; for (int i = 0; i < inputFiles.length; i++) { uris[i] = UriOrFile.toUri(inputFiles[i].getPath()); } sc = format.load(uris, ArrayUtilRt.toStringArray(inputParams), outputType, errorHandler); } else { sc = inFormat.load(uri, ArrayUtilRt.toStringArray(inputParams), outputType, errorHandler); } } catch (IOException e) { errorHandler.fatalError(new SAXParseException(e.getMessage(), null, uri, -1, -1, e)); return; } final File destination = new File(settings.getOutputDestination()); final File outputFile; if (destination.isDirectory()) { final String name = new File(input).getName(); final int ext = name.lastIndexOf('.'); outputFile = new File(destination, (ext > 0 ? name.substring(0, ext) : name) + "." + outputType); } else { outputFile = destination; } try { final int indent = settings.getIndent(); final int length = settings.getLineLength(); final OutputDirectory od = new LocalOutputDirectory(sc.getMainUri(), outputFile, "." + outputType, settings.getOutputEncoding(), length > 0 ? length : DEFAULT_LINE_LENGTH, indent > 0 ? indent : DEFAULT_INDENT) { @Override public Stream open(String sourceUri, String encoding) throws IOException { final String s = reference(null, sourceUri); final File file = new File(outputFile.getParentFile(), s); if (file.exists()) { final String msg = RelaxngBundle.message("relaxng.convert-schema.dialog.file-exists.message", file.getAbsolutePath()); final int choice = Messages.showYesNoDialog(myProject, msg, RelaxngBundle.message( "relaxng.convert-schema.dialog.file-exists.title"), Messages.getWarningIcon()); if (choice == Messages.YES) { return super.open(sourceUri, encoding); } else if (choice == 1) { throw new CanceledException(); } } return super.open(sourceUri, encoding); } }; final OutputFormat of = getOutputFormat(settings.getOutputType()); of.output(sc, od, ArrayUtilRt.toStringArray(outputParams), StringUtil.toLowerCase(inputType.toString()), errorHandler); } catch (IOException e) { errorHandler.fatalError(new SAXParseException(e.getMessage(), null, UriOrFile.fileToUri(outputFile), -1, -1, e)); } } catch (CanceledException e) { // user abort } catch (SAXParseException e) { errorHandler.error(e); } catch (MalformedURLException e) { Logger.getInstance(getClass().getName()).error(e); } catch (InputFailedException | OutputFailedException | InvalidParamsException e) { // handled by ErrorHandler } catch (SAXException e) { // cannot happen or is already handled } }
|
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 (myInputOptions != null) { root = myInputOptions.getRoot(); } else { root = myOutputOptions.getRoot(); } return root; }
|
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.setText((String)inputOptions.get(ELEMENT_DEFINE)); } if (inputOptions.containsKey(ATTLIST_DEFINE)) { myAttlistDefine.setText((String)inputOptions.get(ATTLIST_DEFINE)); } if (inputOptions.containsKey(ANY_NAME)) { myAnyName.setText((String)inputOptions.get(ANY_NAME)); } myStrictAnyCheckBox.setSelected(inputOptions.get(STRICT_ANY) == Boolean.TRUE); if (inputOptions.containsKey(ANNOTATION_PREFIX)) { myAnnotationPrefix.setText((String)inputOptions.get(ANNOTATION_PREFIX)); } myGenerateStartCheckBox.setSelected(inputOptions.get(GENERATE_START) == Boolean.TRUE); if (inputOptions.containsKey(XMLNS)) { myDefaultNS.setText((String)inputOptions.get(XMLNS)); } final NamespaceMapModel model = (NamespaceMapModel)myNamespaceMap.getModel(); final Set<String> set = inputOptions.keySet(); final String prefix = XMLNS + ":"; for (String s : set) { if (s.startsWith(prefix)) { model.addMapping(s.substring(prefix.length()), (String)inputOptions.get(s)); } } }
|
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 = ((XmlAttributeDecl)element).getName(); if (s != null) { final String[] parts = s.split(":"); if (parts.length > 1) { map.put(XMLNS + ":" + parts[0], null); } } } super.visitElement(element); }
|
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() > 0); } }
|
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> this does not, because <choice> inside <choice> is unambiguous: <element><choice><data type="string" /><choice><caret> */ final XmlElementDescriptor d = myNsDescriptor.findDescriptor(childTag, patterns); if (d != null) { return d; } return NULL; }
|
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(myNsDescriptor.convertElementDescriptors(list))); } return descriptors.toArray(XmlElementDescriptor.EMPTY_ARRAY); }
|
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 (desc == null && chain.size() > 0); if (desc != null) { for (XmlTag xmlTag : chain) { desc = desc.getElementDescriptor(xmlTag, xmlTag.getParentTag()); if (desc == null) { break; } } } if (desc == null || desc instanceof AnyXmlElementDescriptor) { return findRootDescriptor(tag); } return desc; }
|
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) { maxPattern = pattern; max = spec; } } } final List<DElementPattern> patterns = ContainerUtil.findAll(list, pattern -> { final NameClass nameClass = pattern.getName(); return nameClass.contains(qName); }); if (maxPattern != null) { if (patterns.size() > 1) { return initDescriptor(new CompositeDescriptor(this, maxPattern, patterns)); } else { return initDescriptor(new RngElementDescriptor(this, maxPattern)); } } else { return null; } }
|
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, so we don't want to schema-validate it if (!RelaxNgMetaDataContributor.RNG_NAMESPACE.equals(rootTag.getNamespace())) { XmlInstanceValidator.doValidation(doc, host, getDescriptorFile()); } }
|
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 XmlElementDescriptor descriptor = findRootDescriptorInner(qName); return descriptor != null ? new CachedValueProvider.Result<>(descriptor, descriptor.getDependencies()) : new CachedValueProvider.Result<>(null, getDependencies()); }, false); myDescriptorsMap.put(qName, cachedValue); } return cachedValue.getValue(); }
|
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.