Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
261,500
LineRange () { return new LineRange(myPatchDeletionRange.start, myPatchInsertionRange.end); }
getPatchRange
261,501
LineRange () { return isRangeApplied() ? myPatchInsertionRange : myPatchDeletionRange; }
getPatchAffectedRange
261,502
LineRange () { return myPatchDeletionRange; }
getPatchDeletionRange
261,503
LineRange () { return myPatchInsertionRange; }
getPatchInsertionRange
261,504
LineRange () { ApplyPatchViewer.MyModel model = myViewer.getModel(); int lineStart = model.getLineStart(myIndex); int lineEnd = model.getLineEnd(myIndex); if (lineStart != -1 || lineEnd != -1) return new LineRange(lineStart, lineEnd); return null; }
getResultRange
261,505
boolean () { return myResolved; }
isResolved
261,506
void (boolean resolved) { myResolved = resolved; }
setResolved
261,507
TextDiffType () { return DiffUtil.getDiffType(!myPatchDeletionRange.isEmpty(), !myPatchInsertionRange.isEmpty()); }
getDiffType
261,508
boolean () { return myResolved || getStatus() == HunkStatus.ALREADY_APPLIED; }
isRangeApplied
261,509
String () { return VcsBundle.message(switch (myStatus) { case ALREADY_APPLIED -> "patch.apply.already.applied.status"; case EXACTLY_APPLIED -> "patch.apply.automatically.applied.status"; case NOT_APPLIED -> "patch.apply.not.applied.status"; }); }
getStatusText
261,510
Color () { return switch (myStatus) { case ALREADY_APPLIED -> JBColor.YELLOW.darker(); case EXACTLY_APPLIED -> new JBColor(new Color(0, 180, 5), new Color(0, 147, 5)); case NOT_APPLIED -> JBColor.RED.darker(); }; }
getStatusColor
261,511
void () { if (myViewer.isReadOnly()) return; if (isResolved()) return; if (myStatus == HunkStatus.EXACTLY_APPLIED) { ContainerUtil.addIfNotNull(myOperations, createOperation(OperationType.APPLY)); } else { ContainerUtil.addIfNotNull(myOperations, createOperation(OperationType.COPY)); } ContainerUtil.addIfNotNull(myOper...
createOperations
261,512
DiffGutterOperation (@NotNull OperationType type) { if (isResolved()) return null; EditorEx editor = myViewer.getPatchEditor(); int line = type == OperationType.COPY ? getPatchInsertionRange().start : getPatchRange().start; int offset = DiffGutterOperation.lineToOffset(editor, line); return new DiffGutterOperation.Simp...
createOperation
261,513
GutterIconRenderer () { return createIconRenderer(DiffBundle.message("action.presentation.diff.accept.text"), DiffUtil.getArrowIcon(Side.RIGHT), () -> myViewer.executeCommand(DiffBundle.message("merge.dialog.accept.change.command"), () -> myViewer.replaceChange(this))); }
createApplyRenderer
261,514
GutterIconRenderer () { if (getPatchInsertionRange().isEmpty()) return null; return createIconRenderer(DiffBundle.message("action.presentation.diff.copy.text"), AllIcons.Actions.Copy, () -> myViewer.executeCommand(DiffBundle.message("patch.dialog.copy.change.command"), () -> myViewer.copyChangeToClipboard(this))); }
createCopyRenderer
261,515
GutterIconRenderer () { return createIconRenderer(DiffBundle.message("action.presentation.merge.ignore.text"), AllIcons.Diff.Remove, () -> myViewer.executeCommand(DiffBundle.message("merge.dialog.ignore.change.command"), () -> myViewer.markChangeResolved(this))); }
createIgnoreRenderer
261,516
GutterIconRenderer (@NotNull @NlsContexts.Tooltip String text, @NotNull final Icon icon, @NotNull final Runnable perform) { final String tooltipText = DiffUtil.createTooltipText(text, null); return new DiffGutterRenderer(icon, tooltipText) { @Override protected void handleMouseClick() { perform.run(); } }; }
createIconRenderer
261,517
void () { perform.run(); }
handleMouseClick
261,518
State () { LineRange resultRange = getResultRange(); return new State( myIndex, resultRange != null ? resultRange.start : -1, resultRange != null ? resultRange.end : -1, myResolved); }
storeState
261,519
void (@NotNull State state) { myResolved = state.myResolved; }
restoreState
261,520
void (@NotNull Editor editor, @NotNull Graphics g, @NotNull Rectangle r) { LineStatusMarkerDrawUtil.paintSimpleRange(g, editor, myLine1, myLine2, myColor); }
paint
261,521
String () { return myTooltip; }
getTooltipText
261,522
boolean (@NotNull MouseEvent e) { return LineStatusMarkerDrawUtil.isInsideMarkerArea(e); }
canDoAction
261,523
void (@NotNull Editor editor, @NotNull MouseEvent e) { if (getResultRange() != null) { e.consume(); myViewer.scrollToChange(ApplyPatchChange.this, Side.RIGHT, false); } }
doAction
261,524
String () { return VcsBundle.message("patch.apply.marker.renderer", getTooltipText()); }
getAccessibleName
261,525
List<AnAction> () { List<AnAction> group = new ArrayList<>(); if (!isReadOnly()) { group.add(new MyToggleExpandByDefaultAction()); group.add(myEditorSettingsAction); group.add(Separator.getInstance()); group.add(new ShowDiffWithLocalAction()); group.add(new ApplyNonConflictsAction()); } return group; }
createToolbarActions
261,526
List<AnAction> () { List<AnAction> group = new ArrayList<>(); if (!isReadOnly()) { group.add(new ApplySelectedChangesAction()); group.add(new IgnoreSelectedChangesAction()); } group.add(Separator.getInstance()); group.addAll(TextDiffViewerUtil.createEditorPopupActions()); return group; }
createEditorPopupActions
261,527
void () { if (myDisposed) return; myDisposed = true; Disposer.dispose(myModel); Disposer.dispose(myResultHolder); Disposer.dispose(myPatchHolder); }
dispose
261,528
boolean () { return !DiffUtil.canMakeWritable(myResultEditor.getDocument()); }
isReadOnly
261,529
MyModel () { return myModel; }
getModel
261,530
List<ApplyPatchChange> () { return myModelChanges; }
getModelChanges
261,531
boolean () { return myDisposed; }
isDisposed
261,532
StatusPanel () { return myStatusPanel; }
getStatusPanel
261,533
JComponent () { return myPanel; }
getComponent
261,534
JComponent () { return myResultEditor.getContentComponent(); }
getPreferredFocusedComponent
261,535
EditorEx () { return myResultEditor; }
getResultEditor
261,536
EditorEx () { return myPatchEditor; }
getPatchEditor
261,537
Side () { return myFocusTrackerSupport.getCurrentSide(); }
getCurrentSide
261,538
List<ApplyPatchChange> () { return myPatchChanges; }
getPatchChanges
261,539
Object (@NotNull @NonNls String dataId) { if (CommonDataKeys.PROJECT.is(dataId)) { return myProject; } else if (DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.is(dataId)) { return myPrevNextDifferenceIterable; } return null; }
getData
261,540
TextDiffSettings () { return TextDiffSettings.getSettings("ApplyPatch"); //NON-NLS }
getTextSettings
261,541
void () { myPanel.setPersistentNotifications(DiffUtil.createCustomNotifications(null, myContext, myPatchRequest)); final Document outputDocument = myResultEditor.getDocument(); boolean success = DiffUtil.executeWriteCommand(outputDocument, myProject, DiffBundle.message("message.init.merge.content.command"), () -> { out...
initPatchViewer
261,542
void (@NotNull ApplyPatchChange change, @NotNull Side masterSide, boolean forceScroll) { if (change.getResultRange() == null) { DiffUtil.moveCaret(myPatchEditor, change.getPatchRange().start); myPatchEditor.getScrollingModel().scrollToCaret(forceScroll ? ScrollType.CENTER : ScrollType.MAKE_VISIBLE); } else { LineRange ...
scrollToChange
261,543
void () { myContentPanel.repaintDivider(); }
repaintDivider
261,544
boolean (@Nullable @NlsContexts.Command String commandName, @NotNull final Runnable task) { return myModel.executeMergeCommand(commandName, null, UndoConfirmationPolicy.DEFAULT, false, null, task); }
executeCommand
261,545
void (int index) { ApplyPatchChange change = myModelChanges.get(index); change.reinstallHighlighters(); }
reinstallHighlighters
261,546
void (@NotNull ApplyPatchChange.State state) { super.restoreChangeState(state); ApplyPatchChange change = myModelChanges.get(state.myIndex); boolean wasResolved = change.isResolved(); change.restoreState(state); if (wasResolved != change.isResolved()) onChangeResolved(); }
restoreChangeState
261,547
void () { if (isDisposed()) return; myStatusPanel.update(); }
onChangeResolved
261,548
void (@NotNull ApplyPatchChange change) { if (change.isResolved()) return; change.setResolved(true); myModel.invalidateHighlighters(change.getIndex()); onChangeResolved(); }
markChangeResolved
261,549
void (@NotNull ApplyPatchChange change) { LineRange resultRange = change.getResultRange(); LineRange patchRange = change.getPatchInsertionRange(); if (resultRange == null || change.isResolved()) return; if (change.getStatus() != AppliedTextPatch.HunkStatus.EXACTLY_APPLIED) return; List<String> newContent = DiffUtil.get...
replaceChange
261,550
void (@NotNull ApplyPatchChange change) { LineRange patchRange = change.getPatchInsertionRange(); CharSequence newContent = DiffUtil.getLinesContent(myPatchEditor.getDocument(), patchRange.start, patchRange.end); CopyPasteManager.copyTextToClipboard(newContent.toString()); myPatchEditor.getCaretModel().moveToOffset(myP...
copyChangeToClipboard
261,551
boolean (@NotNull ApplyPatchChange change) { return !change.isResolved() && change.getStatus() == AppliedTextPatch.HunkStatus.EXACTLY_APPLIED; }
isEnabled
261,552
void (@NotNull List<? extends ApplyPatchChange> changes) { for (int i = changes.size() - 1; i >= 0; i--) { replaceChange(changes.get(i)); } }
apply
261,553
boolean (@NotNull ApplyPatchChange change) { return !change.isResolved(); }
isEnabled
261,554
void (@NotNull List<? extends ApplyPatchChange> changes) { for (ApplyPatchChange change : changes) { markChangeResolved(change); } }
apply
261,555
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
261,556
void (@NotNull AnActionEvent e) { if (DiffUtil.isFromShortcut(e)) { // consume shortcut even if there are nothing to do - avoid calling some other action e.getPresentation().setEnabledAndVisible(true); return; } Presentation presentation = e.getPresentation(); Editor editor = e.getData(CommonDataKeys.EDITOR); Side side...
update
261,557
void (@NotNull final AnActionEvent e) { Editor editor = e.getData(CommonDataKeys.EDITOR); final Side side = Side.fromValue(Arrays.asList(myResultEditor, myPatchEditor), editor); if (editor == null || side == null) return; final List<ApplyPatchChange> selectedChanges = getSelectedChanges(side); if (selectedChanges.isEmp...
actionPerformed
261,558
boolean (@NotNull Side side) { EditorEx editor = side.select(myResultEditor, myPatchEditor); return DiffUtil.isSomeRangeSelected(editor, lines -> { return ContainerUtil.exists(myModelChanges, change -> isChangeSelected(change, lines, side)); }); }
isSomeChangeSelected
261,559
List<ApplyPatchChange> (@NotNull Side side) { EditorEx editor = side.select(myResultEditor, myPatchEditor); BitSet lines = DiffUtil.getSelectedLines(editor); return ContainerUtil.filter(myModelChanges, change -> isChangeSelected(change, lines, side)); }
getSelectedChanges
261,560
boolean (@NotNull ApplyPatchChange change, @NotNull BitSet lines, @NotNull Side side) { if (!isEnabled(change)) return false; LineRange range = side.select(change.getResultRange(), change.getPatchRange()); if (range == null) return false; return DiffUtil.isSelectedByLine(lines, range.start, range.end); }
isChangeSelected
261,561
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
261,562
void (@NotNull AnActionEvent e) { boolean enabled = ContainerUtil.exists(myModelChanges, c -> { if (c.isResolved()) return false; if (c.getStatus() == AppliedTextPatch.HunkStatus.NOT_APPLIED) return false; return true; }); e.getPresentation().setEnabled(enabled); }
update
261,563
void (@NotNull AnActionEvent e) { List<ApplyPatchChange> changes = myModelChanges; if (changes.isEmpty()) return; executeCommand(DiffBundle.message("merge.dialog.apply.non.conflicted.changes.command"), () -> { for (int i = changes.size() - 1; i >= 0; i--) { ApplyPatchChange change = changes.get(i); switch (change.getSt...
actionPerformed
261,564
void (@NotNull AnActionEvent e) { EditorEx targetEditor = getCurrentSide().other().select(myResultEditor, myPatchEditor); DiffUtil.requestFocus(myProject, targetEditor.getContentComponent()); }
actionPerformed
261,565
void (@NotNull AnActionEvent e) { DocumentContent resultContent = myPatchRequest.getResultContent(); DocumentContent localContent = DiffContentFactoryEx.getInstanceEx() .documentContent(myProject, true) .contextByReferent(resultContent) .buildFromText(myPatchRequest.getLocalContent(), false); SimpleDiffRequest request ...
actionPerformed
261,566
List<ApplyPatchChange> () { return getCurrentSide().select(myResultChanges, myPatchChanges); }
getChanges
261,567
EditorEx () { return getCurrentSide().select(myResultEditor, myPatchEditor); }
getEditor
261,568
int (@NotNull ApplyPatchChange change) { //noinspection ConstantConditions return getCurrentSide().select(change.getResultRange(), change.getPatchAffectedRange()).start; }
getStartLine
261,569
int (@NotNull ApplyPatchChange change) { //noinspection ConstantConditions return getCurrentSide().select(change.getResultRange(), change.getPatchAffectedRange()).end; }
getEndLine
261,570
void (@NotNull ApplyPatchChange change) { ApplyPatchViewer.this.scrollToChange(change, getCurrentSide(), true); }
scrollToChange
261,571
void (@NotNull Graphics g, @NotNull JComponent divider) { Graphics2D gg = DiffDividerDrawUtil.getDividerGraphics(g, divider, myPatchEditor.getComponent()); gg.setColor(DiffDrawUtil.getDividerColor(myPatchEditor)); gg.fill(gg.getClipBounds()); DiffDividerDrawUtil.paintPolygons(gg, divider.getWidth(), myResultEditor, myP...
paint
261,572
void (@NotNull Handler handler) { for (ApplyPatchChange change : myResultChanges) { LineRange resultRange = change.getResultRange(); LineRange patchRange = change.getPatchRange(); assert resultRange != null; // do not abort - ranges are ordered in patch order, but they can be not ordered in terms of resultRange handler...
process
261,573
void (@Nullable List<ApplyPatchChange> changes, @NotNull FoldingModelSupport.Settings settings) { //noinspection ConstantConditions Iterator<int[]> it = map(changes, fragment -> new int[]{ fragment.getResultRange().start, fragment.getResultRange().end }); install(it, null, settings); }
install
261,574
String () { int totalUnresolved = 0; int alreadyApplied = 0; int notApplied = 0; for (ApplyPatchChange change : myPatchChanges) { if (change.isResolved()) continue; totalUnresolved++; switch (change.getStatus()) { case ALREADY_APPLIED -> alreadyApplied++; case NOT_APPLIED -> notApplied++; case EXACTLY_APPLIED -> { } } ...
getMessage
261,575
MergeViewer (@NotNull MergeContext context, @NotNull MergeRequest request) { return new MyApplyPatchViewer(context, (ApplyPatchMergeRequest)request); }
createComponent
261,576
boolean (@NotNull MergeContext context, @NotNull MergeRequest request) { return request instanceof ApplyPatchMergeRequest; }
canShow
261,577
DiffContext (@NotNull MergeContext mergeContext) { return new MergeUtil.ProxyDiffContext(mergeContext); }
createWrapperDiffContext
261,578
ToolbarComponents () { initPatchViewer(); ToolbarComponents components = new ToolbarComponents(); components.statusPanel = getStatusPanel(); components.toolbarActions = createToolbarActions(); components.closeHandler = () -> MergeUtil.showExitWithoutApplyingChangesDialog(this, myMergeRequest, myMergeContext, true); ret...
init
261,579
Action (@NotNull final MergeResult result) { if (result == MergeResult.LEFT || result == MergeResult.RIGHT) return null; String caption = MergeUtil.getResolveActionTitle(result, myMergeRequest, myMergeContext); return new AbstractAction(caption) { @Override public void actionPerformed(ActionEvent e) { if (result == Mer...
getResolveAction
261,580
void (ActionEvent e) { if (result == MergeResult.RESOLVED) { int unresolved = getUnresolvedCount(); if (unresolved != 0 && !MessageDialogBuilder.yesNo(DiffBundle.message("apply.partially.resolved.merge.dialog.title"), DiffBundle.message("apply.patch.partially.resolved.changes.confirmation.message", unresolved)) .yesTex...
actionPerformed
261,581
int () { int count = 0; for (ApplyPatchChange change : getPatchChanges()) { if (change.isResolved()) continue; count++; } return count; }
getUnresolvedCount
261,582
void () { super.onChangeResolved(); if (!ContainerUtil.exists(getModelChanges(), (c) -> !c.isResolved())) { ApplicationManager.getApplication().invokeLater(() -> { if (isDisposed()) return; JComponent component = getComponent(); int yOffset = new RelativePoint(getResultEditor().getComponent(), new Point(0, JBUIScale.sc...
onChangeResolved
261,583
void (final ChangeListWorker worker) { myResult = worker.editData(myName, myNewData); myListCopy = worker.getChangeListByName(myName); }
apply
261,584
void (final ChangeListListener listener) { if (myListCopy != null) { listener.changeListDataChanged(myListCopy); } }
doNotify
261,585
boolean () { return myResult; }
isResult
261,586
void (final ChangeListWorker worker) { myOldComment = worker.editComment(myName, myNewComment); if (myOldComment != null && !Objects.equals(myOldComment, myNewComment)) { myListCopy = worker.getChangeListByName(myName); } else { myListCopy = null; // nothing changed, no notify } }
apply
261,587
void (final ChangeListListener listener) { if (myListCopy != null && myOldComment != null) { listener.changeListCommentChanged(myListCopy, myOldComment); } }
doNotify
261,588
String () { return myOldComment; }
getOldComment
261,589
void (ChangeListWorker worker) { LocalChangeList list = worker.getChangeListByName(myNewDefaultName); if (list == null || list.isDefault()) { myOldDefaultListCopy = null; myNewDefaultListCopy = null; myResult = false; return; } String oldDefaultName = worker.setDefaultList(myNewDefaultName); myOldDefaultListCopy = work...
apply
261,590
void (final ChangeListListener listener) { if (myOldDefaultListCopy != null && myNewDefaultListCopy != null && myResult) { listener.defaultListChanged(myOldDefaultListCopy, myNewDefaultListCopy, myAutomatic); } }
doNotify
261,591
void (final ChangeListWorker worker) { myListCopy = worker.getChangeListByName(myName); myMovedChanges = worker.removeChangeList(myName); myDefaultListCopy = worker.getDefaultList(); }
apply
261,592
void (final ChangeListListener listener) { if (myListCopy != null && myMovedChanges != null) { if (!myMovedChanges.isEmpty()) { listener.changesMoved(myMovedChanges, myListCopy, myDefaultListCopy); } listener.changeListRemoved(myListCopy); } }
doNotify
261,593
void (final ChangeListWorker worker) { myMovedFrom = worker.moveChangesTo(myName, myChanges); myListCopy = worker.getChangeListByName(myName); }
apply
261,594
void (final ChangeListListener listener) { if (myMovedFrom != null && myListCopy != null) { for (LocalChangeList fromList : myMovedFrom.keySet()) { Collection<Change> changesInList = myMovedFrom.get(fromList); listener.changesMoved(changesInList, fromList, myListCopy); } } }
doNotify
261,595
void (final ChangeListWorker worker) { myResult = worker.setReadOnly(myName, myValue); myListCopy = worker.getChangeListByName(myName); }
apply
261,596
void (final ChangeListListener listener) { if (myListCopy != null && myResult) { listener.changeListChanged(myListCopy); } }
doNotify
261,597
boolean () { return myResult; }
isResult
261,598
void (final ChangeListWorker worker) { myResult = worker.editName(myFromName, myToName); myListCopy = worker.getChangeListByName(myToName); }
apply
261,599
void (final ChangeListListener listener) { if (myListCopy != null && myResult) { listener.changeListRenamed(myListCopy, myFromName); } }
doNotify