Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
303,200
String (final @Nullable String s, final ConvertContext context) { return XmlDomBundle.message("dom.converter.unknown.enum.value", s); }
getErrorMessage
303,201
boolean () { return !ReflectionUtil.isAssignable(NonExhaustiveEnum.class, myType); }
isExhaustive
303,202
DomElement () { return myElement; }
getElement
303,203
ItemPresentation () { return this; }
getPresentation
303,204
void (final DomElement element) { if (element instanceof GenericDomValue) return; final DomService.StructureViewMode viewMode = myDescriptor.fun(element); switch (viewMode) { case SHOW -> result.add(createChildElement(element)); case SHOW_CHILDREN -> DomUtil.acceptAvailableChildren(element, this); case SKIP -> {} } }
visitDomElement
303,205
StructureViewTreeElement (final DomElement element) { return new DomStructureTreeElement(element, myDescriptor, myNavigationProvider); }
createChildElement
303,206
void (boolean requestFocus) { if (myNavigationProvider != null) myNavigationProvider.navigate(myElement, requestFocus); }
navigate
303,207
boolean () { return myNavigationProvider != null && myNavigationProvider.canNavigate(myElement); }
canNavigate
303,208
boolean () { return myNavigationProvider != null && myNavigationProvider.canNavigate(myElement); }
canNavigateToSource
303,209
String () { if (!myElement.isValid()) return "<unknown>"; try { ElementPresentation presentation = myElement.getPresentation(); String name = presentation.getElementName(); return name != null? name : presentation.getTypeName(); } catch (IndexNotReadyException e) { return "Name not available during indexing"; } }
getPresentableText
303,210
StructureViewBuilder (@NotNull XmlFile file) { if (DomManager.getDomManager(file.getProject()).getDomFileDescription(file) != null) { return new DomStructureViewBuilder(file, DESCRIPTOR); } return null; }
createStructureViewBuilder
303,211
StructureViewTreeElement () { XmlFile myFile = getPsiFile(); final DomFileElement<DomElement> fileElement = DomManager.getDomManager(myFile.getProject()).getFileElement(myFile, DomElement.class); return fileElement == null? new XmlFileTreeElement(myFile) : new DomStructureTreeElement(fileElement.getRootElement().createStableCopy(), myDescriptor, myNavigationProvider); }
getRoot
303,212
DomElementNavigationProvider () { return myNavigationProvider; }
getNavigationProvider
303,213
String () { return super.toString() + "; file: " + getPsiFile(); }
toString
303,214
StructureViewModel (@Nullable Editor editor) { return new DomStructureViewTreeModel(myFile, myDescriptor, editor); }
createStructureViewModel
303,215
StructureView (final FileEditor fileEditor, final @NotNull Project project) { return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project, true); }
createStructureView
303,216
void (@NotNull ElementStub stub, @NotNull IndexSink sink) { final String namespaceKey = stub.getNamespaceKey(); if (StringUtil.isNotEmpty(namespaceKey)) { sink.occurrence(DomNamespaceKeyIndex.KEY, namespaceKey); } final String elementClass = stub.getElementClass(); if (elementClass != null) { sink.occurrence(DomElementClassIndex.KEY, elementClass); } }
indexStub
303,217
String () { return "xml.ElementStubSerializer"; }
getExternalId
303,218
String () { return "Element"; }
toString
303,219
String () { String key = getNamespaceKey(); return (StringUtil.isEmpty(key) ? getName() : key + ":" + getName()) + (StringUtil.isEmpty(getValue()) ? "" : ":" + getValue()); }
toString
303,220
boolean () { return myCustom; }
isCustom
303,221
int () { return myIndex; }
getIndex
303,222
String () { return myValue; }
getValue
303,223
void (DomInvocationHandler parent, List<DomElement> included, XmlName xmlName) { XmlFile file = parent.getFile(); if (myCachedValue == null) { myCachedValue = CachedValuesManager.getManager(file.getProject()).createCachedValue(() -> { DomElement result = computeValue(parent); return CachedValueProvider.Result.create(result, PsiModificationTracker.MODIFICATION_COUNT); }); } DomElement rootElement = myCachedValue.getValue(); if (rootElement != null) { processChildrenWithLocalName(rootElement, xmlName.getLocalName(), new CommonProcessors.CollectProcessor<>(included)); } }
resolve
303,224
void (DomElement parent, String localName, Processor<? super DomElement> processor) { parent.acceptChildren(element -> { if (element.getXmlElementName().equals(localName)) { processor.process(element); } }); }
processChildrenWithLocalName
303,225
String () { return "href=" + myHref + " xpointer=" + myXpointer; }
toString
303,226
String () { return "xml.XIncludeStub"; }
getExternalId
303,227
void (@NotNull XIncludeStub stub, @NotNull IndexSink sink) { }
indexStub
303,228
String () { return "XInclude"; }
toString
303,229
StubParentStrategy (@Nullable AttributeStub stub, final @NotNull DomStub parent) { if (stub == null) { return new Empty(parent); } else { return new StubParentStrategy(stub) { @Override public XmlElement getXmlElement() { DomInvocationHandler parentHandler = getParentHandler(); if (parentHandler == null) { LOG.error("no parent handler for " + this); return null; } XmlTag tag = parentHandler.getXmlTag(); if (tag == null) { LOG.error("can't find tag for " + parentHandler + "\n" + "parent stub: " + myStub.getParentStub() + "\n" + "parent's children: " + myStub.getParentStub().getChildrenStubs()); return null; } return tag.getAttribute(myStub.getName()); } }; } }
createAttributeStrategy
303,230
XmlElement () { DomInvocationHandler parentHandler = getParentHandler(); if (parentHandler == null) { LOG.error("no parent handler for " + this); return null; } XmlTag tag = parentHandler.getXmlTag(); if (tag == null) { LOG.error("can't find tag for " + parentHandler + "\n" + "parent stub: " + myStub.getParentStub() + "\n" + "parent's children: " + myStub.getParentStub().getChildrenStubs()); return null; } return tag.getAttribute(myStub.getName()); }
getXmlElement
303,231
DomInvocationHandler () { DomStub parentStub = myStub.getParentStub(); return parentStub == null ? null : parentStub.getHandler(); }
getParentHandler
303,232
XmlElement () { DomStub parentStub = myStub.getParentStub(); if (parentStub == null) return null; List<? extends Stub> children = parentStub.getChildrenStubs(); if (children.isEmpty()) return null; XmlTag parentTag = parentStub.getHandler().getXmlTag(); if (parentTag == null) return null; // for custom elements, namespace information is lost // todo: propagate ns info through DomChildDescriptions XmlTag[] tags; try { XmlUtil.BUILDING_DOM_STUBS.set(true); tags = parentTag.getSubTags(); } finally { XmlUtil.BUILDING_DOM_STUBS.set(false); } int i = 0; String nameToFind = myStub.getName(); for (XmlTag xmlTag : tags) { if (nameToFind.equals(xmlTag.getName()) && !(xmlTag instanceof IncludedXmlTag) && myStub.getIndex() == i++) { return xmlTag; } } return null; }
getXmlElement
303,233
DomParentStrategy (DomInvocationHandler handler) { return this; }
refreshStrategy
303,234
DomParentStrategy (@NotNull XmlElement element) { return new PhysicalDomParentStrategy(element, DomManagerImpl.getDomManager(element.getProject())); }
setXmlElement
303,235
DomParentStrategy () { final DomInvocationHandler parent = getParentHandler(); assert parent != null : "write operations should be performed on the DOM having a parent, your DOM may be not very fresh"; return new VirtualDomParentStrategy(parent); }
clearXmlElement
303,236
String () { return null; }
checkValidity
303,237
XmlFile (DomInvocationHandler handler) { return getParentHandler().getFile(); }
getContainingFile
303,238
boolean () { return true; }
isPhysical
303,239
boolean (Object obj) { if (!(obj instanceof StubParentStrategy other)) { return PhysicalDomParentStrategy.strategyEquals(this, obj); } if (obj == this) return true; if (!other.getClass().equals(getClass())) return false; if (!other.myStub.equals(myStub)) return false; return Comparing.equal(getContainingFile(myStub.getHandler()), other.getContainingFile(other.myStub.getHandler())); }
equals
303,240
DomInvocationHandler () { return myParent.getHandler(); }
getParentHandler
303,241
XmlElement () { return null; }
getXmlElement
303,242
boolean () { return false; }
isPhysical
303,243
String () { return myName; }
getName
303,244
boolean (XmlName name) { return name.getLocalName().equals(myLocalName) && StringUtil.notNullize(name.getNamespaceKey()).equals(getNamespaceKey()); }
matches
303,245
List<DomStub> (XmlName xmlName) { final List<? extends Stub> stubs = getChildrenStubs(); if (stubs.isEmpty()) { return Collections.emptyList(); } final List<DomStub> result = new SmartList<>(); //noinspection ForLoopReplaceableByForEach for (int i = 0, size = stubs.size(); i < size; i++) { final Stub stub = stubs.get(i); if (stub instanceof DomStub && ((DomStub)stub).matches(xmlName)) { result.add((DomStub)stub); } } return result; }
getChildrenByName
303,246
DomInvocationHandler () { return myHandler; }
getHandler
303,247
void (DomInvocationHandler handler) { myHandler = handler; }
setHandler
303,248
boolean () { return false; }
isCustom
303,249
String () { return "xml.AttributeStub"; }
getExternalId
303,250
void (@NotNull AttributeStub stub, @NotNull IndexSink sink) { }
indexStub
303,251
String () { return "Attribute"; }
toString
303,252
String () { return "xml.FileStubSerializer"; }
getExternalId
303,253
void (@NotNull FileStub stub, @NotNull IndexSink sink) { }
indexStub
303,254
String () { return "File"; }
toString
303,255
String () { return myValue; }
getValue
303,256
List<DomStub> () { return Collections.emptyList(); }
getChildrenStubs
303,257
int () { return 0; }
getIndex
303,258
String () { return getName() + ":" + getValue(); }
toString
303,259
XmlFileHeader () { return myHeader; }
getHeader
303,260
boolean (@NotNull VirtualFile file) { FileType fileType = file.getFileType(); return fileType == XmlFileType.INSTANCE && !FileBasedIndexImpl.isProjectOrWorkspaceFile(file, fileType); }
acceptsFile
303,261
Stream<DomFileMetaData> () { return DomApplicationComponent.getInstance().getStubBuildingMetadata().stream(); }
getAllSubBuilders
303,262
String (@Nullable DomFileMetaData data) { return data == null ? "<no-stub>" : data.rootTagName + ":" + data.rootTagName + ":" + data.implementation; }
getSubBuilderVersion
303,263
int () { return 23; }
getStubVersion
303,264
DomNamespaceKeyIndex () { return ourInstance; }
getInstance
303,265
boolean (@NotNull DomFileElement<?> domFileElement, @NotNull String namespaceKey) { final VirtualFile file = domFileElement.getFile().getVirtualFile(); if (!(file instanceof VirtualFileWithId)) return false; CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<>(); StubIndex.getInstance().processElements( KEY, namespaceKey, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile()), PsiFile.class, processor ); return processor.isFound(); }
hasStubElementsWithNamespaceKey
303,266
int () { return 1; }
getVersion
303,267
DomElementClassIndex () { return ourInstance; }
getInstance
303,268
boolean (@NotNull DomFileElement<?> domFileElement, @NotNull Class<? extends DomElement> clazz) { final VirtualFile file = domFileElement.getFile().getVirtualFile(); if (!(file instanceof VirtualFileWithId)) return false; final String clazzName = clazz.getName(); CommonProcessors.FindFirstProcessor<? super PsiFile> processor = new CommonProcessors.FindFirstProcessor<>(); StubIndex.getInstance().processElements(KEY, clazzName, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile()), PsiFile.class, processor ); return processor.isFound(); }
hasStubElementsOfType
303,269
int () { return 0; }
getVersion
303,270
void () { throw new UnsupportedOperationException("Shouldn't be shown"); }
addNotify
303,271
void (boolean aFlag) { throw new UnsupportedOperationException("Shouldn't be shown"); }
setVisible
303,272
void (@NotNull DocumentEvent e) { setModified(); if (myCommitOnEveryChange) { commit(); } }
documentChanged
303,273
void () { final EditorTextField textField = getEditorTextField(getComponent()); textField.getDocument().removeDocumentListener(myListener); super.doReset(); textField.getDocument().addDocumentListener(myListener); }
doReset
303,274
JComponent (final T component) { return getEditorTextField(getComponent()); }
getComponentToListenFocusLost
303,275
JComponent (final T component) { return J_TEXT_FIELD; }
getHighlightedComponent
303,276
T (T boundedComponent) { final Project project = getProject(); boundedComponent = createMainComponent(boundedComponent, project); final EditorTextField editorTextField = getEditorTextField(boundedComponent); editorTextField.setSupplementary(true); editorTextField.getDocument().addDocumentListener(myListener); return boundedComponent; }
createMainComponent
303,277
String () { return getEditorTextField(getComponent()).getText(); }
getValue
303,278
void (final String value) { CommandProcessor.getInstance().runUndoTransparentAction(() -> WriteAction.run(() -> { final T component = getComponent(); final Document document = getEditorTextField(component).getDocument(); document.replaceString(0, document.getTextLength(), value == null ? "" : value); })); }
setValue
303,279
void () { final DomElement domElement = getDomElement(); if (domElement == null || !domElement.isValid()) return; final EditorTextField textField = getEditorTextField(getComponent()); final Project project = getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (!project.isOpen()) return; if (!getDomWrapper().isValid()) return; final DomElement domElement1 = getDomElement(); if (domElement1 == null || !domElement1.isValid()) return; final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project); final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(domElement1); final List<DomElementProblemDescriptor> errorProblems = holder.getProblems(domElement1); final List<DomElementProblemDescriptor> warningProblems = new ArrayList<>(holder.getProblems(domElement1, true, HighlightSeverity.WARNING)); warningProblems.removeAll(errorProblems); Color background = getDefaultBackground(); if (errorProblems.size() > 0 && textField.getText().trim().length() == 0) { background = getErrorBackground(); } else if (warningProblems.size() > 0) { background = getWarningBackground(); } final Editor editor = textField.getEditor(); if (editor != null) { final MarkupModel markupModel = editor.getMarkupModel(); markupModel.removeAllHighlighters(); if (!errorProblems.isEmpty() && editor.getDocument().getLineCount() > 0) { markupModel.addLineHighlighter(CodeInsightColors.ERRORS_ATTRIBUTES, 0, 0); editor.getContentComponent().setToolTipText(errorProblems.get(0).getDescriptionTemplate()); } } textField.setBackground(background); }); }
updateComponent
303,280
boolean (final DomElement element) { return getDomElement().equals(element); }
canNavigate
303,281
void (final DomElement element) { final EditorTextField field = getEditorTextField(getComponent()); SwingUtilities.invokeLater(() -> { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(field, true)); field.selectAll(); }); }
navigate
303,282
EditorTextField (final @NotNull TextPanel panel) { final Component component = panel.getComponent(0); if (component instanceof ReferenceEditorWithBrowseButton) { return ((ReferenceEditorWithBrowseButton)component).getEditorTextField(); } return (EditorTextField)component; }
getEditorTextField
303,283
TextPanel (TextPanel boundedComponent, final Project project) { if (boundedComponent == null) { boundedComponent = new TextPanel(); } boundedComponent.removeAll(); final Function<String, Document> factory = s -> PsiDocumentManager.getInstance(project) .getDocument(PsiFileFactory.getInstance(project).createFileFromText("a.txt", PlainTextLanguage.INSTANCE, "", true, false)); final TextPanel boundedComponent1 = boundedComponent; final EditorTextField editorTextField = new EditorTextField(factory.fun(""), project, FileTypes.PLAIN_TEXT) { @Override protected @NotNull EditorEx createEditor() { final EditorEx editor = super.createEditor(); return boundedComponent1 instanceof MultiLineTextPanel ? makeBigEditor(editor, ((MultiLineTextPanel)boundedComponent1).getRowCount()) : editor; } @Override protected boolean isOneLineMode() { return false; } }; if (boundedComponent instanceof BigTextPanel) { final ReferenceEditorWithBrowseButton editor = new ReferenceEditorWithBrowseButton(null, editorTextField, factory); boundedComponent.add(editor); editor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { EditorTextField textArea = new EditorTextField(editorTextField.getDocument(), project, FileTypes.PLAIN_TEXT) { @Override protected @NotNull EditorEx createEditor() { final EditorEx editor = super.createEditor(); editor.setEmbeddedIntoDialogWrapper(true); return makeBigEditor(editor, 5); } @Override protected boolean isOneLineMode() { return false; } }; DialogBuilder builder = new DialogBuilder(project); builder.setDimensionServiceKey("TextControl"); builder.setCenterPanel(textArea); builder.setPreferredFocusComponent(textArea); builder.setTitle(XmlDomBundle.message("big.text.control.window.title")); builder.addCloseButton(); builder.show(); } }); return boundedComponent; } boundedComponent.add(editorTextField); return boundedComponent; }
createMainComponent
303,284
EditorEx () { final EditorEx editor = super.createEditor(); return boundedComponent1 instanceof MultiLineTextPanel ? makeBigEditor(editor, ((MultiLineTextPanel)boundedComponent1).getRowCount()) : editor; }
createEditor
303,285
boolean () { return false; }
isOneLineMode
303,286
void (ActionEvent e) { EditorTextField textArea = new EditorTextField(editorTextField.getDocument(), project, FileTypes.PLAIN_TEXT) { @Override protected @NotNull EditorEx createEditor() { final EditorEx editor = super.createEditor(); editor.setEmbeddedIntoDialogWrapper(true); return makeBigEditor(editor, 5); } @Override protected boolean isOneLineMode() { return false; } }; DialogBuilder builder = new DialogBuilder(project); builder.setDimensionServiceKey("TextControl"); builder.setCenterPanel(textArea); builder.setPreferredFocusComponent(textArea); builder.setTitle(XmlDomBundle.message("big.text.control.window.title")); builder.addCloseButton(); builder.show(); }
actionPerformed
303,287
EditorEx () { final EditorEx editor = super.createEditor(); editor.setEmbeddedIntoDialogWrapper(true); return makeBigEditor(editor, 5); }
createEditor
303,288
boolean () { return false; }
isOneLineMode
303,289
EditorEx (final EditorEx editor, int rowCount) { editor.setVerticalScrollbarVisible(true); final JTextArea area = new JTextArea(10, 50); area.setRows(rowCount); editor.getComponent().setPreferredSize(area.getPreferredSize()); return editor; }
makeBigEditor
303,290
TableCellEditor (DomElement element, Class type) { if (Enum.class.isAssignableFrom(type)) { //noinspection unchecked return new ComboTableCellEditor((Class<? extends Enum>)type, false); } final Function<DomElement, TableCellEditor> function = myCustomCellEditorCreators.get(type); assert function != null : "Type not supported: " + type; return function.fun(element); }
createCellEditor
303,291
UserActivityWatcher () { return new UserActivityWatcher() { private final DocumentListener myListener = new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent e) { fireUIChanged(); } }; @Override protected void processComponent(final Component component) { super.processComponent(component); if (component instanceof EditorComponentImpl) { ((EditorComponentImpl)component).getEditor().getDocument().addDocumentListener(myListener); } } @Override protected void unprocessComponent(final Component component) { super.unprocessComponent(component); if (component instanceof EditorComponentImpl) { ((EditorComponentImpl)component).getEditor().getDocument().removeDocumentListener(myListener); } } }; }
createEditorAwareUserActivityWatcher
303,292
void (@NotNull DocumentEvent e) { fireUIChanged(); }
documentChanged
303,293
void (final Component component) { super.processComponent(component); if (component instanceof EditorComponentImpl) { ((EditorComponentImpl)component).getEditor().getDocument().addDocumentListener(myListener); } }
processComponent
303,294
void (final Component component) { super.unprocessComponent(component); if (component instanceof EditorComponentImpl) { ((EditorComponentImpl)component).getEditor().getDocument().removeDocumentListener(myListener); } }
unprocessComponent
303,295
void (final CommittablePanel panel, final DomElement... elements) { final UserActivityWatcher userActivityWatcher = createEditorAwareUserActivityWatcher(); userActivityWatcher.addUserActivityListener(new UserActivityListener() { private boolean isProcessingChange; @Override public void stateChanged() { if (isProcessingChange) return; isProcessingChange = true; try { for (final DomElement element : elements) { ((DomElementAnnotationsManagerImpl)DomElementAnnotationsManager.getInstance(element.getManager().getProject())).outdateProblemHolder(element); } CommittableUtil.updateHighlighting(panel); } finally { isProcessingChange = false; } } }, panel); userActivityWatcher.register(panel.getComponent()); }
setupErrorOutdatingUserActivityWatcher
303,296
void () { if (isProcessingChange) return; isProcessingChange = true; try { for (final DomElement element : elements) { ((DomElementAnnotationsManagerImpl)DomElementAnnotationsManager.getInstance(element.getManager().getProject())).outdateProblemHolder(element); } CommittableUtil.updateHighlighting(panel); } finally { isProcessingChange = false; } }
stateChanged
303,297
BackgroundEditorHighlighter (final Project project, final PerspectiveFileEditor editor, final DomElement element) { return () -> { if (!element.isValid()) return HighlightingPass.EMPTY_ARRAY; final XmlFile psiFile = DomUtil.getFile(element); final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project); final Document document = psiDocumentManager.getDocument(psiFile); if (document == null) return HighlightingPass.EMPTY_ARRAY; editor.commit(); return TextEditorHighlightingPassRegistrarEx.getInstanceEx(project) .instantiateMainPasses(psiFile, document, new DefaultHighlightInfoProcessor()).toArray(HighlightingPass.EMPTY_ARRAY); }; }
createDomHighlighter
303,298
BaseControl (DomWrapper<String> wrapper, final boolean commitOnEveryChange) { return new TextControl(wrapper, commitOnEveryChange); }
createTextControl
303,299
void (@NotNull Class aClass, Function<DomWrapper<String>, BaseControl> creator) { myCustomControlCreators.put(aClass, creator); }
registerCustomControl