Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
292,400 | List<FileTypeInfo> () { final List<LanguageFileType> types = new ArrayList<>(); for (LanguageFileType fileType : StructuralSearchUtil.getSuitableFileTypes()) { if (StructuralSearchUtil.getProfileByFileType(fileType) != null) { types.add(fileType); } } types.sort((o1, o2) -> o1.getDescription().compareToIgnoreCase(o2.getDescription())); final List<FileTypeInfo> infos = new ArrayList<>(); for (LanguageFileType fileType : types) { final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType); assert profile != null; final Language language = fileType.getLanguage(); final List<PatternContext> patternContexts = new ArrayList<>(profile.getPatternContexts()); if (!patternContexts.isEmpty()) { infos.add(new FileTypeInfo(fileType, language, patternContexts.get(0), false)); for (int i = 1; i < patternContexts.size(); i++) { infos.add(new FileTypeInfo(fileType, language, patternContexts.get(i), true)); } continue; // proceed with the next file type } infos.add(new FileTypeInfo(fileType, language, null, false)); final List<Language> dialects = new ArrayList<>(language.getDialects()); dialects.sort(Comparator.comparing(Language::getDisplayName)); for (Language dialect : dialects) { if (profile.isMyLanguage(dialect)) { infos.add(new FileTypeInfo(fileType, dialect, null, true)); } } } return infos; } | createFileTypeInfos |
292,401 | void (@Nullable LanguageFileType type, @Nullable Language dialect, @Nullable PatternContext context) { if (type == null) { setSelectedItem(null); } else { for (FileTypeInfo info : myFileTypeInfos) { if (info.isEqualTo(type, dialect, context)) { setSelectedItem(info); return; } } } } | setSelectedItem |
292,402 | void (FileTypeInfo info) { mySelectedItem = info; if (myConsumer != null && info != null) { myConsumer.accept(info); } } | setSelectedItem |
292,403 | FileTypeInfo () { return mySelectedItem; } | getSelectedItem |
292,404 | void (@NotNull AnActionEvent e) { super.update(e); final Presentation presentation = e.getPresentation(); if (mySelectedItem == null) { presentation.setIcon(AllIcons.FileTypes.Unknown); presentation.setText(CoreBundle.message("filetype.unknown.description")); } else { presentation.setIcon(mySelectedItem.getFileType().getIcon()); presentation.setText(mySelectedItem.getText()); } } | update |
292,405 | ActionUpdateThread () { return ActionUpdateThread.EDT; } | getActionUpdateThread |
292,406 | JComponent (@NotNull Presentation presentation, @NotNull String place) { final JPanel panel = new JPanel(new BorderLayout(1, 0)); final ComboBoxButton button = createComboBoxButton(presentation); final String text = SSRBundle.message("search.dialog.file.type.label"); final JLabel label = new JBLabel(text); button.setLabel(label); panel.add(label, BorderLayout.WEST); panel.add(button, BorderLayout.CENTER); return panel; } | createCustomComponent |
292,407 | DefaultActionGroup (@NotNull JComponent button, @NotNull DataContext context) { final DefaultActionGroup group = new DefaultActionGroup(); for (FileTypeInfo fileTypeInfo : myFileTypeInfos) { group.add(new FileTypeInfoAction(fileTypeInfo)); } return group; } | createPopupActionGroup |
292,408 | Condition<AnAction> () { return action -> ((FileTypeInfoAction)action).getFileTypeInfo() == mySelectedItem; } | getPreselectCondition |
292,409 | void (@NotNull AnActionEvent e) { setSelectedItem(myFileTypeInfo); if (myUserActionConsumer != null) { myUserActionConsumer.accept(myFileTypeInfo); } } | actionPerformed |
292,410 | FileTypeInfo () { return myFileTypeInfo; } | getFileTypeInfo |
292,411 | LanguageFileType () { return myFileType; } | getFileType |
292,412 | Language () { return myDialect; } | getDialect |
292,413 | PatternContext () { return myContext; } | getContext |
292,414 | boolean () { return myNested; } | isNested |
292,415 | boolean (@NotNull LanguageFileType fileType, @Nullable Language dialect, @Nullable PatternContext context) { return (myFileType == fileType) && (dialect == null || myDialect == dialect) && (context == null || myContext == context); } | isEqualTo |
292,416 | boolean (Object o) { if (this == o) return true; if (!(o instanceof FileTypeInfo info)) return false; return myFileType == info.myFileType && myDialect == info.myDialect && myContext == info.myContext; } | equals |
292,417 | int () { return Objects.hash(myFileType, myDialect, myContext); } | hashCode |
292,418 | String () { return getText(); } | toString |
292,419 | void (@NotNull AnActionEvent e) {} | actionPerformed |
292,420 | JComponent (@NotNull Presentation presentation, @NotNull String place) { return new JLabel(myText); } | createCustomComponent |
292,421 | Result (char c, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (editor.getUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY) == null) { return Result.CONTINUE; } if (c == '$') { final SelectionModel selectionModel = editor.getSelectionModel(); final String selectedText = selectionModel.getSelectedText(); if (!StringUtil.isEmpty(selectedText)) { if (selectedText.contains("$") || !CodeInsightSettings.getInstance().SURROUND_SELECTION_ON_QUOTE_TYPED) { return Result.CONTINUE; } final Document document = editor.getDocument(); final List<RangeMarker> rangeMarkers = new SmartList<>(); rangeMarkers.add(document.createRangeMarker(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd())); final CaretModel caretModel = editor.getCaretModel(); final boolean multipleCarets = caretModel.getCaretCount() != 1; if (!multipleCarets) { PsiTreeUtil.processElements(file, element -> { if (StructuralSearchUtil.isIdentifier(element) && element.getText().equals(selectedText)) { rangeMarkers.add(document.createRangeMarker(element.getTextRange())); } return true; }); } final String newText = c + selectedText + c; final boolean ltrSelection = selectionModel.getLeadSelectionOffset() != selectionModel.getSelectionEnd(); for (RangeMarker marker : rangeMarkers) { if (marker.isValid()) { document.replaceString(marker.getStartOffset(), marker.getEndOffset(), newText); if (multipleCarets) { final int startOffset = marker.getStartOffset() + 1; final int endOffset = startOffset + selectedText.length(); selectionModel.setSelection(ltrSelection ? startOffset : endOffset, ltrSelection ? endOffset : startOffset); caretModel.moveToOffset(ltrSelection ? endOffset : startOffset); } } } if (!multipleCarets && rangeMarkers.size() <= caretModel.getMaxCaretCount()) { final List<CaretState> newCaretStates = new SmartList<>(); for (RangeMarker marker : rangeMarkers) { final int startOffset = marker.getStartOffset() + 1; final int endOffset = startOffset + selectedText.length(); final LogicalPosition selectionStart = editor.offsetToLogicalPosition(ltrSelection ? startOffset : endOffset); final LogicalPosition selectionEnd = editor.offsetToLogicalPosition(ltrSelection ? endOffset : startOffset); final LogicalPosition caretPosition = editor.offsetToLogicalPosition(ltrSelection ? endOffset : startOffset); final CaretState state = new CaretState(caretPosition, selectionStart, selectionEnd); newCaretStates.add(state); } caretModel.setCaretsAndSelections(newCaretStates); } return Result.STOP; } else if (CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET) { final Document document = editor.getDocument(); final Caret caret = editor.getCaretModel().getCurrentCaret(); final LogicalPosition position = caret.getLogicalPosition(); final int lineStart = document.getLineStartOffset(position.line); final int lineEnd = document.getLineEndOffset(position.line); final CharSequence text = document.getCharsSequence(); final int offset = caret.getOffset(); final boolean nextIsDollar = offset < text.length() && text.charAt(offset) == '$'; if (hasOddDollar(text, lineStart, offset) && nextIsDollar) { caret.setSelection(offset, offset + 1); } else if (!hasOddDollar(text, lineStart, lineEnd)) { document.insertString(offset, "$"); } } } return Result.CONTINUE; } | beforeSelectionRemoved |
292,422 | boolean (CharSequence text, int start, int end) { boolean $ = false; for (int i = start; i < end; i++) { if (text.charAt(i) == '$') { $ = !$; } } return $; } | hasOddDollar |
292,423 | UIState () { return ApplicationManager.getApplication().getService(UIState.class); } | getInstance |
292,424 | UIState () { return this; } | getState |
292,425 | void (@NotNull UIState state) { XmlSerializerUtil.copyBean(state, this); if (!migrated) { final PropertiesComponent properties = PropertiesComponent.getInstance(); filtersVisible = properties.getBoolean("structural.search.filters.visible", true); existingTemplatesVisible = properties.getBoolean("structural.search.templates.visible", true); pinned = properties.getBoolean("structural.seach.pinned", false); properties.unsetValue("structural.search.filters.visible"); properties.unsetValue("structural.search.templates.visible"); properties.unsetValue("structural.seach.pinned"); properties.unsetValue("structural.search.shorten.fqn"); properties.unsetValue("structural.search.reformat"); properties.unsetValue("structural.search.use.static.import"); migrated = true; } } | loadState |
292,426 | void (@NotNull EditorMouseEvent e) { handleInputFocusMovement(e.getLogicalPosition(), false); } | mouseMoved |
292,427 | void (LogicalPosition position, boolean caret) { final Configuration configuration = editor.getUserData(CURRENT_CONFIGURATION_KEY); if (configuration == null) { return; } final Document document = editor.getDocument(); final int lineCount = document.getLineCount(); if (position.line >= lineCount) { return; } final int lineStart = document.getLineStartOffset(position.line); final int lineEnd = document.getLineEndOffset(position.line); final CharSequence patternText = document.getCharsSequence().subSequence(lineStart, lineEnd); final TextRange variableRange = TemplateImplUtil.findVariableAtOffset(patternText, position.column); if (variableRange == null) { if (caret) { if (myCurrentVariableCallback != null) { myCurrentVariableCallback.accept(Configuration.CONTEXT_VAR_NAME); } } return; } final String variableName = variableRange.subSequence(patternText).toString(); final NamedScriptableDefinition variable = configuration.findVariable(variableName); final boolean replacementVariable = variable instanceof ReplacementVariableDefinition || myCanBeReplace && variable == null && configuration instanceof ReplaceConfiguration; final String currentVariableName = replacementVariable ? variableName + ReplaceConfiguration.REPLACEMENT_VARIABLE_SUFFIX : variableName; if (caret) { if (myCurrentVariableCallback != null) { myCurrentVariableCallback.accept(currentVariableName); } } } | handleInputFocusMovement |
292,428 | void () { final Document document = editor.getDocument(); if (modificationTimeStamp != document.getModificationStamp()) { variables.clear(); variables.addAll(TemplateImplUtil.parseVariableNames(document.getCharsSequence())); modificationTimeStamp = document.getModificationStamp(); updateEditorInlays(); } } | checkModelValidity |
292,429 | void (@NotNull CaretEvent e) { handleInputFocusMovement(e.getNewPosition(), true); } | caretPositionChanged |
292,430 | void (@NotNull DocumentEvent event) { // to handle backspace & delete (backspace strangely is not reported to the caret listener) handleInputFocusMovement(editor.getCaretModel().getLogicalPosition(), true); updateEditorInlays(); } | documentChanged |
292,431 | List<String> () { checkModelValidity(); return variables; } | getVariables |
292,432 | SubstitutionShortInfoHandler (Editor editor) { return editor == null ? null : editor.getUserData(LISTENER_KEY); } | retrieve |
292,433 | void (Editor editor, ShortFilterTextProvider provider, Disposable disposable) { install(editor, provider, null, disposable, false); } | install |
292,434 | void (Editor editor, ShortFilterTextProvider provider, @Nullable Consumer<? super String> currentVariableCallback, Disposable disposable, boolean replace) { final SubstitutionShortInfoHandler handler = new SubstitutionShortInfoHandler(editor, provider, replace, currentVariableCallback); editor.addEditorMouseMotionListener(handler, disposable); editor.getDocument().addDocumentListener(handler, disposable); editor.getCaretModel().addCaretListener(handler, disposable); editor.putUserData(LISTENER_KEY, handler); } | install |
292,435 | void (Editor editor) { final SubstitutionShortInfoHandler handler = retrieve(editor); if (handler != null) { handler.updateEditorInlays(); } } | updateEditorInlays |
292,436 | void (String text) { myText = text; } | setText |
292,437 | int (@NotNull Inlay inlay) { return getFontMetrics(inlay.getEditor()).stringWidth(myText) + 12; } | calcWidthInPixels |
292,438 | Font () { return UIManager.getFont("Label.font"); } | getFont |
292,439 | FontMetrics (Editor editor) { return editor.getContentComponent().getFontMetrics(getFont()) ; } | getFontMetrics |
292,440 | void (@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle r, @NotNull TextAttributes textAttributes) { final Editor editor = inlay.getEditor(); final TextAttributes attributes = editor.getColorsScheme().getAttributes(DefaultLanguageHighlighterColors.INLINE_PARAMETER_HINT); if (attributes == null) { return; } final FontMetrics metrics = getFontMetrics(editor); final Color backgroundColor = attributes.getBackgroundColor(); if (backgroundColor != null) { final GraphicsConfig config = GraphicsUtil.setupAAPainting(g); GraphicsUtil.paintWithAlpha(g, 0.55f); g.setColor(backgroundColor); g.fillRoundRect(r.x + 2, r.y, r.width - 4, r.height, 8, 8); config.restore(); } final Color foregroundColor = attributes.getForegroundColor(); if (foregroundColor != null) { g.setColor(foregroundColor); g.setFont(getFont()); g.drawString(myText, r.x + 6, r.y + metrics.getAscent()); } } | paint |
292,441 | ReplaceOptions () { throw new IllegalStateException(); } | getReplaceOptions |
292,442 | SearchConfiguration () { return new SearchConfiguration(this); } | copy |
292,443 | MatchOptions () { return matchOptions; } | getMatchOptions |
292,444 | NamedScriptableDefinition (@NotNull String name) { return matchOptions.getVariableConstraint(name); } | findVariable |
292,445 | void () { matchOptions.removeUnusedVariables(); } | removeUnusedVariables |
292,446 | void (Element element) { super.readExternal(element); matchOptions.readExternal(element); } | readExternal |
292,447 | void (Element element) { super.writeExternal(element); matchOptions.writeExternal(element); } | writeExternal |
292,448 | boolean (Object o) { if (this == o) return true; if (!(o instanceof SearchConfiguration)) return false; if (!super.equals(o)) return false; return matchOptions.equals(((SearchConfiguration)o).matchOptions); } | equals |
292,449 | int () { return 31 * super.hashCode() + matchOptions.hashCode(); } | hashCode |
292,450 | String (@NotNull Configuration configuration) { configuration = configuration.copy(); configuration.getMatchOptions().setScope(null); // don't export scope final String className = configuration.getClass().getSimpleName(); final Element element = new Element(Character.toLowerCase(className.charAt(0)) + className.substring(1)); configuration.writeExternal(element); if (Boolean.parseBoolean(element.getAttributeValue(OLD_CASE_SENSITIVE_ATTRIBUTE_NAME))) { element.setAttribute(CASE_SENSITIVE_ATTRIBUTE_NAME, "true"); } element.removeAttribute(OLD_CASE_SENSITIVE_ATTRIBUTE_NAME); return JDOMUtil.writeElement(element); } | toXml |
292,451 | void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { final StructuralSearchDialog dialog = parameters.getEditor().getUserData(StructuralSearchDialogKeys.STRUCTURAL_SEARCH_DIALOG); if (dialog == null) { final Boolean test = parameters.getEditor().getUserData(StructuralSearchDialogKeys.TEST_STRUCTURAL_SEARCH_DIALOG); if (test == null || !test) return; } final Document document = parameters.getEditor().getDocument(); final int end = parameters.getOffset(); final int line = document.getLineNumber(end); final int start = document.getLineStartOffset(line); String shortPrefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters); final CharSequence text = document.getCharsSequence(); if (StringUtil.startsWithChar(shortPrefix, '$')) { shortPrefix = shortPrefix.substring(1); Set<String> variableNames = TemplateImplUtil.parseVariableNames(text); for (String name : variableNames) { if (name.startsWith(shortPrefix) && !name.equals(shortPrefix)) { result.addElement(LookupElementBuilder.create('$' + name + '$') .withInsertHandler((context, item) -> { final int offset = context.getTailOffset(); if (text.length() > offset + 1) { final char c = text.charAt(offset); if (c == '$') { document.deleteString(offset, offset + 1); } } })); } } } final String prefix = parameters.isExtendedCompletion() ? shortPrefix : text.subSequence(start, end).toString(); if (StringUtil.containsChar(prefix, '$')) { return; } result.runRemainingContributors(parameters, cr -> { if (cr.getLookupElement().getObject() instanceof String) return; result.passResult(cr); }); CompletionResultSet insensitive = result.withPrefixMatcher(new CamelHumpMatcher(prefix)); ConfigurationManager configurationManager = ConfigurationManager.getInstance(parameters.getPosition().getProject()); for (Configuration configuration: configurationManager.getAllConfigurations()) { LookupElementBuilder element = LookupElementBuilder.create(configuration, configuration.getMatchOptions().getSearchPattern()) .withLookupString(configuration.getName()) .withTypeText(configuration.getTypeText(), true) .withIcon(configuration.getIcon()) .withCaseSensitivity(false) .withPresentableText(configuration.getName()); if (dialog != null) element = element.withInsertHandler((InsertionContext context, LookupElement item) -> context.setLaterRunnable( () -> dialog.loadConfiguration((Configuration)item.getObject()) )); insensitive.addElement(element); } } | fillCompletionVariants |
292,452 | void (@NotNull JList<? extends Configuration> list, Configuration value, int index, boolean selected, boolean hasFocus) { final MatchOptions matchOptions = value.getMatchOptions(); final LanguageFileType fileType = matchOptions.getFileType(); setIcon((fileType == null) ? AllIcons.FileTypes.Unknown : fileType.getIcon()); final String text; @NlsSafe final String searchPattern = collapseWhiteSpace(matchOptions.getSearchPattern()); if (value instanceof ReplaceConfiguration) { text = SSRBundle.message("replace.configuration.display.text", shortenTextWithEllipsis(searchPattern, 49, 0, true), shortenTextWithEllipsis(collapseWhiteSpace(value.getReplaceOptions().getReplacement()), 49, 0, true)); } else { text = shortenTextWithEllipsis(searchPattern, 100, 0, true); } setText(text); setEnabled(list.isEnabled()); } | customize |
292,453 | void (char c, @NotNull PsiFile file, @NotNull Editor editor) {} | beforeCharDeleted |
292,454 | boolean (char c, @NotNull PsiFile file, @NotNull Editor editor) { if (editor.getUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY) == null || !CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET) { return false; } if (c == '$') { final Document document = editor.getDocument(); final CharSequence text = document.getCharsSequence(); final Caret caret = editor.getCaretModel().getCurrentCaret(); final int offset = caret.getOffset(); final LogicalPosition position = caret.getLogicalPosition(); final int lineStart = document.getLineStartOffset(position.line); final int lineEnd = document.getLineEndOffset(position.line); if (text.length() > offset && text.charAt(offset) == '$' && StructuralSearchTypedHandler.hasOddDollar(text, lineStart, lineEnd)) { document.deleteString(offset, offset + 1); } return true; } return false; } | charDeleted |
292,455 | void (@Nullable Consumer<? super String> consumer) { myConsumer = consumer; } | setItemConsumer |
292,456 | void (@NotNull Collection<String> items) { if (items.isEmpty()) throw new IllegalArgumentException("items needs to contain at least one item"); myItems.clear(); myItems.addAll(items); if (!myItems.contains(mySelectedItem)) { setSelectedItem(myDefaultItem != null ? myDefaultItem : myItems.get(0)); } } | setItems |
292,457 | void (@NotNull JLabel label) { label.setLabelFor(this); label.getActionMap().put("release" /* BasicLabelUI.Actions.RELEASE */, new AbstractAction() { @Override public void actionPerformed(ActionEvent event) { doClick(); } }); } | setLabel |
292,458 | void (ActionEvent event) { doClick(); } | actionPerformed |
292,459 | String () { return mySelectedItem; } | getSelectedItem |
292,460 | void (@NlsContexts.Label String selectedItem) { if (!myItems.contains(selectedItem)) throw new IllegalArgumentException("selected item is not contained in items"); mySelectedItem = selectedItem; setText(selectedItem); } | setSelectedItem |
292,461 | void (@NlsContexts.Label String defaultItem) { myDefaultItem = defaultItem; setText(defaultItem); } | setDefaultItem |
292,462 | int () { return myItems.indexOf(mySelectedItem); } | getDefaultOptionIndex |
292,463 | StructuralSearchTemplateBuilder () { return ApplicationManager.getApplication().getService(StructuralSearchTemplateBuilder.class); } | getInstance |
292,464 | boolean (@NotNull HighlightInfo highlightInfo, @Nullable PsiFile file) { if (file == null) { return true; } final Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file); if (document == null) { return true; } final String contextId = document.getUserData(StructuralSearchDialogKeys.STRUCTURAL_SEARCH_PATTERN_CONTEXT_ID); if (contextId == null) { return true; } if (highlightInfo.getSeverity() != HighlightSeverity.ERROR) { return false; } if (!Registry.is("ssr.in.editor.problem.highlighting")) { return false; } final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(file); if (profile == null) { return true; } final PsiErrorElement error = findErrorElementAt(file, highlightInfo.startOffset, highlightInfo.getDescription()); if (error == null) { return false; } final boolean result = profile.shouldShowProblem(error); if (result) { final Runnable callback = document.getUserData(StructuralSearchDialogKeys.STRUCTURAL_SEARCH_ERROR_CALLBACK); if (callback != null) { ApplicationManager.getApplication().invokeLater(callback); } } return result; } | accept |
292,465 | PsiErrorElement (PsiFile file, int offset, String description) { final List<PsiErrorElement> errorList = ERRORS.get(file, findErrors(file)); for (PsiErrorElement element : errorList) { if (element.getTextOffset() == offset && description.equals(element.getErrorDescription())) { return element; } } return null; } | findErrorElementAt |
292,466 | List<PsiErrorElement> (PsiFile file) { final Collection<PsiErrorElement> errors = PsiTreeUtil.findChildrenOfType(file, PsiErrorElement.class); final List<PsiErrorElement> errorList = new ArrayList<>(errors); errorList.sort(ERROR_COMPARATOR); file.putUserData(ERRORS, errorList); return errorList; } | findErrors |
292,467 | Editor (@NotNull Document doc, Project project, boolean editable, @Nullable TemplateContextType contextType) { final Editor editor = editable ? EditorFactory.getInstance().createEditor(doc, project) : EditorFactory.getInstance().createViewer(doc, project); final EditorSettings editorSettings = editor.getSettings(); editorSettings.setVirtualSpace(false); editorSettings.setLineMarkerAreaShown(false); editorSettings.setIndentGuidesShown(false); editorSettings.setLineNumbersShown(false); editorSettings.setFoldingOutlineShown(false); editorSettings.setCaretRowShown(false); if (!editable) { final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); Color c = globalScheme.getColor(EditorColors.READONLY_BACKGROUND_COLOR); if (c == null) { c = globalScheme.getDefaultBackground(); } ((EditorEx)editor).setBackgroundColor(c); } else { ((EditorEx)editor).setEmbeddedIntoDialogWrapper(true); } TemplateEditorUtil.setHighlighter(editor, contextType); return editor; } | createEditor |
292,468 | void (@NotNull final Editor editor, String text) { final String value = text != null ? text : ""; final Document document = editor.getDocument(); WriteCommandAction.runWriteCommandAction(editor.getProject(), SSRBundle.message("modify.editor.content.command.name"), SS_GROUP, () -> document.replaceString(0, document.getTextLength(), value)); } | setContent |
292,469 | void (@NotNull EditorTextField editor, @NotNull String text) { final Document document = editor.getDocument(); WriteCommandAction.runWriteCommandAction(editor.getProject(), SSRBundle.message("modify.editor.content.command.name"), SS_GROUP, () -> document.replaceString(0, document.getTextLength(), text)); } | setContent |
292,470 | void (@NotNull Configuration config, @NotNull SearchContext context) { StructuralSearchAction.triggerAction(config, context, !(config instanceof SearchConfiguration)); } | invokeAction |
292,471 | MatchVariableConstraint (@NotNull String varName, @NotNull Configuration configuration) { final MatchOptions options = configuration.getMatchOptions(); final MatchVariableConstraint varInfo = options.getVariableConstraint(varName); if (varInfo != null) { return varInfo; } return configuration.getMatchOptions().addNewVariableConstraint(varName); } | getOrAddVariableConstraint |
292,472 | ReplacementVariableDefinition (@NotNull String varName, @NotNull Configuration configuration) { final ReplaceOptions replaceOptions = configuration.getReplaceOptions(); ReplacementVariableDefinition definition = replaceOptions.getVariableDefinition(varName); if (definition != null) { return definition; } return replaceOptions.addNewVariableDefinition(varName); } | getOrAddReplacementVariable |
292,473 | boolean (@NotNull String varName, @NotNull MatchOptions matchOptions) { if (Configuration.CONTEXT_VAR_NAME.equals(varName)) { // Complete Match is default target for (String name : matchOptions.getVariableConstraintNames()) { if (!name.equals(Configuration.CONTEXT_VAR_NAME)) { if (matchOptions.getVariableConstraint(name).isPartOfSearchResults()) { return false; } } } return true; } final MatchVariableConstraint constraint = matchOptions.getVariableConstraint(varName); if (constraint == null) { return false; } return constraint.isPartOfSearchResults(); } | isTarget |
292,474 | EditorTextField (@NotNull String text, @NotNull Project project) { return createEditorComponent(text, "1.txt", project); } | createTextComponent |
292,475 | EditorTextField (@NotNull String text, @NotNull Project project) { return createEditorComponent(text, "1.regexp", project); } | createRegexComponent |
292,476 | EditorTextField (@NotNull String text, @NotNull Project project) { return createEditorComponent(text, "1.groovy", project); } | createScriptComponent |
292,477 | EditorTextField (@NotNull String text, @NotNull String fileName, @NotNull Project project) { final FileType fileType = getFileType(fileName); final Document document = createDocument(fileType, text, project); return new EditorTextField(document, project, fileType); } | createEditorComponent |
292,478 | Document (@NotNull FileType fileType, @NotNull String text, @NotNull Project project) { final PsiFile file = PsiFileFactory.getInstance(project).createFileFromText("Dummy." + fileType.getDefaultExtension(), fileType, text, -1, true); final Document document = PsiDocumentManager.getInstance(project).getDocument(file); assert document != null; return document; } | createDocument |
292,479 | FileType (@NotNull String fileName) { FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName); if (fileType == FileTypes.UNKNOWN) fileType = FileTypes.PLAIN_TEXT; return fileType; } | getFileType |
292,480 | LanguageFileType (@NotNull SearchContext searchContext) { final PsiFile file = searchContext.getFile(); PsiElement context = null; final Editor editor = searchContext.getEditor(); if (editor != null && file != null) { final int offset = editor.getCaretModel().getOffset(); context = InjectedLanguageManager.getInstance(searchContext.getProject()).findInjectedElementAt(file, offset); if (context == null) { context = file.findElementAt(offset); } if (context != null) { context = context.getParent(); } if (context == null) { context = file; } } if (context != null) { final Language language = context.getLanguage(); final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByLanguage(language); if (profile != null) { LanguageFileType fileType = profile.detectFileType(context); if (fileType == null) { fileType = language.getAssociatedFileType(); } if (fileType != null) return fileType; } } return StructuralSearchUtil.getDefaultFileType(); } | detectFileType |
292,481 | Document (@NotNull Project project, @Nullable LanguageFileType fileType, Language dialect, PatternContext patternContext, @NotNull String text, @Nullable StructuralSearchProfile profile) { if (fileType != null && profile != null) { final String contextId = (patternContext == null) ? null : patternContext.getId(); PsiFile codeFragment = profile.createCodeFragment(project, text, contextId); if (codeFragment == null) { codeFragment = createFileFragment(project, fileType, dialect, text); } if (codeFragment != null) { final Document doc = PsiDocumentManager.getInstance(project).getDocument(codeFragment); assert doc != null : "code fragment element should be physical"; return doc; } } return EditorFactory.getInstance().createDocument(text); } | createDocument |
292,482 | Editor (@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect, @NotNull String text, boolean editable, @NotNull StructuralSearchProfile profile) { PsiFile codeFragment = profile.createCodeFragment(project, text, null); if (codeFragment == null) { codeFragment = createFileFragment(project, fileType, dialect, text); } final Document doc; if (codeFragment != null) { doc = PsiDocumentManager.getInstance(project).getDocument(codeFragment); assert doc != null : "code fragment element should be physical"; DaemonCodeAnalyzer.getInstance(project).setHighlightingEnabled(codeFragment, false); } else { doc = EditorFactory.getInstance().createDocument(""); } return createEditor(doc, project, editable, getTemplateContextType(profile)); } | createEditor |
292,483 | PsiFile (@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect, @NotNull String text) { final String name = "__dummy." + fileType.getDefaultExtension(); final PsiFileFactory factory = PsiFileFactory.getInstance(project); return dialect == null ? factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), true, true) : factory.createFileFromText(name, dialect, text, true, true); } | createFileFragment |
292,484 | TemplateContextType (@NotNull StructuralSearchProfile profile) { final Class<? extends TemplateContextType> clazz = profile.getTemplateContextTypeClass(); return TemplateContextTypes.getByClass(clazz); } | getTemplateContextType |
292,485 | UsageViewContext () { final Runnable searchStarter = () -> new SearchCommand(myConfiguration, mySearchContext).startSearching(); return new UsageViewContext(myConfiguration, mySearchContext, searchStarter); } | createUsageViewContext |
292,486 | void () { final UsageViewContext context = createUsageViewContext(); final UsageViewPresentation presentation = new UsageViewPresentation(); presentation.setOpenInNewTab(FindSettings.getInstance().isShowResultsInSeparateView()); context.configure(presentation); myProcessPresentation = new FindUsagesProcessPresentation(presentation); myProcessPresentation.setShowNotFoundMessage(true); myProcessPresentation.setShowPanelIfOnlyOneUsage(true); PsiDocumentManager.getInstance(mySearchContext.getProject()).commitAllDocuments(); final ConfigurableUsageTarget target = context.getTarget(); ((FindManagerImpl)FindManager.getInstance(mySearchContext.getProject())).getFindUsagesManager().addToHistory(target); UsageViewManager.getInstance(mySearchContext.getProject()).searchAndShowUsages( new UsageTarget[]{target}, () -> processor -> findUsages(processor), myProcessPresentation, presentation, new UsageViewManager.UsageViewStateListener() { @Override public void usageViewCreated(@NotNull UsageView usageView) { context.setUsageView(usageView); context.configureActions(); } @Override public void findingUsagesFinished(final UsageView usageView) {} } ); } | startSearching |
292,487 | void (@NotNull UsageView usageView) { context.setUsageView(usageView); context.configureActions(); } | usageViewCreated |
292,488 | void (final UsageView usageView) {} | findingUsagesFinished |
292,489 | void (@NotNull Processor<? super Usage> processor) { final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); progress.setIndeterminate(false); final MatchResultSink sink = new MatchResultSink() { int count; @Override public void setMatchingProcess(@NotNull MatchingProcess _process) { findStarted(); } @Override public void processFile(@NotNull PsiFile element) { final VirtualFile virtualFile = element.getVirtualFile(); if (virtualFile != null) progress.setText(SSRBundle.message("looking.in.progress.message", virtualFile.getPresentableName())); } @Override public void matchingFinished() { if (mySearchContext.getProject().isDisposed()) return; findEnded(); progress.setText(SSRBundle.message("found.progress.message", count)); } @Override public ProgressIndicator getProgressIndicator() { return progress; } @Override public void newMatch(@NotNull MatchResult result) { UsageInfo info; if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) { int start = -1; int end = -1; PsiElement parent = result.getMatch().getParent(); for (final MatchResult matchResult : result.getChildren()) { PsiElement el = matchResult.getMatch(); final int elementStart = el.getTextRange().getStartOffset(); if (start == -1 || start > elementStart) { start = elementStart; } final int newend = elementStart + el.getTextLength(); if (newend > end) { end = newend; } } final int parentStart = parent.getTextRange().getStartOffset(); int startOffset = start - parentStart; info = new UsageInfo(parent, startOffset, end - parentStart); } else { final PsiElement match = result.getMatch(); if (!match.isPhysical()) { // e.g. lambda parameter anonymous type element return; } info = new UsageInfo(match); } final Usage usage = new UsageInfo2UsageAdapter(info); foundUsage(result, usage); processor.process(usage); ++count; } }; try { new Matcher(mySearchContext.getProject(), myConfiguration.getMatchOptions()).findMatches(sink); } catch (StructuralSearchException e) { myProcessPresentation.setShowNotFoundMessage(false); @SuppressWarnings("InstanceofCatchParameter") String content = e instanceof StructuralSearchScriptException ? SSRBundle.message("search.script.problem", e.getCause().toString().replace(ScriptSupport.UUID, "")) : SSRBundle.message("search.template.problem", e.getMessage()); NotificationGroupManager.getInstance() .getNotificationGroup(UIUtil.SSR_NOTIFICATION_GROUP_ID) .createNotification(content, NotificationType.ERROR) .setImportant(true) .notify(mySearchContext.getProject()); } } | findUsages |
292,490 | void (@NotNull MatchingProcess _process) { findStarted(); } | setMatchingProcess |
292,491 | void (@NotNull PsiFile element) { final VirtualFile virtualFile = element.getVirtualFile(); if (virtualFile != null) progress.setText(SSRBundle.message("looking.in.progress.message", virtualFile.getPresentableName())); } | processFile |
292,492 | void () { if (mySearchContext.getProject().isDisposed()) return; findEnded(); progress.setText(SSRBundle.message("found.progress.message", count)); } | matchingFinished |
292,493 | ProgressIndicator () { return progress; } | getProgressIndicator |
292,494 | void (@NotNull MatchResult result) { UsageInfo info; if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) { int start = -1; int end = -1; PsiElement parent = result.getMatch().getParent(); for (final MatchResult matchResult : result.getChildren()) { PsiElement el = matchResult.getMatch(); final int elementStart = el.getTextRange().getStartOffset(); if (start == -1 || start > elementStart) { start = elementStart; } final int newend = elementStart + el.getTextLength(); if (newend > end) { end = newend; } } final int parentStart = parent.getTextRange().getStartOffset(); int startOffset = start - parentStart; info = new UsageInfo(parent, startOffset, end - parentStart); } else { final PsiElement match = result.getMatch(); if (!match.isPhysical()) { // e.g. lambda parameter anonymous type element return; } info = new UsageInfo(match); } final Usage usage = new UsageInfo2UsageAdapter(info); foundUsage(result, usage); processor.process(usage); ++count; } | newMatch |
292,495 | void () {} | findStarted |
292,496 | void () {} | findEnded |
292,497 | void (MatchResult result, Usage usage) {} | foundUsage |
292,498 | PsiFile () { return myFile; } | getFile |
292,499 | Project () { return myProject; } | getProject |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.