Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
283,800
int () { if (getDelegate() instanceof NodeDescriptor) { return ((NodeDescriptor<?>)getDelegate()).getWeight(); } return super.getWeight(); }
getWeight
283,801
boolean () { if (myDelegate instanceof SimpleNode) { return ((SimpleNode)myDelegate).isAlwaysShowPlus(); } return super.isAlwaysShowPlus(); }
isAlwaysShowPlus
283,802
boolean () { if (myDelegate instanceof SimpleNode) { return ((SimpleNode)myDelegate).isAlwaysLeaf(); } return super.isAlwaysLeaf(); }
isAlwaysLeaf
283,803
void (T elt) { super.addToFiltered(elt); if (myNamer != null) { String name = myNamer.fun(elt); if (name != null) { String filterString = StringUtil.toUpperCase(myPattern.compute()); String candidateString = StringUtil.toUpperCase(name); int index = getSize() - 1; if (myFullMatchIndex == -1 && filterString.equals(candidateString)) { myFullMatchIndex = index; } if (myStartsWithIndex == -1 && candidateString.startsWith(filterString)) { myStartsWithIndex = index; } } } }
addToFiltered
283,804
void () { myFullMatchIndex = -1; myStartsWithIndex = -1; super.refilter(); }
refilter
283,805
int () { return myFullMatchIndex != -1 ? myFullMatchIndex : myStartsWithIndex; }
getClosestMatchIndex
283,806
boolean () { return false; }
supportsNavigation
283,807
void (@NotNull JComponent component) { installSupplyTo(component, true); }
installSupplyTo
283,808
void (@NotNull JComponent component, boolean withRepaint) { component.putClientProperty(SPEED_SEARCH_COMPONENT_MARKER, this); if(withRepaint) addChangeListener(evt -> component.repaint()); }
installSupplyTo
283,809
boolean (Object o) { return false; }
isObjectFilteredOut
283,810
void (final Listener<T> listener, final Disposable parent) { myListeners.add(listener); Disposer.register(parent, new Disposable() { @Override public void dispose() { myListeners.remove(listener); } }); }
addListener
283,811
void () { myListeners.remove(listener); }
dispose
283,812
void (ListDataEvent e) { refilter(); }
contentsChanged
283,813
void (ListDataEvent e) { refilter(); }
intervalAdded
283,814
void (ListDataEvent e) { refilter(); }
intervalRemoved
283,815
void () { myOriginalModel.removeListDataListener(myListDataListener); }
dispose
283,816
void (Condition<? super T> condition) { myCondition = condition; refilter(); }
setFilter
283,817
void () { int index1 = myData.size() - 1; if (index1 >= 0) { myData.clear(); fireIntervalRemoved(this, 0, index1); } }
removeAllElements
283,818
void () { removeAllElements(); int count = 0; Collection<T> elements = getElementsToFilter(); for (T elt : elements) { if (passElement(elt)) { addToFiltered(elt); count++; } } if (count > 0) { fireIntervalAdded(this, 0, count - 1); } }
refilter
283,819
Collection<T> () { ArrayList<T> result = new ArrayList<>(); for (int i = 0; i < myOriginalModel.getSize(); i++) { result.add(myOriginalModel.getElementAt(i)); } return result; }
getElementsToFilter
283,820
void (T elt) { myData.add(elt); }
addToFiltered
283,821
int () { return myData.size(); }
getSize
283,822
T (int index) { return myData.get(index); }
getElementAt
283,823
int (T element) { return myData.indexOf(element); }
getElementIndex
283,824
boolean (T element) { return myCondition == null || myCondition.value(element); }
passElement
283,825
boolean (T value) { return myData.contains(value); }
contains
283,826
ListModel<T> () { return myOriginalModel; }
getOriginalModel
283,827
void (List<? extends T> elements) { ListUtil.addAllItems(myOriginalModel, elements); }
addAll
283,828
void (List<? extends T> elements) { ListUtil.removeAllItems(myOriginalModel); ListUtil.addAllItems(myOriginalModel, elements); }
replaceAll
283,829
void (int index) { ListUtil.removeItem(myOriginalModel, index); }
remove
283,830
void (String letter) { updatePattern(myString + letter); }
type
283,831
void () { if (myString.length() > 0) { updatePattern(myString.substring(0, myString.length() - 1)); } }
backspace
283,832
boolean (String string) { return string == null || myString.length() == 0 || (myMatcher != null && myMatcher.matches(string)); }
shouldBeShowing
283,833
void (KeyEvent e) { if (e.isConsumed() || !myEnabled) return; String old = myString; if (e.getID() == KeyEvent.KEY_PRESSED) { if (KeymapUtil.isEventForAction(e, "EditorDeleteToWordStart")) { if (isHoldingFilter()) { while (!myString.isEmpty() && !Character.isWhitespace(myString.charAt(myString.length() - 1))) { backspace(); } e.consume(); } } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { backspace(); e.consume(); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { if (isHoldingFilter()) { updatePattern(""); e.consume(); } else if (myJustActivated) { // Special case: speed search was activated through the API without typing anything, should be cancelled on Esc. myJustActivated = false; update(); e.consume(); } } } else if (e.getID() == KeyEvent.KEY_TYPED) { if (!UIUtil.isReallyTypedEvent(e)) return; // key-char is good only on KEY_TYPED // for example: key-char on ctrl-J PRESSED is \n // see https://en.wikipedia.org/wiki/Control_character char ch = e.getKeyChar(); if (Character.isLetterOrDigit(ch) || !startedWithWhitespace(ch) && PUNCTUATION_MARKS.indexOf(ch) != -1) { type(Character.toString(ch)); e.consume(); } } if (!old.equalsIgnoreCase(myString)) { update(); } }
processKeyEvent
283,834
boolean (char ch) { return !isHoldingFilter() && Character.isWhitespace(ch); }
startedWithWhitespace
283,835
void () { }
update
283,836
void () { }
noHits
283,837
boolean () { return myEnabled && myString.length() > 0; }
isHoldingFilter
283,838
void (boolean enabled) { myEnabled = enabled; }
setEnabled
283,839
void () { if (isHoldingFilter()) { updatePattern(""); } if (myEnabled) { update(); } }
reset
283,840
String () { return myString; }
getFilter
283,841
void (final String string) { if (myString.equals(string)) return; myJustActivated = false; String prevString = myString; myString = string; try { String pattern = "*" + string; NameUtil.MatchingCaseSensitivity caseSensitivity = NameUtil.MatchingCaseSensitivity.NONE; String separators = SpeedSearchUtil.getDefaultHardSeparators(); NameUtil.MatcherBuilder builder = new NameUtil.MatcherBuilder(pattern).withCaseSensitivity(caseSensitivity) .withSeparators(separators); if (myMatchAllOccurrences) { builder = builder.allOccurrences(); } myMatcher = builder.build(); } catch (Exception e) { myMatcher = null; } fireStateChanged(prevString); }
updatePattern
283,842
void () { }
refreshSelection
283,843
boolean () { return isHoldingFilter(); }
isPopupActive
283,844
boolean () { return false; // Disabled by default because has to be implemented differently for every subclass. }
isSupported
283,845
boolean () { return true; // Convenient default for implementations, is ignored anyway when isSupported() == false. }
isAvailable
283,846
boolean () { return isPopupActive(); }
isActive
283,847
boolean () { return myJustActivated || isHoldingFilter(); }
shouldBeActive
283,848
JComponent () { return null; }
getTextField
283,849
void () { myJustActivated = true; doActivate(); }
activate
283,850
void () { }
doActivate
283,851
void (@NotNull PropertyChangeListener listener) { myChangeSupport.addPropertyChangeListener(listener); }
addChangeListener
283,852
void (@NotNull PropertyChangeListener listener) { myChangeSupport.removePropertyChangeListener(listener); }
removeChangeListener
283,853
void (String prevString) { myChangeSupport.firePropertyChange(SpeedSearchSupply.ENTERED_PREFIX_PROPERTY_NAME, prevString, getEnteredPrefix()); }
fireStateChanged
283,854
void (@NotNull String searchQuery) { }
findAndSelectElement
283,855
void (KeyEvent e) { processKeyEvent(e); }
keyTyped
283,856
void (KeyEvent e) { processKeyEvent(e); }
keyPressed
283,857
void (KeyEvent e) { processKeyEvent(e); }
keyReleased
283,858
String () { return "\u001F"; }
getDefaultHardSeparators
283,859
void (@NotNull JComponent speedSearchEnabledComponent, @NotNull SimpleColoredComponent coloredComponent, boolean mainTextOnly, boolean selected) { SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent); if (speedSearch == null) return; applySpeedSearchHighlighting(speedSearch, coloredComponent, mainTextOnly, selected); }
applySpeedSearchHighlighting
283,860
void (@NotNull SpeedSearchSupply speedSearch, @NotNull SimpleColoredComponent coloredComponent, boolean mainTextOnly, boolean selected) { // The bad thing is that SpeedSearch model is decoupled from UI presentation so we don't know the real matched text. // Our best guess is to get string from the ColoredComponent. We can only provide main-text-only option. Iterable<TextRange> ranges = speedSearch.matchingFragments(coloredComponent.getCharSequence(mainTextOnly).toString()); applySpeedSearchHighlighting(coloredComponent, ranges, selected); }
applySpeedSearchHighlighting
283,861
void (@NotNull SimpleColoredComponent coloredComponent, @Nullable Iterable<? extends TextRange> ranges, boolean selected) { Iterator<? extends TextRange> rangesIterator = ranges != null ? ranges.iterator() : null; if (rangesIterator == null || !rangesIterator.hasNext()) return; Color bg = UIUtil.getTreeBackground(selected, true); SimpleColoredComponent.ColoredIterator coloredIterator = coloredComponent.iterator(); TextRange range = rangesIterator.next(); main: while (coloredIterator.hasNext()) { coloredIterator.next(); int offset = coloredIterator.getOffset(); int endOffset = coloredIterator.getEndOffset(); if (!range.intersectsStrict(offset, endOffset)) continue; SimpleTextAttributes attributes = coloredIterator.getTextAttributes(); SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, attributes.getFgColor(), null, attributes.getStyle() | SimpleTextAttributes.STYLE_SEARCH_MATCH); do { if (range.getStartOffset() > offset) { offset = coloredIterator.split(range.getStartOffset() - offset, attributes); } if (range.getEndOffset() <= endOffset) { offset = coloredIterator.split(range.getEndOffset() - offset, highlighted); if (rangesIterator.hasNext()) { range = rangesIterator.next(); } else { break main; } } else { coloredIterator.split(endOffset - offset, highlighted); continue main; } } while (range.intersectsStrict(offset, endOffset)); } }
applySpeedSearchHighlighting
283,862
void (@NotNull JComponent speedSearchEnabledComponent, @NotNull @NlsContexts.Label String text, @NotNull SimpleTextAttributes attributes, boolean selected, @NotNull SimpleColoredComponent simpleColoredComponent) { final SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent); if (speedSearch != null) { final Iterable<TextRange> fragments = speedSearch.matchingFragments(text); if (fragments != null) { appendSpeedSearchColoredFragments(simpleColoredComponent, text, fragments, attributes, selected); return; } } simpleColoredComponent.append(text, attributes); }
appendFragmentsForSpeedSearch
283,863
void (@NotNull @NlsContexts.Label String text, SimpleColoredComponent component, final @NotNull SimpleTextAttributes attributes, @Nullable Matcher matcher, Color selectedBg, boolean selected) { if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) { component.append(text, attributes); return; } final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text); component.setDynamicSearchMatchHighlighting(iterable != null); if (iterable != null) { final Color fg = attributes.getFgColor(); final int style = attributes.getStyle(); final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg); final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH); appendColoredFragments(component, text, iterable, plain, highlighted); } else { component.append(text, attributes); } }
appendColoredFragmentForMatcher
283,864
void (@NotNull SimpleColoredComponent simpleColoredComponent, @NotNull @NlsContexts.Label String text, @NotNull Iterable<? extends TextRange> colored, @NotNull SimpleTextAttributes attributes, boolean selected) { final Color fg = attributes.getFgColor(); final Color bg = UIUtil.getTreeBackground(selected, true); final int style = attributes.getStyle(); final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg); final SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH); appendColoredFragments(simpleColoredComponent, text, colored, plain, highlighted); }
appendSpeedSearchColoredFragments
283,865
void (final SimpleColoredComponent simpleColoredComponent, final @Nls String text, Iterable<? extends TextRange> colored, final SimpleTextAttributes plain, final SimpleTextAttributes highlighted) { final List<Pair<String, Integer>> searchTerms = new ArrayList<>(); for (TextRange fragment : colored) { searchTerms.add(Pair.create(fragment.substring(text), fragment.getStartOffset())); } int lastOffset = 0; for (Pair<String, Integer> pair : searchTerms) { if (pair.second > lastOffset) { simpleColoredComponent.append(text.substring(lastOffset, pair.second), plain); } simpleColoredComponent.append(text.substring(pair.second, pair.second + pair.first.length()), highlighted); lastOffset = pair.second + pair.first.length(); } if (lastOffset < text.length()) { simpleColoredComponent.append(text.substring(lastOffset), plain); } }
appendColoredFragments
283,866
void (@NotNull JTree tree, @NotNull Object value, @NotNull SimpleColoredComponent coloredComponent, boolean mainTextOnly, boolean selected) { SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(tree); if (speedSearch != null && !speedSearch.isObjectFilteredOut(value)) { applySpeedSearchHighlighting(tree, coloredComponent, mainTextOnly, selected); } }
applySpeedSearchHighlightingFiltered
283,867
void () { myOriginalModel.removeTableModelListener(myListDataListener); }
dispose
283,868
void (Condition<? super T> condition) { myCondition = condition; refilter(); }
setFilter
283,869
void () { int index1 = myData.size() - 1; if (index1 >= 0) { myData.clear(); fireTableRowsDeleted(0, index1); } myIndex.clear(); }
removeAllElements
283,870
void () { removeAllElements(); int count = 0; for (int i = 0; i < myOriginalModel.getRowCount(); i++) { Object valueAt = myOriginalModel.getValueAt(i, 0); boolean include = false; if (valueAt != null && myClz.isAssignableFrom(valueAt.getClass())) { //noinspection unchecked final T element = (T)valueAt; if (passElement(element)) { include = true; } } else { include = true; } if (include) { List<T> elements = new ArrayList<>(myOriginalModel.getColumnCount()); for (int col = 0; col < myOriginalModel.getColumnCount(); col++) { //noinspection unchecked elements.add((T)myOriginalModel.getValueAt(i, col)); } addToFiltered(elements); myIndex.add(i); count++; } } if (count > 0) { fireTableRowsInserted(0, count - 1); } }
refilter
283,871
boolean (int rowIndex, int columnIndex) { return myOriginalModel.isCellEditable(myIndex.get(rowIndex), columnIndex); }
isCellEditable
283,872
void (Object aValue, int rowIndex, int columnIndex) { myOriginalModel.setValueAt(aValue, myIndex.get(rowIndex), columnIndex); }
setValueAt
283,873
String (int column) { return myOriginalModel.getColumnName(column); }
getColumnName
283,874
void (List<T> elt) { myData.add(elt); }
addToFiltered
283,875
int () { return myData.size(); }
getSize
283,876
boolean (T element) { return myCondition == null || myCondition.value(element); }
passElement
283,877
int () { return myData.size(); }
getRowCount
283,878
int () { return myOriginalModel.getColumnCount(); }
getColumnCount
283,879
Object (int rowIndex, int columnIndex) { if (rowIndex >= myData.size() || rowIndex < 0 || columnIndex < 0 || columnIndex >= getColumnCount()) { return null; } return myData.get(rowIndex).get(columnIndex); }
getValueAt
283,880
TableModel () { return myOriginalModel; }
getOriginalModel
283,881
int (int idx) { return idx < 0 ? idx : idx >= myIndex.size() ? idx : myIndex.get(idx); }
getOriginalIndex
283,882
Object (@NotNull @NonNls String dataId) { if (PlatformDataKeys.SPEED_SEARCH_TEXT.is(dataId)) { return mySearchField.getText(); } return null; }
getData
283,883
void (ActionEvent e) { mySpeedSearch.type(CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor)); mySpeedSearch.update(); }
actionPerformed
283,884
void (FocusEvent e) { super.processFocusEvent(e); if (e.getID() == FocusEvent.FOCUS_GAINED) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myList, true)); } }
processFocusEvent
283,885
boolean () { boolean hadPattern = mySpeedSearch.isHoldingFilter(); if (mySearchField.isVisible()) { mySpeedSearch.reset(); } return hadPattern; }
resetFilter
283,886
SpeedSearch () { return mySpeedSearch; }
getSpeedSearch
283,887
void (@NotNull DocumentEvent e) { if (myInUpdate) return; if (mySearchField.getText().isEmpty()) { mySpeedSearch.reset(); } }
textChanged
283,888
void () { myInUpdate = true; Color searchBg = mySearchFieldWithoutBorder ? myList.getBackground() : UIUtil.getTextFieldBackground(); mySearchField.getTextEditor().setBackground(searchBg); onSpeedSearchPatternChanged(); mySearchField.setText(getFilter()); if (!mySearchAlwaysVisible) { if (shouldBeActive() && !searchFieldShown) { mySearchField.setVisible(true); searchFieldShown = true; } else if (!shouldBeActive() && searchFieldShown) { mySearchField.setVisible(false); searchFieldShown = false; } } myInUpdate = false; revalidate(); }
update
283,889
void () { mySearchField.getTextEditor().setBackground(LightColors.RED); }
noHits
283,890
void () { JBPopup popup = PopupUtil.getPopupContainerFor(mySearchField); if (popup != null) { popup.pack(false, myAutoPackHeight); } ListWithFilter.this.revalidate(); }
revalidate
283,891
boolean () { return true; }
isSupported
283,892
JComponent () { return mySearchField; }
getTextField
283,893
void () { update(); }
doActivate
283,894
void () { T prevSelection = myList.getSelectedValue(); // save to restore the selection on filter drop myModel.refilter(); if (myModel.getSize() > 0) { int fullMatchIndex = mySpeedSearch.isHoldingFilter() ? myModel.getClosestMatchIndex() : myModel.getElementIndex(prevSelection); if (fullMatchIndex != -1) { ScrollingUtil.selectItem(myList, fullMatchIndex); } if (myModel.getSize() <= myList.getSelectedIndex() || !myModel.contains(myList.getSelectedValue())) { ScrollingUtil.selectItem(myList, 0); } } else { mySpeedSearch.noHits(); revalidate(); } }
onSpeedSearchPatternChanged
283,895
JList<T> () { return myList; }
getList
283,896
JScrollPane () { return myScrollPane; }
getScrollPane
283,897
void (boolean autoPackHeight) { myAutoPackHeight = autoPackHeight; }
setAutoPackHeight
283,898
void () { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myList, true)); }
requestFocus
283,899
void (@NotNull JComponent component, @NotNull Disposable parent) { addTo(component); Disposer.register(parent, () -> removeFrom(component)); }
addTo