Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
257,400
void () { setCurrentCard(OPERATION_CANCELED_CONTENT); }
setOperationCanceledContent
257,401
void () { setCurrentCard(ERROR_CONTENT); }
setErrorContent
257,402
void (@NotNull String card) { if (card.equals(LOADING_CONTENT)) { myBusyIcon.resume(); } else { myBusyIcon.suspend(); } super.setCurrentCard(card); }
setCurrentCard
257,403
boolean () { return myCurrentCard.equals(GOOD_CONTENT); }
isGoodContent
257,404
int (int value) { return convert(value, true, false); }
convert
257,405
int (int value) { return convert(value, false, false); }
convertInv
257,406
int (int value) { return convert(value, true, true); }
convertApproximate
257,407
int (int value) { return convert(value, false, true); }
convertApproximateInv
257,408
IntUnaryOperator () { return this::convert; }
createConvertor
257,409
int (int value, boolean fromMaster, boolean approximate) { return myCorrector.convertCorrected(value, fromMaster, approximate); }
convert
257,410
void (int startLine, int endLine, int shift, boolean synchronous) { myCorrector.handleMasterChange(startLine, endLine, shift, synchronous); }
handleMasterChange
257,411
int (boolean fromMaster, int value, boolean approximate) { TreeMap<Integer, Data> fragments = fromMaster ? myFragments : myInvertedFragments; if (approximate) { Map.Entry<Integer, Data> prevEntry = fragments.floorEntry(value); if (prevEntry == null) return 0; int start = prevEntry.getKey(); Data data = prevEntry.getVal...
convertRaw
257,412
void (int masterStart, int slaveStart, int length) { put(masterStart, slaveStart, length, length); }
put
257,413
void (int masterStart, int slaveStart, int masterLength, int slaveLength) { myFragments.put(masterStart, new Data(masterLength, slaveStart, slaveLength)); myInvertedFragments.put(slaveStart, new Data(slaveLength, masterStart, masterLength)); }
put
257,414
LineNumberConvertor () { return new LineNumberConvertor(myFragments, myInvertedFragments); }
build
257,415
LineNumberConvertor (@NotNull DiffIterable iterable) { LineNumberConvertor.Builder builder = new LineNumberConvertor.Builder(); for (Pair<Range, Boolean> pair : DiffIterableUtil.iterateAll(iterable)) { Range range = pair.first; builder.put(range.start1, range.start2, range.end1 - range.start1, range.end2 - range.start2...
fromIterable
257,416
void (int startLine, int endLine, int shift, boolean synchronous) { int oldLength = endLine - startLine; int newLength = oldLength + shift; if (synchronous) { int oldSlaveStart = convert(startLine, true, false); assert oldSlaveStart != -1; myChanges.add(new CorrectedChange(startLine, oldSlaveStart, oldLength, newLength...
handleMasterChange
257,417
int (int value, boolean fromMaster, boolean approximate) { if (fromMaster) { return convertFromMaster(value, approximate, myChanges.size() - 1); } else { return convertFromSlave(value, approximate, myChanges.size() - 1); } }
convertCorrected
257,418
int (int value, boolean approximate, int index) { if (index < 0) { return convertRaw(false, value, approximate); } CorrectedChange change = myChanges.get(index); int shift = change.newLength - change.oldLength; if (!change.synchronous) { // ?u' -> ?o' int converted = convertFromSlave(value, approximate, index - 1); if ...
convertFromSlave
257,419
int (int value, boolean approximate, int index) { if (index < 0) { return convertRaw(true, value, approximate); } CorrectedChange change = myChanges.get(index); int shift = change.newLength - change.oldLength; if (value < change.startMaster) { // So' -> Sm', So' -> Su' // So' == So; Sm' == Sm; Su' == Su // value = So' ...
convertFromMaster
257,420
int (int value, int shift) { return value == -1 ? -1 : value + shift; }
append
257,421
void (@NotNull HighlighterIterator it1, @NotNull HighlighterIterator it2, @NotNull List<? extends HighlightRange> ranges, int textLength) { ApplicationManager.getApplication().assertReadAccessAllowed(); int i = 0; int offset = 0; for (HighlightRange range : ranges) { TextRange base = range.getBase(); TextRange changed ...
init
257,422
void (@NotNull Element element) { boolean merged = false; if (!myPieces.isEmpty()) { Element oldElement = myPieces.get(myPieces.size() - 1); if (oldElement.getEnd() >= element.getStart() && Comparing.equal(oldElement.getAttributes(), element.getAttributes()) && Arrays.equals(oldElement.getAttributesKeys(), element.getA...
addElement
257,423
HighlighterIterator (int startOffset) { int index = Collections.binarySearch(myPieces, createEmptyElement(startOffset, 0), Comparator.comparingInt(Element::getStart)); // index: (-insertion point - 1), where insertionPoint is the index of the first element greater than the key // and we need index of the first element ...
createIterator
257,424
void (@NotNull HighlighterClient editor) { }
setEditor
257,425
Element (int startOffset, int endOffset) { return new Element(startOffset, endOffset, null, TextAttributes.ERASE_MARKER, TextAttributesKey.EMPTY_ARRAY); }
createEmptyElement
257,426
TextAttributes () { return myPieces.get(myIdx).getAttributes(); }
getTextAttributes
257,427
int () { return myPieces.get(myIdx).getStart(); }
getStart
257,428
int () { return myPieces.get(myIdx).getEnd(); }
getEnd
257,429
IElementType () { return myPieces.get(myIdx).myElementType; }
getTokenType
257,430
void () { if (myIdx < myPieces.size()) { myIdx++; } }
advance
257,431
void () { if (myIdx > -1) { myIdx--; } }
retreat
257,432
boolean () { return myIdx < 0 || myIdx >= myPieces.size(); }
atEnd
257,433
Document () { return myDocument; }
getDocument
257,434
TextAttributes () { return myAttributes; }
getAttributes
257,435
RangeMarker (@NotNull Document document, @NotNull TextRange range) { RangeMarker rangeMarker = document.createRangeMarker(range.getStartOffset(), range.getEndOffset(), true); rangeMarker.setGreedyToLeft(true); rangeMarker.setGreedyToRight(true); return rangeMarker; }
createRangeMarker
257,436
Document () { return mySynchronizer.getDocument2(); }
getDocument
257,437
VirtualFile () { return myOriginal.getHighlightFile(); }
getHighlightFile
257,438
Navigatable (@NotNull LineCol position) { if (!myRangeMarker.isValid()) return null; int offset = position.toOffset(getDocument()); int originalOffset = offset + myRangeMarker.getStartOffset(); LineCol originalPosition = LineCol.fromOffset(myOriginal.getDocument(), originalOffset); return myOriginal.getNavigatable(orig...
getNavigatable
257,439
FileType () { return myOriginal.getContentType(); }
getContentType
257,440
Navigatable () { return getNavigatable(new LineCol(0)); }
getNavigatable
257,441
void (boolean isAssigned) { if (isAssigned) { if (myAssignments == 0) mySynchronizer.startListen(); myAssignments++; } else { myAssignments--; if (myAssignments == 0) mySynchronizer.stopListen(); } assert myAssignments >= 0; }
onAssigned
257,442
void (@NotNull DocumentEvent event) { if (!myRangeMarker.isValid()) { myDocument2.setReadOnly(false); try { replaceString(myDocument2, 0, myDocument2.getTextLength(), DiffBundle.message("synchronize.document.and.its.fragment.range.error")); } finally { myDocument2.setReadOnly(true); } return; } CharSequence newText = m...
onDocumentChanged1
257,443
void (@NotNull DocumentEvent event) { if (!myRangeMarker.isValid()) return; if (!myDocument1.isWritable()) return; CharSequence newText = event.getNewFragment(); int originalOffset = event.getOffset() + myRangeMarker.getStartOffset(); int originalEnd = originalOffset + event.getOldLength(); replaceString(myDocument1, o...
onDocumentChanged2
257,444
void () { // no need to set myDuringModification - listeners are not added yet CommandProcessor.getInstance().runUndoTransparentAction(() -> { ApplicationManager.getApplication().runWriteAction(() -> { if (myRangeMarker.isValid()) { myDocument2.setReadOnly(false); CharSequence nexText = myRangeMarker.getTextRange().sub...
startListen
257,445
void (@NotNull Document document, int startOffset, int endOffset, @NotNull CharSequence newText) { try { myDuringModification = true; document.replaceString(startOffset, endOffset, newText); } finally { myDuringModification = false; } }
replaceString
257,446
void (@NotNull DocumentEvent e) { if (myDuringModification) return; onDocumentChanged1(e); }
documentChanged
257,447
void (@NotNull DocumentEvent e) { if (myDuringModification) return; onDocumentChanged2(e); }
documentChanged
257,448
Document () { return myDocument1; }
getDocument1
257,449
Document () { return myDocument2; }
getDocument2
257,450
void () { myDocument1.addDocumentListener(myListener1); myDocument2.addDocumentListener(myListener2); myDocument1.addPropertyChangeListener(myROListener); }
startListen
257,451
void () { myDocument1.removeDocumentListener(myListener1); myDocument2.removeDocumentListener(myListener2); myDocument1.removePropertyChangeListener(myROListener); }
stopListen
257,452
Document (@NotNull Document original) { EditorFactoryImpl editorFactory = (EditorFactoryImpl)EditorFactory.getInstance(); boolean acceptsSlashR = original instanceof DocumentImpl && ((DocumentImpl)original).acceptsSlashR(); boolean writeThreadOnly = original instanceof DocumentImpl && ((DocumentImpl)original).isWriteTh...
createFakeDocument
257,453
void () { while (myBuffer.isEmpty() && hasNextBlock()) { loadNextBlock(); } }
init
257,454
void (int line, @NotNull CharSequence text) { myBuffer.add(Pair.create(line, text)); }
addLine
257,455
boolean () { return !myBuffer.isEmpty(); }
hasNext
257,456
void () { throw new UnsupportedOperationException(); }
remove
257,457
boolean () { return myLine < getLineCount(myDocument); }
hasNext
257,458
void () { throw new UnsupportedOperationException(); }
remove
257,459
Editor (@NotNull AnActionEvent e) { Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor != null) return editor; Project project = e.getProject(); if (project == null) return null; return FileEditorManager.getInstance(project).getSelectedTextEditor(); }
getEditor
257,460
FileType (@NotNull AnActionEvent e) { DiffContent content = e.getData(DiffDataKeys.CURRENT_CONTENT); if (content != null && content.getContentType() != null) return content.getContentType(); DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST); if (request instanceof ContentDiffRequest) { for (DiffContent diffCon...
getEditorFileType
257,461
boolean (@NotNull AnActionEvent e) { Editor editor = getEditor(e); return editor != null; }
isAvailable
257,462
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
257,463
DiffRequestChain (@NotNull AnActionEvent e) { Project project = e.getProject(); Editor editor = getEditor(e); FileType editorFileType = getEditorFileType(e); assert editor != null; DiffContent selectedContent = e.getData(DiffDataKeys.CURRENT_CONTENT); DocumentContent content2 = createContent(project, editor, editorFile...
getDiffRequestChain
257,464
DocumentContent (@Nullable Project project, @NotNull Editor editor, @Nullable FileType type, @Nullable DiffContent selectedContent, @NotNull AnActionEvent e) { DocumentContent content = null; if (selectedContent instanceof DocumentContent) { Document contentDocument = ((DocumentContent)selectedContent).getDocument(); D...
createContent
257,465
void (@NotNull AnActionEvent e) { super.update(e); String text = ActionsBundle.message("action.compare.files.text"); VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (files != null) { if (files.length == 1) { text = ActionsBundle.message("action.compare.with.text"); } else if (files.length == 2 ||...
update
257,466
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
257,467
boolean (@NotNull AnActionEvent e) { DiffRequest request = e.getData(DIFF_REQUEST); if (request != null) { return true; } VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (files == null) { return false; } if (files.length == 0 || files.length > 3) return false; boolean hasContent = ContainerUtil.a...
isAvailable
257,468
DiffRequest (@NotNull AnActionEvent e) { return e.getData(DIFF_REQUEST); }
getDiffRequest
257,469
DiffRequestChain (@NotNull AnActionEvent e) { Project project = e.getProject(); DiffRequest diffRequest = getDiffRequest(e); if (diffRequest != null) { return new SimpleDiffRequestChain(diffRequest); } VirtualFile file1; VirtualFile file2; VirtualFile baseFile = null; VirtualFile[] files = e.getRequiredData(CommonDataK...
getDiffRequestChain
257,470
VirtualFile (@Nullable Project project, @NotNull VirtualFile file) { FileChooserDescriptor descriptor; String key; Type type = getType(file); if (type == Type.DIRECTORY || type == Type.ARCHIVE) { descriptor = new FileChooserDescriptor(false, true, true, true, true, false); key = LAST_USED_FOLDER_KEY; } else { descripto...
getOtherFile
257,471
VirtualFile (@Nullable Project project, @NotNull String key, @NotNull VirtualFile file) { if (project == null) return file; final String path = PropertiesComponent.getInstance(project).getValue(key); if (path == null) return file; VirtualFile lastSelection = LocalFileSystem.getInstance().findFileByPath(path); return la...
getDefaultSelection
257,472
void (@Nullable Project project, @NotNull String key, @NotNull VirtualFile file) { if (project == null) return; PropertiesComponent.getInstance(project).setValue(key, file.getPath()); }
updateDefaultSelection
257,473
Type (@Nullable VirtualFile file) { if (file == null) return Type.FILE; if (file.getFileType() instanceof ArchiveFileType) return Type.ARCHIVE; if (file.isDirectory()) return Type.DIRECTORY; return Type.FILE; }
getType
257,474
boolean (@NotNull AnActionEvent e) { VirtualFile selectedFile = getSelectedFile(e); if (selectedFile == null) { return false; } VirtualFile currentFile = getEditingFile(e); if (currentFile == null) { return false; } if (!canCompare(selectedFile, currentFile)) { return false; } return true; }
isAvailable
257,475
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
257,476
boolean (@NotNull VirtualFile file1, @NotNull VirtualFile file2) { return !file1.equals(file2) && hasContent(file1) && hasContent(file2); }
canCompare
257,477
DiffRequestChain (@NotNull AnActionEvent e) { Project project = e.getProject(); VirtualFile selectedFile = getSelectedFile(e); VirtualFile currentFile = getEditingFile(e); assert selectedFile != null && currentFile != null; MutableDiffRequestChain chain = createMutableChainFromFiles(project, selectedFile, currentFile);...
getDiffRequestChain
257,478
void (@Nullable Project project, @NotNull Editor editor, @NotNull JComponent component) { UndoManager undoManager = project != null ? UndoManager.getInstance(project) : UndoManager.getGlobalInstance(); TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(editor); if (undoManager != null) { DiffUtil.re...
register
257,479
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
257,480
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(myUndo ? myUndoManager.isUndoAvailable(myEditor) : myUndoManager.isRedoAvailable(myEditor)); }
update
257,481
void (@NotNull AnActionEvent e) { if (myUndo) { myUndoManager.undo(myEditor); } else { myUndoManager.redo(myEditor); } }
actionPerformed
257,482
void (@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); boolean canShow = isAvailable(e); presentation.setEnabled(canShow); if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(canShow); } }
update
257,483
void (@NotNull AnActionEvent e) { Project project = e.getProject(); DiffRequestChain chain = getDiffRequestChain(e); if (chain == null) return; DiffManager.getInstance().showDiff(project, chain, DiffDialogHints.DEFAULT); }
actionPerformed
257,484
boolean (@NotNull VirtualFile file) { return !DiffUtil.isFileWithoutContent(file); }
hasContent
257,485
MutableDiffRequestChain (@Nullable Project project, @NotNull VirtualFile file1, @NotNull VirtualFile file2) { return createMutableChainFromFiles(project, file1, file2, null); }
createMutableChainFromFiles
257,486
MutableDiffRequestChain (@Nullable Project project, @NotNull VirtualFile file1, @NotNull VirtualFile file2, @Nullable VirtualFile baseFile) { DiffContentFactory contentFactory = DiffContentFactory.getInstance(); DiffRequestFactory requestFactory = DiffRequestFactory.getInstance(); DiffContent content1 = contentFactory....
createMutableChainFromFiles
257,487
Document () { return myDocument; }
getDocument
257,488
VirtualFile () { return myOriginal.getHighlightFile(); }
getHighlightFile
257,489
Navigatable (@NotNull LineCol position) { LineCol originalPosition = new LineCol(myStartLine + position.line, position.column); return myOriginal.getNavigatable(originalPosition); }
getNavigatable
257,490
FileType () { return myOriginal.getContentType(); }
getContentType
257,491
Navigatable () { return getNavigatable(new LineCol(0)); }
getNavigatable
257,492
void (@NotNull AnActionEvent e) { throw new UnsupportedOperationException(); }
actionPerformed
257,493
void (@NotNull JComponent component) { registerCustomShortcutSet(getShortcutSet(), component); }
install
257,494
String () { return myScrollToPosition ? "Diff.FocusOppositePaneAndScroll" : "Diff.FocusOppositePane"; }
getActionId
257,495
AnAction (@NotNull DiffRequestChain chain, @NotNull Consumer<? super Integer> onSelected, int defaultSelection) { if (chain instanceof Chain) { AnAction action = ((Chain)chain).createGoToChangeAction(onSelected, defaultSelection); if (action != null) return action; } return new SimpleGoToChangePopupAction(chain, onSele...
create
257,496
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
257,497
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabledAndVisible(canNavigate() && e.getData(DiffDataKeys.DIFF_CONTEXT) != null); }
update
257,498
void (@NotNull AnActionEvent e) { final JBPopup popup = createPopup(e); InputEvent event = e.getInputEvent(); if (event instanceof MouseEvent) { popup.showUnderneathOf(event.getComponent()); } else { popup.showInBestPositionFor(e.getDataContext()); } }
actionPerformed
257,499
boolean () { return myChain.getRequests().size() > 1; }
canNavigate