Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
242,100
EditorCssFontResolver (@NotNull Editor editor) { EditorCssFontResolver result = editor.getUserData(LOCAL_KEY); if (result == null) { // it's fine to have multiple instances of resolver per editor, so we don't care about races here editor.putUserData(LOCAL_KEY, result = new EditorCssFontResolver(editor)); } return resul...
getInstance
242,101
Font (@NotNull Font defaultFont, @NotNull AttributeSet attributeSet) { Object fontFamily = attributeSet.getAttribute(CSS.Attribute.FONT_FAMILY); if (fontFamily == null) { return defaultFont; } String fontFamilyAsString = fontFamily.toString(); if (!EDITOR_FONT_NAME_PLACEHOLDER.equals(fontFamilyAsString) && !EDITOR_FONT...
getFont
242,102
Integer (@NotNull Editor editor, int lineNumber) { int result = myFunction.applyAsInt(lineNumber - 1); return result < 0 ? null : result + 1; }
convert
242,103
Integer (@NotNull Editor editor) { for (int i = editor.getDocument().getLineCount(); i > 0; i--) { int number = myFunction.applyAsInt(i - 1); if (number >= 0) { return number + 1; } } return 0; }
getMaxLineNumber
242,104
boolean (@NotNull EditorMouseEvent event) { ActionGroup group = getActionGroup(event); if (group == null) return true; event.consume(); MouseEvent mouseEvent = event.getMouseEvent(); Component c = mouseEvent.getComponent(); if (c == null || !c.isShowing()) return true; JPopupMenu popupMenu = ActionManager.getInstance()...
handlePopup
242,105
void () { Set<Document> documentsToStrip = new HashSet<>(myDocumentsToStripLater); myDocumentsToStripLater.clear(); for (Document document : documentsToStrip) { strip(document); } }
beforeAllDocumentsSaving
242,106
void (@NotNull Document document) { strip(document); }
beforeDocumentSaving
242,107
void (final @NotNull Document document) { TrailingSpacesOptions options = getOptions(document); if (options == null) return; if (options.isStripTrailingSpaces()) { boolean success = strip(document, options.isChangedLinesOnly(), options.isKeepTrailingSpacesOnCaretLine()); if (!success) { myDocumentsToStripLater.add(docu...
strip
242,108
void () { if (CharArrayUtil.containsOnlyWhiteSpaces(content.subSequence(start, end)) && options.isStripTrailingSpaces() && !(options.isKeepTrailingSpacesOnCaretLine() && hasCaretIn(start, end))) { document.deleteString(start, end); } else { document.insertString(end, "\n"); } }
run
242,109
boolean (int start, int end) { for (Editor activeEditor : getActiveEditors(document)) { for (Caret caret : activeEditor.getCaretModel().getAllCarets()) { int offset = caret.getOffset(); if (offset >= start && offset <= end) return true; } } return false; }
hasCaretIn
242,110
void (@NotNull Document document, boolean keepLast) { if (document.getLineCount() > 0) { int endOffset = document.getTextLength() - 1; Ref<Integer> deleteToExclusive = Ref.create(endOffset + 1); CharSequence content = document.getCharsSequence(); int blankAreaOffset = CharArrayUtil.shiftBackward(content, endOffset, " \...
removeTrailngBlankLines
242,111
void () { document.deleteString(firstNewLineOffset, deleteToExclusive.get()); }
run
242,112
void (@NotNull DocumentRunnable documentRunnable) { ApplicationManager.getApplication().runWriteAction( () -> CommandProcessor.getInstance().runUndoTransparentAction(documentRunnable) ); }
performUndoableWrite
242,113
void (@NotNull Document document) { if (document instanceof DocumentWindow) { document = ((DocumentWindow)document).getDelegate(); } if (!(document instanceof DocumentImpl)) { return; } TrailingSpacesOptions options = getOptions(document); if (options == null) return; List<Editor> activeEditors = getActiveEditors(docum...
clearLineModificationFlags
242,114
List<Editor> (@NotNull Document document) { Application application = ApplicationManager.getApplication(); // ignore caret placing when exiting if (application.isDisposed()) { return Collections.emptyList(); } List<Editor> activeEditors = new ArrayList<>(); Editor localEditor = getActiveLocalEditor(document); if (local...
getActiveEditors
242,115
Editor (@NotNull Document document) { Component focusOwner = IdeFocusManager.getGlobalInstance().getFocusOwner(); DataContext dataContext = DataManager.getInstance().getDataContext(focusOwner); Editor activeEditor = CommonDataKeys.EDITOR.getData(dataContext); if (activeEditor != null && activeEditor.getDocument() != do...
getActiveLocalEditor
242,116
boolean (@NotNull Document document, boolean inChangedLinesOnly, boolean skipCaretLines) { if (document instanceof DocumentWindow) { document = ((DocumentWindow)document).getDelegate(); } if (!(document instanceof DocumentImpl)) { return true; } List<Editor> activeEditors = getActiveEditors(document); final List<Caret>...
strip
242,117
void (@NotNull List<? extends Editor> editors, @NotNull Runnable runnable) { runBatchCaretOperation(editors, 0, runnable); }
runBatchCaretOperation
242,118
void (@NotNull List<? extends Editor> editors, int startIndex, @NotNull Runnable runnable) { if (startIndex >= editors.size()) { runnable.run(); return; } editors.get(startIndex).getCaretModel().runBatchCaretOperation(() -> { runBatchCaretOperation(editors, startIndex + 1, runnable); }); }
runBatchCaretOperation
242,119
void (@NotNull Document doc) { myDocumentsToStripLater.remove(doc); }
documentDeleted
242,120
void () { myDocumentsToStripLater.clear(); }
unsavedDocumentsDropped
242,121
void (@NotNull VirtualFile file, boolean enabled) { DISABLE_FOR_FILE_KEY.set(file, enabled ? null : Boolean.TRUE); }
setEnabled
242,122
boolean (@NotNull VirtualFile file) { return !Boolean.TRUE.equals(DISABLE_FOR_FILE_KEY.get(file)); }
isEnabled
242,123
void (@Nullable Boolean stripTrailingSpaces) { if (stripTrailingSpaces != null && myStripTrailingSpaces == null) { myStripTrailingSpaces = stripTrailingSpaces; } }
setStripTrailingSpaces
242,124
void (@Nullable Boolean removeTrailingBlankLines) { if (removeTrailingBlankLines != null && myRemoveTrailingBlankLines == null) { myRemoveTrailingBlankLines = removeTrailingBlankLines; } }
setRemoveTrailingBlankLines
242,125
void (@Nullable Boolean ensureNewLineAtEOF) { if (ensureNewLineAtEOF != null && myEnsureNewLineAtEOF == null) { myEnsureNewLineAtEOF = ensureNewLineAtEOF; } }
setEnsureNewLineAtEOF
242,126
void (@Nullable Boolean changedLinesOnly) { if (changedLinesOnly != null && myChangedLinesOnly == null) { myChangedLinesOnly = changedLinesOnly; } }
setChangedLinesOnly
242,127
void (@Nullable Boolean keepTrailingSpacesOnCaretLine) { if (keepTrailingSpacesOnCaretLine != null && myKeepTrailingSpacesOnCaretLine == null) { myKeepTrailingSpacesOnCaretLine = keepTrailingSpacesOnCaretLine; } }
setKeepTrailingSpacesOnCaretLine
242,128
boolean () { return myStripTrailingSpaces != null ? myStripTrailingSpaces.booleanValue() : !EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE.equals(myEditorSettings.getStripTrailingSpaces()); }
isStripTrailingSpaces
242,129
boolean () { return myRemoveTrailingBlankLines != null ? myRemoveTrailingBlankLines.booleanValue() : myEditorSettings.isRemoveTrailingBlankLines(); }
isRemoveTrailingBlankLines
242,130
boolean () { return myEnsureNewLineAtEOF != null ? myEnsureNewLineAtEOF.booleanValue() : myEditorSettings.isEnsureNewLineAtEOF(); }
isEnsureNewLineAtEOF
242,131
boolean () { return myChangedLinesOnly != null ? myChangedLinesOnly.booleanValue() : !EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE.equals(myEditorSettings.getStripTrailingSpaces()); }
isChangedLinesOnly
242,132
boolean () { return myKeepTrailingSpacesOnCaretLine != null ? myKeepTrailingSpacesOnCaretLine.booleanValue() : myEditorSettings.isKeepTrailingSpacesOnCaretLine(); }
isKeepTrailingSpacesOnCaretLine
242,133
void () { Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); for (Font font : allFonts) { String name = font.getName(); Integer style = FONT_NAME_TO_STYLE.get(name); if (style == null) { continue; } if (style != Font.PLAIN) { String familyName = font.getFamily(); Pair<String, Integer>[] ...
fillStyledFontMap
242,134
FontInfo (@NotNull CharSequence text, int start, int end, @JdkConstants.FontStyle int style, @NotNull FontPreferences preferences, FontRenderContext context) { assert 0 <= start && start < end && end <= text.length() : "Start: " + start + ", end: " + end + ", length: " + text.length(); if (end - start == 1) { // fast p...
getFontAbleToDisplay
242,135
FontInfo (char @NotNull [] text, int start, int end, @JdkConstants.FontStyle int style, @NotNull FontPreferences preferences, FontRenderContext context) { assert 0 <= start && start < end && end <= text.length : "Start: " + start + ", end: " + end + ", length: " + text.length; if (end - start == 1) { // fast path for B...
getFontAbleToDisplay
242,136
FontInfo (int codePoint, char @NotNull [] remainingText, int start, int end, @JdkConstants.FontStyle int style, @NotNull FontPreferences preferences, FontRenderContext context) { boolean tryDefaultFallback = true; List<String> fontFamilies = preferences.getEffectiveFontFamilies(); boolean useLigatures = !Patches.TEXT_L...
getFontAbleToDisplay
242,137
FontInfo (int codePoint, @JdkConstants.FontStyle int style, @NotNull FontPreferences preferences, FontRenderContext context) { boolean tryDefaultFallback = true; List<String> fontFamilies = preferences.getEffectiveFontFamilies(); boolean useLigatures = !Patches.TEXT_LAYOUT_IS_SLOW && preferences.useLigatures(); FontInf...
getFontAbleToDisplay
242,138
FontInfo (int codePoint, int size, @JdkConstants.FontStyle int style, @NotNull String defaultFontFamily, FontRenderContext context) { FontInfo result = doGetFontAbleToDisplay(codePoint, size, style, defaultFontFamily, null, null, false, context, false, false); if (result != null) { return result; } if (!DEFAULT_FALLBAC...
getFontAbleToDisplay
242,139
FontInfo (int codePoint, char[] remainingText, int start, int end, float size, @JdkConstants.FontStyle int style, boolean useLigatures, FontRenderContext context) { if (style < 0 || style > 3) style = Font.PLAIN; synchronized (lock) { FallBackInfo fallBackInfo = UNDISPLAYABLE_FONT_INFO; IntSet undisplayableChars = ourU...
doGetFontAbleToDisplay
242,140
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FontKey key = (FontKey)o; if (mySize != key.mySize) return false; if (myUseLigatures != key.myUseLigatures) return false; if (!Objects.equals(myContext, key.myContext)) return false; return true; }
equals
242,141
int () { int result = (mySize != 0.0f ? Float.floatToIntBits(mySize) : 0); result = 31 * result + (myUseLigatures ? 1 : 0); result = 31 * result + (myContext != null ? myContext.hashCode() : 0); return result; }
hashCode
242,142
FontKey () { try { return (FontKey)super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
clone
242,143
boolean (int codePoint, boolean disableFontFallback) { return codePoint < 128 || FontInfo.canDisplay(myBaseFont, codePoint, disableFontFallback); }
canDisplay
242,144
FontInfo (float size, boolean useLigatures, FontRenderContext fontRenderContext) { if (myLastFontKey.mySize == size && myLastFontKey.myUseLigatures == useLigatures && Objects.equals(myLastFontKey.myContext, fontRenderContext)) { return myLastFontInfo; } myLastFontKey.mySize = size; myLastFontKey.myUseLigatures = useLig...
getFontInfo
242,145
DefaultRawTypedHandler () { return myDefaultRawTypedHandler; }
getDefaultRawTypedHandler
242,146
void () { long limit = System.currentTimeMillis() - TIMING_TTL_MILLIS; int endIndex = 0; for (; endIndex < myTimings.size(); endIndex++) { if (myTimings.getLong(endIndex) > limit) { break; } } if (endIndex > 0) { myTimings.removeElements(0, endIndex); } }
stripTimings
242,147
void (@NotNull EditorImpl editor) { myAlarm.cancelAllRequests(); myAlarm.addRequest(new UpdateSizeTask(editor), 1000); }
scheduleSizeUpdate
242,148
void () { myInsideValidation = true; myReserveColumns = DEFAULT_RESERVE_COLUMNS_NUMBER; myTimings.clear(); try { myEditor.validateSize(); } finally { myInsideValidation = false; } }
run
242,149
EditorActionHandler (@NotNull String actionId) { return ((EditorAction) ActionManager.getInstance().getAction(actionId)).getHandler(); }
getActionHandler
242,150
EditorActionHandler (@NotNull String actionId, @NotNull EditorActionHandler handler) { EditorAction action = (EditorAction)ActionManager.getInstance().getAction(actionId); return action.setupHandler(handler); }
setActionHandler
242,151
TypedAction () { return TypedAction.getInstance(); }
getTypedAction
242,152
ReadonlyFragmentModificationHandler () { return myReadonlyFragmentsHandler; }
getReadonlyFragmentModificationHandler
242,153
ReadonlyFragmentModificationHandler (final @NotNull Document document) { final Document doc = document instanceof DocumentWindow ? ((DocumentWindow)document).getDelegate() : document; final ReadonlyFragmentModificationHandler docHandler = doc instanceof DocumentImpl ? ((DocumentImpl)doc).getReadonlyFragmentModification...
getReadonlyFragmentModificationHandler
242,154
void (final @NotNull Document document, final ReadonlyFragmentModificationHandler handler) { final Document doc = document instanceof DocumentWindow ? ((DocumentWindow)document).getDelegate() : document; if (doc instanceof DocumentImpl) { ((DocumentImpl)document).setReadonlyFragmentModificationHandler(handler); } }
setReadonlyFragmentModificationHandler
242,155
ReadonlyFragmentModificationHandler (@NotNull ReadonlyFragmentModificationHandler handler) { ReadonlyFragmentModificationHandler oldHandler = myReadonlyFragmentsHandler; myReadonlyFragmentsHandler = handler; return oldHandler; }
setReadonlyFragmentModificationHandler
242,156
void (ReadOnlyFragmentModificationException e) { Messages.showErrorDialog(EditorBundle.message("guarded.block.modification.attempt.error.message"), EditorBundle.message("guarded.block.modification.attempt.error.title")); }
handle
242,157
List<IndentGuideDescriptor> () { return myIndents; }
getIndents
242,158
IndentGuideDescriptor () { final LogicalPosition pos = myEditor.getCaretModel().getLogicalPosition(); final int column = pos.column; final int line = pos.line; if (column > 0) { for (IndentGuideDescriptor indent : myIndents) { if (column == indent.indentLevel && line >= indent.startLine && line < indent.endLine) { retu...
getCaretIndentGuide
242,159
IndentGuideDescriptor (int startLine, int endLine) { return myIndentsByLines.get(new IntPair(startLine, endLine)); }
getDescriptor
242,160
void (@NotNull List<IndentGuideDescriptor> descriptors) { myIndents = descriptors; myIndentsByLines.clear(); for (IndentGuideDescriptor descriptor : myIndents) { myIndentsByLines.put(new IntPair(descriptor.startLine, descriptor.endLine), descriptor); } }
assumeIndents
242,161
void (@NotNull CaretEvent event) { process(event); }
caretAdded
242,162
void (@NotNull CaretEvent event) { process(event); }
caretPositionChanged
242,163
void (@NotNull CaretEvent event) { process(event); }
caretRemoved
242,164
void (@NotNull CaretEvent event) { Caret caret = event.getCaret(); if (caret == caretModel.getPrimaryCaret()) { applyFocusMode(caret); } }
process
242,165
void (@NotNull SelectionEvent e) { myEditor.applyFocusMode(); }
selectionChanged
242,166
RangeMarker (int start, int end) { RangeMarkerEx marker = new RangeMarkerImpl(myEditor.getDocument(), start, end, false, false); myFocusMarkerTree.addInterval(marker, start, end, false, false, true, 0); mySegmentListeners.forEach(l -> l.focusRegionAdded(marker)); return marker; }
createFocusRegion
242,167
void (@NotNull RangeMarker marker) { boolean removed = myFocusMarkerTree.removeInterval((RangeMarkerEx)marker); if (removed) mySegmentListeners.forEach(l -> l.focusRegionRemoved(marker)); }
removeFocusRegion
242,168
void (FocusModeModelListener newListener, Disposable disposable) { mySegmentListeners.add(newListener); Disposer.register(disposable, () -> mySegmentListeners.remove(newListener)); }
addFocusSegmentListener
242,169
Segment (@NotNull Segment range) { int originalStart = range.getStartOffset(); DocumentEx document = myEditor.getDocument(); int start = DocumentUtil.getLineStartOffset(originalStart, document); if (start < originalStart) { range = new TextRange(start, range.getEndOffset()); } int originalEnd = range.getEndOffset(); in...
enlargeFocusRangeIfNeeded
242,170
void (@NotNull Segment focusRange) { EditorColorsScheme scheme = ObjectUtils.notNull(myEditor.getColorsScheme(), EditorColorsManager.getInstance().getGlobalScheme()); Color background = scheme.getDefaultBackground(); //noinspection UseJBColor Color foreground = Registry.getColor(ColorUtil.isDark(background) ? "editor.f...
applyFocusMode
242,171
void () { myFocusMarkerTree.dispose(myEditor.getDocument()); }
dispose
242,172
boolean (RangeMarker a, RangeMarker b) { return Math.max(a.getStartOffset(), b.getStartOffset()) < Math.min(a.getEndOffset(), b.getEndOffset()); }
intersects
242,173
void (@NotNull DocumentEvent e) { if (!mySupplier.getEditor().getDocument().isInBulkUpdate()) { cancelAnimatedScrolling(true); } }
beforeDocumentChange
242,174
boolean () { Editor editor = mySupplier.getEditor(); // There is a possible case that the editor is configured to show virtual space at file bottom // and the requested position is located somewhere around. // We don't want to position the viewport in a way that most of its area is used to represent that virtual empty ...
adjustVerticalOffsetIfNecessary
242,175
Rectangle () { return mySupplier.getScrollPane().getViewport().getViewRect(); }
getVisibleArea
242,176
Rectangle () { if (EditorCoreUtil.isTrueSmoothScrollingEnabled()) { Rectangle viewRect = mySupplier.getScrollPane().getViewport().getViewRect(); return new Rectangle(getOffset(getHorizontalScrollBar()), getOffset(getVerticalScrollBar()), viewRect.width, viewRect.height); } if (myCurrentAnimationRequest != null) { retur...
getVisibleAreaOnScrollingFinished
242,177
void (@NotNull ScrollType scrollType) { if (LOG.isTraceEnabled()) { LOG.trace(new Throwable()); } Editor editor = mySupplier.getEditor(); VisualPosition visualPosition = editor.getCaretModel().getVisualPosition(); AsyncEditorLoader.performWhenLoaded(editor, () -> { LogicalPosition logicalPosition = editor.visualToLogic...
scrollToCaret
242,178
void (@NotNull Point targetLocation, @NotNull ScrollType scrollType) { AnimatedScrollingRunnable canceledThread = cancelAnimatedScrolling(false); Rectangle viewRect = canceledThread == null ? getVisibleArea() : canceledThread.getTargetVisibleArea(); Point p = calcOffsetsToScroll(targetLocation, scrollType, viewRect); s...
scrollTo
242,179
void (@NotNull LogicalPosition logicalPosition, @NotNull ScrollType scrollType) { Editor editor = mySupplier.getEditor(); AsyncEditorLoader.performWhenLoaded(editor, () -> { for (ScrollRequestListener listener : myScrollRequestListeners) { listener.scrollRequested(logicalPosition, scrollType); } scrollTo(mySupplier.get...
scrollTo
242,180
void (@NotNull Runnable action) { if (myCurrentAnimationRequest != null) { myCurrentAnimationRequest.addPostRunnable(action); return; } action.run(); }
runActionOnScrollingFinished
242,181
boolean () { return !myAnimationDisabled; }
isAnimationEnabled
242,182
void () { myAnimationDisabled = true; }
disableAnimation
242,183
void () { myAnimationDisabled = false; }
enableAnimation
242,184
Point (@NotNull Point targetLocation, @NotNull ScrollType scrollType, @NotNull Rectangle viewRect) { return ApplicationManager.getApplication().getService(ScrollPositionCalculator.class) .calcOffsetsToScroll(mySupplier.getEditor(), targetLocation, scrollType, viewRect, mySupplier.getScrollPane()); }
calcOffsetsToScroll
242,185
int () { return getOffset(getVerticalScrollBar()); }
getVerticalScrollOffset
242,186
int () { return getOffset(getHorizontalScrollBar()); }
getHorizontalScrollOffset
242,187
int (JScrollBar scrollBar) { return scrollBar == null ? 0 : scrollBar instanceof Interpolable ? ((Interpolable)scrollBar).getTargetValue() : scrollBar.getValue(); }
getOffset
242,188
void (int scrollOffset) { scroll(getHorizontalScrollOffset(), scrollOffset); }
scrollVertically
242,189
void (int scrollOffset) { JScrollBar scrollbar = mySupplier.getScrollPane().getVerticalScrollBar(); scrollbar.setValue(scrollOffset); }
_scrollVertically
242,190
void (int scrollOffset) { scroll(scrollOffset, getVerticalScrollOffset()); }
scrollHorizontally
242,191
void (int scrollOffset) { JScrollBar scrollbar = mySupplier.getScrollPane().getHorizontalScrollBar(); scrollbar.setValue(scrollOffset); }
_scrollHorizontally
242,192
void (int hOffset, int vOffset) { if (myAccumulateViewportChanges) { myAccumulatedXOffset = hOffset; myAccumulatedYOffset = vOffset; return; } cancelAnimatedScrolling(false); Editor editor = mySupplier.getEditor(); boolean useAnimation; //System.out.println("myCurrentCommandStart - myLastCommandFinish = " + (myCurrentC...
scroll
242,193
void (@NotNull VisibleAreaListener listener) { myVisibleAreaListeners.add(listener); }
addVisibleAreaListener
242,194
void (@NotNull VisibleAreaListener listener) { boolean success = myVisibleAreaListeners.remove(listener); LOG.assertTrue(success); }
removeVisibleAreaListener
242,195
void () { cancelAnimatedScrolling(true); }
finishAnimation
242,196
void () { mySupplier.getEditor().getDocument().removeDocumentListener(myDocumentListener); mySupplier.getScrollPane().getViewport().removeChangeListener(myViewportChangeListener); }
dispose
242,197
void () { cancelAnimatedScrolling(true); }
beforeModalityStateChanged
242,198
boolean () { return myCurrentAnimationRequest != null; }
isScrollingNow
242,199
void () { myAccumulateViewportChanges = true; }
accumulateViewportChanges