Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
6,700
int () { return getTokenStart() + yylength(); }
getTokenEnd
6,701
void (CharSequence buffer, int start, int end, int initialState) { zzBuffer = buffer; zzCurrentPos = zzMarkedPos = zzStartRead = start; zzAtEOF = false; zzAtBOL = true; zzEndRead = end; yybegin(initialState); }
reset
6,702
int () { return zzLexicalState; }
yystate
6,703
void (int newState) { zzLexicalState = newState; }
yybegin
6,704
CharSequence () { return zzBuffer.subSequence(zzStartRead, zzMarkedPos); }
yytext
6,705
char (int pos) { return zzBuffer.charAt(zzStartRead+pos); }
yycharat
6,706
int () { return zzMarkedPos-zzStartRead; }
yylength
6,707
void (int errorCode) { String message; try { message = ZZ_ERROR_MSG[errorCode]; } catch (ArrayIndexOutOfBoundsException e) { message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } throw new Error(message); }
zzScanError
6,708
void (int number) { if ( number > yylength() ) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos -= number; }
yypushback
6,709
Status () { switch (myRealEvent.result.getStatus()) { case PASSED: return Status.PASSED; case PENDING: return Status.PENDING; case SKIPPED: return Status.SKIPPED; default: return Status.FAILED; } }
getResult
6,710
Long () { return myRealEvent.result.getDuration() != null ? myRealEvent.result.getDuration() / 1000000: 0; }
getDuration
6,711
String () { return myRealEvent.result.getErrorMessage(); }
getErrorMessage
6,712
boolean () { PickleEvent pickleEvent = getPickleEvent(myRealTestCase); return pickleEvent != null && pickleEvent.pickle.getLocations().size() > 1; }
isScenarioOutline
6,713
String () { return myRealTestCase.getUri(); }
getUri
6,714
int () { PickleEvent pickleEvent = getPickleEvent(myRealTestCase); if (pickleEvent != null) { return pickleEvent.pickle.getLocations().get(pickleEvent.pickle.getLocations().size() - 1).getLine(); } return 0; }
getScenarioOutlineLine
6,715
int () { return myRealTestCase.getLine(); }
getLine
6,716
String () { return myRealTestCase.getName(); }
getScenarioName
6,717
String () { if (myRealStep instanceof HookTestStep) { try { Field definitionMatchField = myRealStep.getClass().getSuperclass().getDeclaredField("stepDefinitionMatch"); definitionMatchField.setAccessible(true); Object definitionMatchFieldValue = definitionMatchField.get(myRealStep); Field hookDefinitionField = definitionMatchFieldValue.getClass().getDeclaredField("hookDefinition"); hookDefinitionField.setAccessible(true); Object hookDefinitionFieldValue = hookDefinitionField.get(definitionMatchFieldValue); Field methodField = hookDefinitionFieldValue.getClass().getDeclaredField("method"); methodField.setAccessible(true); Object methodFieldValue = methodField.get(hookDefinitionFieldValue); if (methodFieldValue instanceof Method) { Method method = (Method)methodFieldValue; return String.format("java:test://%s/%s", method.getDeclaringClass().getName(), method.getName()); } } catch (Exception ignored) { } return ""; } PickleStepTestStep pickleStepTestStep = (PickleStepTestStep) myRealStep; return FILE_RESOURCE_PREFIX + pickleStepTestStep.getStepLocation() + ":" + pickleStepTestStep.getStepLine(); }
getLocation
6,718
String () { String stepName; if (myRealStep instanceof HookTestStep) { stepName = "Hook: " + ((HookTestStep)myRealStep).getHookType().toString(); } else { stepName = getStepKeyword() + " " + ((PickleStepTestStep) myRealStep).getPickleStep().getText(); } return stepName; }
getStepName
6,719
String () { try { PickleStepTestStep pickleStep = (PickleStepTestStep) myRealStep; String location = pickleStep.getStepLocation(); if (location.startsWith("file://")) { location = location.substring("file://".length()); } else if (location.startsWith("file:")) { location = location.substring("file:".length()); } int lastColonIndex = location.lastIndexOf(':'); String filePath = location.substring(0, lastColonIndex); String lineNumberString = location.substring(lastColonIndex + 1); String result = CucumberJvmSMFormatterUtil.getStepKeyword(filePath, Integer.parseInt(lineNumberString)); if (result != null) { return result; } } catch (Throwable ignored) { } return "Given"; }
getStepKeyword
6,720
PickleEvent (TestCase testCase) { try { Field pickleEventField = testCase.getClass().getDeclaredField("pickleEvent"); pickleEventField.setAccessible(true); return (PickleEvent)pickleEventField.get(testCase); } catch (Exception ignored) { } return null; }
getPickleEvent
6,721
void (TestCaseStarted event) { CucumberJvm3SMFormatter.this.handleTestCaseStarted(new CucumberJvm3Adapter.CucumberJvmTestCase(event.testCase)); }
receive
6,722
void (TestCaseFinished event) { handleTestCaseFinished(new CucumberJvm3Adapter.CucumberJvmTestCase(event.testCase)); }
receive
6,723
void (TestRunFinished event) { CucumberJvm3SMFormatter.this.handleTestRunFinished(); }
receive
6,724
void (WriteEvent event) { CucumberJvm3SMFormatter.this.handleWriteEvent(new CucumberJvmWriteEvent(event.text)); }
receive
6,725
void (TestStepStarted event) { handleTestStepStarted(new CucumberJvm3Adapter.CucumberJvmTestStep(event.testStep)); }
receive
6,726
void (TestStepFinished event) { handleTestStepFinished(new CucumberJvm3Adapter.CucumberJvmTestStepFinishedEvent(event)); }
receive
6,727
void (TestSourceRead event) { CucumberJvm3SMFormatter.this.handleTestSourceRead(new CucumberJvmTestSourceReadEvent(event.uri, event.source)); }
receive
6,728
void (EventPublisher publisher) { publisher.registerHandlerFor(TestCaseStarted.class, this.testCaseStartedHandler); publisher.registerHandlerFor(TestCaseFinished.class, this.testCaseFinishedHandler); publisher.registerHandlerFor(TestStepStarted.class, this.testStepStartedHandler); publisher.registerHandlerFor(TestStepFinished.class, this.testStepFinishedHandler); publisher.registerHandlerFor(TestSourceRead.class, this.testSourceReadHandler); publisher.registerHandlerFor(TestRunFinished.class, this.testRunFinishedHandler); publisher.registerHandlerFor(WriteEvent.class, this.writeEventHandler); }
setEventPublisher
6,729
boolean (@NotNull IndexedFile file) { return file.getFile().isInLocalFileSystem(); }
slowPathIfFileTypeHintUnsure
6,730
ThreeState (@NotNull FileType fileType) { if (fileType == HtmlFileType.INSTANCE) { return ThreeState.UNSURE; // check if a file is in local filesystem. } if (fileType instanceof LanguageFileType && ((LanguageFileType)fileType).getLanguage() instanceof TemplateLanguage) { return ThreeState.UNSURE; // check if a file is in local filesystem. } return ThreeState.NO; }
acceptFileType
6,731
void (Map<String, Integer> result, PsiFile file) { if (file instanceof HtmlCompatibleFile) { new XmlRecursiveElementWalkingVisitor() { @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { super.visitXmlAttribute(attribute); if ("id".equals(attribute.getName())) { String value = attribute.getValue(); XmlAttributeValue valueElement = attribute.getValueElement(); if (valueElement != null && StringUtil.isNotEmpty(value)) { result.put(value, valueElement.getTextRange().getStartOffset() + attribute.getValueTextRange().getStartOffset()); } } } }.visitFile(file); } }
processPsiFile
6,732
void (@NotNull XmlAttribute attribute) { super.visitXmlAttribute(attribute); if ("id".equals(attribute.getName())) { String value = attribute.getValue(); XmlAttributeValue valueElement = attribute.getValueElement(); if (valueElement != null && StringUtil.isNotEmpty(value)) { result.put(value, valueElement.getTextRange().getStartOffset() + attribute.getValueTextRange().getStartOffset()); } } }
visitXmlAttribute
6,733
int () { return 3; }
getVersion
6,734
DataExternalizer<Integer> () { return new DataExternalizer<>() { @Override public void save(@NotNull DataOutput out, Integer value) throws IOException { DataInputOutputUtil.writeINT(out, value); } @Override public Integer read(@NotNull DataInput in) throws IOException { return DataInputOutputUtil.readINT(in); } }; }
getValueExternalizer
6,735
void (@NotNull Processor<? super String> processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter filter) { FileBasedIndex.getInstance().processAllKeys(HtmlTagIdIndex.INDEX, (name) -> processor.process(name) && processor.process("#" + name), scope, filter); }
processNames
6,736
void (@NotNull String name, @NotNull Processor<? super NavigationItem> processor, @NotNull FindSymbolParameters parameters) { String idName = StringUtil.trimStart(name, "#"); FileBasedIndex.getInstance().processValues(HtmlTagIdIndex.INDEX, idName, null, (file, value) -> processor.process( new OffsetNavigationItem(parameters, file, value, name)), parameters.getSearchScope(), parameters.getIdFilter()); }
processElementsWithName
6,737
void (boolean requestFocus) { new OpenFileDescriptor(myProject, myFile, myValue).navigate(requestFocus); }
navigate
6,738
boolean () { return true; }
canNavigate
6,739
boolean () { return true; }
canNavigateToSource
6,740
String () { return myName; }
getName
6,741
ItemPresentation () { return new ItemPresentation() { @Override public String getPresentableText() { return myName; } @Override public @Nullable String getLocationString() { PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile); return psiFile != null ? "(" + SymbolPresentationUtil.getFilePathPresentation(psiFile) + ")" : null; } @Override public Icon getIcon(boolean unused) { return AllIcons.Xml.Html_id; } }; }
getPresentation
6,742
String () { return myName; }
getPresentableText
6,743
Icon (boolean unused) { return AllIcons.Xml.Html_id; }
getIcon
6,744
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OffsetNavigationItem item = (OffsetNavigationItem)o; return myFile.equals(item.myFile) && myValue.equals(item.myValue); }
equals
6,745
int () { return Objects.hash(myFile, myValue); }
hashCode
6,746
boolean (final Editor editor, final PsiFile file) { return isInsideTag(editor, file, new String[] {TD, TH}); }
isActionAvailable
6,747
boolean (List<TableRow> table, int row, int column) { return row >= 0 && row < table.size() && column >= 0 && column < table.get(row).size(); }
isInsideTable
6,748
void (final @NotNull Project project, final @NotNull Editor editor, final PsiFile file, int[] direction) { PsiElement element = getCurrentPsiElement(editor, file); element = getParentWithName(element, new String[]{TD, TH}); assert element != null; PsiElement root = getTablePsiElement(element); if (root != null) { Pair<List<TableRow>, TableCell> pair = getTableAndPosition(root, element); List<TableRow> table = pair.first; TableCell cell = pair.second; int x = cell.startColumn; int y = cell.startRow; int newX = x; int newY = y; do { x = newX; y = newY; if (table.get(newY).get(newX).tag != cell.tag) { break; } newY += direction[0]; newX += direction[1]; } while (isInsideTable(table, newY, newX)); TableCell newCell = table.get(y).get(x); XmlTag tag = newCell.tag; moveCaretTo(editor, findClosingToken(tag)); } }
moveCaret
6,749
boolean (final Editor editor, final PsiFile file) { return isInsideTag(editor, file, new String[] {TD, TH}); }
isActionAvailable
6,750
void (final @NotNull Project project, List<TableRow> table, int columnNumber) { for (int i = 0; i < table.size(); i++) { TableRow row = table.get(i); if (row.isEmpty()) { XmlTag element = createTableCellXmlTag(project, row.insideHeader); row.rowTag.add(element); } else if (columnNumber < 0) { TableCell cell = null; for (int j = 0; j < row.size(); j++) { TableCell currentCell = row.get(j); if (currentCell.startRow == i) { cell = currentCell; break; } } if (cell != null) { addCellToTag(project, cell, true, row.insideHeader); } } else { loop: for (int j = Math.min(columnNumber, row.size() - 1); j >= 0; j--) { TableCell cell = row.get(j); for (XmlAttribute attribute : cell.tag.getAttributes()) { if (COLSPAN.equals(StringUtil.toLowerCase(attribute.getLocalName()))) { if (cell.startRow == i) { try { cell.tag.setAttribute(COLSPAN, String.valueOf((Integer.parseInt(cell.tag.getAttributeValue(COLSPAN)) + 1))); } catch (NumberFormatException e) { break; } } break loop; } } if (cell.startRow == i) { addCellToTag(project, cell, false, row.insideHeader); break; } } } } }
addColumnToTable
6,751
XmlTag (@NotNull final Project project, boolean inHeader) { final String filetext = "<root>" + (inHeader ? "<th></th>" : "<td></td>") + "</root"; final XmlFile xmlFile = (XmlFile)PsiFileFactory.getInstance(project).createFileFromText("dummy.xml", XMLLanguage.INSTANCE, filetext); XmlTag tag = xmlFile.getDocument().getRootTag(); for (PsiElement element : tag.getChildren()) { if (element instanceof XmlTag) { tag = (XmlTag)element; } } return tag; }
createTableCellXmlTag
6,752
boolean (@NotNull Editor editor, PsiElement element) { if (element instanceof XmlTag && (TD.equals(StringUtil.toLowerCase(((XmlTag)element).getName())) || TH.equals( StringUtil.toLowerCase(((XmlTag)element).getName())))) { if ("<td></td>".equals(element.getText()) || "<th></th>".equals(element.getText())) { PsiElement closingToken = element.getChildren()[3]; // "</" position moveCaretTo(editor, closingToken); return true; } } for (PsiElement child : element.getChildren()) { if(moveCaretToFirstEmptyCell(editor, child)) { return true; } } return false; }
moveCaretToFirstEmptyCell
6,753
boolean (final Editor editor, final PsiFile file, String[] tagNames) { if (isHtmlTagContainingFile(editor, file)) { final int offset = editor.getCaretModel().getOffset(); PsiElement element = getParentWithName(file.findElementAt(offset), tagNames); return element != null; } return false; }
isInsideTag
6,754
int (XmlTag tag) { XmlAttribute[] attributes = tag.getAttributes(); for (XmlAttribute attribute : attributes) { if (COLSPAN.equals(attribute.getLocalName())) { try { return Integer.parseInt(attribute.getValue()); } catch (NumberFormatException e) { return 1; } } } return 1; }
getColumnsNumber
6,755
int (XmlTag tag) { XmlAttribute[] attributes = tag.getAttributes(); for (XmlAttribute attribute : attributes) { if (ROWSPAN.equals(attribute.getLocalName())) { try { return Integer.parseInt(attribute.getValue()); } catch (NumberFormatException e) { return 1; } } } return 1; }
getRowsNumber
6,756
void (PsiElement element, boolean isInsideHeader, List<? super Pair<Boolean, List<Integer>>> list, List<? super XmlTag> tags) { if (element instanceof XmlTag tag) { final String name = StringUtil.toLowerCase(tag.getLocalName()); if (THEAD.equals(name)) { isInsideHeader = true; } if (TD.equals(name) || TH.equals(name) || TR.equals(name) || TABLE.equals(name)) { list.add(new Pair<>(isInsideHeader, null)); tags.add(tag); } } for (PsiElement psiElement : element.getChildren()) { generateTableList(psiElement, isInsideHeader, list, tags); } }
generateTableList
6,757
void (final @NotNull Editor editor, final PsiElement element) { editor.getCaretModel().moveToOffset(element.getTextOffset()); editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); }
moveCaretTo
6,758
boolean (final Editor editor, final PsiFile file) { if (editor == null || !(file instanceof XmlFile)) { return false; } final int offset = editor.getCaretModel().getOffset(); final PsiElement element = file.findElementAt(offset); return HtmlUtil.isHtmlTagContainingFile(element); }
isHtmlTagContainingFile
6,759
int (int currentColumn) { return cols + startColumn - currentColumn; }
getRemainingColumnsNumber
6,760
int (int currentRow) { return rows + startRow - currentRow; }
getRemainingRowsNumber
6,761
void (TableCell cell) { list.add(cell); }
add
6,762
TableCell (int index) { return list.get(index); }
get
6,763
int () { return list.size(); }
size
6,764
boolean () { return list.isEmpty(); }
isEmpty
6,765
String () { return "html"; }
getId
6,766
boolean (@NotNull VirtualFile file) { return HtmlUtil.isHtmlFile(file); }
acceptFile
6,767
void (@NotNull Consumer<? super FileType> fileTypeSink) { fileTypeSink.consume(HtmlFileType.INSTANCE); fileTypeSink.consume(XHtmlFileType.INSTANCE); }
registerFileTypesUsedForIndexing
6,768
FileIncludeInfo[] (XmlFile xmlFile) { return HtmlUtil.getIncludedPathsElements(xmlFile).stream() .filter(el -> el != null && !StringUtil.isEmptyOrSpaces(el.getValue())) .map(el -> new FileIncludeInfo(el.getValue())).toArray(FileIncludeInfo[]::new); }
getIncludeInfos
6,769
boolean (@NotNull Transferable t, @Nullable Editor editor) { if (editor == null) return false; final VirtualFile file = getDroppedFile(t); if (file == null) return false; final FileType type = file.getFileType(); return isImage(type) || isCSS(type) || isJS(type); }
canHandle
6,770
boolean (@NotNull Transferable t, @Nullable Editor editor, Project project) { assert editor != null; final Document document = editor.getDocument(); final PsiFile target = PsiDocumentManager.getInstance(project).getPsiFile(document); if (!(target instanceof HtmlFileImpl)) return false; final VirtualFile file = getDroppedFile(t); if (file == null) return false; final FileType type = file.getFileType(); if (isCSS(type)) { return insertTagInHead((HtmlFileImpl)target, file, editor, "<link rel={0}stylesheet{0} href={0}{1}{0}>"); } if (isJS(type)) { return insertTagInHead((HtmlFileImpl)target, file, editor, "<script src={0}{1}{0}></script>"); } if (isImage(type)) { return insertImageTag((HtmlFileImpl)target, file, editor, "<img src={0}{1}{0}/>"); } return false; }
handleDrop
6,771
boolean (HtmlFileImpl target, VirtualFile droppedFile, Editor editor, String tagTemplate) { final String relativePath = getRelativePath(target, droppedFile); final String tagText = prepareTagText(target, tagTemplate, relativePath); final XmlDocument document = target.getDocument(); if (document == null || tagText == null) return false; final XmlTag[] topLevelTags = PsiTreeUtil.getChildrenOfType(document, XmlTag.class); XmlTag html = null; XmlTag head = null; if (topLevelTags != null) { for (XmlTag tag : topLevelTags) { if ("html".equals(tag.getName())) { html = tag; break; } if ("head".equals(tag.getName())) { head = tag; break; } } } if (html != null) { head = html.findFirstSubTag("head"); } final PsiElement parent = head != null ? head : html != null ? html : document; if (checkIfPresent(editor, tagTemplate, relativePath, parent)) return true; WriteCommandAction.writeCommandAction(target.getProject(), target).run(() -> { final XmlTag tag = XmlElementFactory.getInstance(target.getProject()).createHTMLTagFromText(tagText); if (parent instanceof XmlTag) { ((XmlTag)parent).addSubTag(tag, !"head".equals(((XmlTag)parent).getName())); } else { parent.addAfter(tag, ((XmlDocument)parent).getProlog()); } }); return true; }
insertTagInHead
6,772
boolean (Editor editor, String tagTemplate, String relativePath, PsiElement parent) { for (PsiElement element : parent.getChildren()) { if (element instanceof XmlTag tag) { if (tagTemplate.startsWith("<" + tag.getName() + " ")) { final String attrName = HtmlUtil.SCRIPT_TAG_NAME.equals(tag.getName()) ? "src" : "href"; String path = tag.getAttributeValue(attrName); if (StringUtil.equals(path, relativePath)) { final LogicalPosition position = getPosition(editor, tag, attrName); editor.getScrollingModel().scrollTo(position, ScrollType.MAKE_VISIBLE); final int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING; final LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel( HtmlToolsBundle.message("html.drop.handler.hint.text.file.already.linked", relativePath))); final Point point = HintManagerImpl.getHintPosition(hint, editor, position, HintManager.ABOVE); HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, point, flags, 0, false); return true; } } } } return false; }
checkIfPresent
6,773
LogicalPosition (Editor editor, XmlTag tag, String attrName) { final XmlAttributeValue element = tag.getAttribute(attrName).getValueElement(); return editor.offsetToLogicalPosition(element.getTextRange().getStartOffset() + element.getTextRange().getLength() / 2); }
getPosition
6,774
boolean (HtmlFileImpl target, VirtualFile droppedFile, Editor editor, String tagTemplate) { final String tagText = prepareTagText(target, tagTemplate, getRelativePath(target, droppedFile)); final int offset = editor.getCaretModel().getOffset(); PsiElement element = target.findElementAt(offset); if (element == null || tagText == null) return false; final XmlElement parent = PsiTreeUtil.getParentOfType(element, XmlTag.class, XmlDocument.class); PsiElement candidate = null; for (PsiElement psiElement : parent.getChildren()) { if (psiElement.getTextRange().getEndOffset() >= offset) { candidate = psiElement; break; } } if (parent instanceof XmlTag && candidate != null) { final ASTNode startEnd = XmlChildRole.START_TAG_END_FINDER.findChild(parent.getNode()); if (startEnd != null && startEnd.getTextRange().getEndOffset() > candidate.getTextRange().getEndOffset()) { candidate = startEnd.getPsi(); } final ASTNode endStart = XmlChildRole.CLOSING_TAG_START_FINDER.findChild(parent.getNode()); if (endStart != null && endStart.getTextRange().getStartOffset() <= candidate.getTextRange().getStartOffset()) { candidate = endStart.getPsi().getPrevSibling(); } } PsiElement insertionPoint = candidate; WriteCommandAction.writeCommandAction(target.getProject(), target).run(() -> { XmlTag tag = XmlElementFactory.getInstance(target.getProject()).createHTMLTagFromText(tagText); tag = (XmlTag)parent.addAfter(tag, insertionPoint); final ImageInfo info = HtmlReferenceProvider.SizeReference.getImageInfo(tag); if (info != null && info.width != 0 && info.height != 0) { tag.setAttribute("height", String.valueOf(info.height)); tag.setAttribute("width", String.valueOf(info.width)); } }); return true; }
insertImageTag
6,775
String (HtmlFileImpl target, VirtualFile droppedFile) { final VirtualFile targetFile = target.getVirtualFile(); return FileUtil.getRelativePath(targetFile.getParent().getPath(), droppedFile.getPath(), '/'); }
getRelativePath
6,776
boolean (FileType type) { return type instanceof LanguageFileType && ((LanguageFileType)type).getLanguage().isKindOf(Language.findLanguageByID("JavaScript")); }
isJS
6,777
boolean (FileType type) { return type instanceof LanguageFileType && ((LanguageFileType)type).getLanguage().isKindOf(Language.findLanguageByID("CSS")); }
isCSS
6,778
boolean (FileType type) { return type == ImageFileTypeManager.getInstance().getImageFileType(); }
isImage
6,779
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
6,780
void (final @NotNull AnActionEvent e) { DataContext dataContext = e.getDataContext(); ActionGroup group = getGroup(); ListPopup popup = JBPopupFactory.getInstance() .createActionGroupPopup(HtmlToolsBundle.message("html.action.open_in.list.popup.title"), group, dataContext, JBPopupFactory.ActionSelectionAid.MNEMONICS, false); Object onlyItem = ContainerUtil.getOnlyItem(popup.getListStep().getValues()); if (onlyItem instanceof PopupFactoryImpl.ActionItem actionItem) { actionItem.getAction().actionPerformed(e); } else { popup.showInBestPositionFor(dataContext); } }
actionPerformed
6,781
void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); AnAction onlyAction = ActionGroupUtil.getSingleActiveAction(getGroup(), event); presentation.setText(onlyAction != null ? HtmlToolsBundle.message("html.action.open_in.list.prefix") + " " + onlyAction.getTemplatePresentation().getText() : HtmlToolsBundle.message("html.action.open_in.list.popup.title")); DataContext dataContext = event.getDataContext(); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { presentation.setEnabled(false); return; } Editor editor = CommonDataKeys.EDITOR.getData(dataContext); if (editor == null) { presentation.setEnabled(false); return; } presentation.setEnabled(!ActionGroupUtil.isGroupEmpty(getGroup(), event)); // }
update
6,782
ActionGroup () { return (ActionGroup)ActionManager.getInstance().getAction("OpenInBrowserEditorContextBarGroupAction"); }
getGroup
6,783
void (@NotNull PsiElement element) { super.visitElement(element); if (!(element instanceof XmlAttributeValue)) { return; } final WebReference webReference = lookForWebReference(element); if (webReference != null) { result.add(webReference); } }
visitElement
6,784
HighlightDisplayLevel (@NotNull PsiElement context) { final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(context.getProject()).getCurrentProfile(); final HighlightDisplayKey displayKey = HighlightDisplayKey.find(HtmlNonExistentInternetResourceInspection.SHORT_NAME); return inspectionProfile.getErrorLevel(displayKey, context); }
getHighlightDisplayLevel
6,785
String (@NotNull String url) { return HtmlToolsBundle.message("html.inspections.non.existent.internet.resource.message", url); }
getErrorMessage
6,786
String () { return HtmlToolsBundle.message("html.intention.disable.validation.web.links"); }
getText
6,787
String () { return getText(); }
getFamilyName
6,788
boolean (@NotNull Project project, Editor editor, PsiFile file) { return true; }
isAvailable
6,789
boolean () { return myDisableInspectionToolAction.startInWriteAction(); }
startInWriteAction
6,790
String () { return HtmlToolsBundle.message("html.intention.create.sub.element.text", myName); }
getText
6,791
String () { return HtmlToolsBundle.message("html.intention.create.sub.element.family", myName); }
getFamilyName
6,792
void (@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { XmlTag tag = ((XmlTag)startElement); XmlTag title = tag.createChildTag(myName, tag.getNamespace(), "", false); XmlTag createdTag = tag.addSubTag(title, false); //Fix all such problems in file (project) if (editor == null) return; editor.getCaretModel().moveToOffset(createdTag.getTextOffset() + title.getTextLength() / 2); }
invoke
6,793
String () { return "HtmlPresentationalElement"; }
getShortName
6,794
void (final @NotNull XmlTag tag, final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { final String name = StringUtil.toLowerCase(tag.getName()); if (HtmlUtil.isHtmlTagContainingFile(tag)) { if (HtmlUtil.isHtml5Context(tag) && !ourHtmlReplaceableTagsHtml5.contains(tag.getName())) { return; } LocalQuickFix[] fixes = null; if (ourCssReplaceableTags.contains(name)) { fixes = new LocalQuickFix[]{new ReplaceHtmlTagWithCssAction(name)}; if (ourHtmlReplaceableTagsHtml4.contains(name)) { fixes = new LocalQuickFix[]{fixes[0], new ReplaceHtmlTagWithAnotherAction(name)}; } } else if (ourHtmlReplaceableTagsHtml4.contains(name)) { fixes = new LocalQuickFix[]{new ReplaceHtmlTagWithAnotherAction(name)}; } HtmlDeprecatedTagInspection .registerTag(tag, "html.inspections.check.presentational.tag", holder, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } }
checkTag
6,795
void (@NotNull XmlTag tag, @NotNull String message, @NotNull ProblemsHolder holder, LocalQuickFix[] fixes, @NotNull ProblemHighlightType type) { if (fixes == null) { return; } final PsiElement startTagNameElement = XmlTagUtil.getStartTagNameElement(tag); String description = GlobalInspectionUtil.createInspectionMessage(HtmlToolsBundle.message(message)); if (startTagNameElement != null) { holder.registerProblem(startTagNameElement, description, type, fixes); } final PsiElement endTagNameElement = XmlTagUtil.getEndTagNameElement(tag); if (endTagNameElement != null) { holder.registerProblem(endTagNameElement, description, type, fixes); } }
registerTag
6,796
void (final @NotNull XmlTag tag, final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { if (HtmlUtil.isHtmlTagContainingFile(tag)) { XmlElementDescriptor descriptor = tag.getDescriptor(); if (!(descriptor instanceof HtmlElementDescriptorImpl) || !((HtmlElementDescriptorImpl)descriptor).isDeprecated()) { return; } String name = tag.isCaseSensitive() ? tag.getName() : StringUtil.toLowerCase(tag.getName()); LocalQuickFix[] fixes; if ("font".equals(name)) { fixes = new LocalQuickFix[]{new ReplaceFontTagAction()}; } else if ("applet".equals(name)) { fixes = new LocalQuickFix[]{new ReplaceAppletTagAction()}; } else if (ourCssReplaceableTags.contains(name)) { fixes = new LocalQuickFix[]{new ReplaceHtmlTagWithCssAction(name)}; if (ourHtmlReplaceableTags.contains(name)) { fixes = new LocalQuickFix[]{fixes[0], new ReplaceHtmlTagWithAnotherAction(name)}; } } else if (ourHtmlReplaceableTags.contains(name)) { fixes = new LocalQuickFix[]{new ReplaceHtmlTagWithAnotherAction(name)}; } else { fixes = LocalQuickFix.EMPTY_ARRAY; } MdnSymbolDocumentation documentation = getHtmlMdnDocumentation(tag, null); boolean deprecatedInHtml5 = documentation != null && isDeprecatedOrObsolete(documentation.getApiStatus()); boolean inHtml5 = HtmlUtil.isHtml5Context(tag); if (!inHtml5 && !deprecatedInHtml5 && !HtmlUtil.hasNonHtml5Doctype(tag)) { fixes = ArrayUtil.append(fixes, new SwitchToHtml5Action()); } registerTag(tag, "html.inspections.deprecated.tag", holder, fixes, ProblemHighlightType.LIKE_DEPRECATED); } }
checkTag
6,797
CachedValue<HtmlLabelsHolder> (final XmlFile file, final Object p) { return CachedValuesManager.getManager(file.getProject()).createCachedValue(() -> { final HtmlLabelsHolder holder = new HtmlLabelsHolder(); final Language language = file.getViewProvider().getBaseLanguage(); final PsiFile psiFile = file.getViewProvider().getPsi(language); if (psiFile != null) { psiFile.accept(new LabelGatheringRecursiveVisitor(holder)); return new CachedValueProvider.Result<>(holder, file); } return null; }, false); }
compute
6,798
HtmlLabelsHolder (final XmlFile file) { return CACHE.get(htmlLabelsHolderKey, file, null).getValue(); }
getInstance
6,799
void (@NotNull String forValue) { myForValuesOfLabels.add(forValue); }
registerForValue