Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
288,200
void (@NotNull ActionCallback callback) { myCallbacks.add(callback); }
add
288,201
ActionCallback () { if (isEmpty()) { return DONE; } ActionCallback result = new ActionCallback(myCallbacks.size()); Runnable doneRunnable = result.createSetDoneRunnable(); for (ActionCallback each : myCallbacks) { each.doWhenDone(doneRunnable).notifyWhenRejected(result); } return result; }
create
288,202
boolean () { return myCallbacks.isEmpty(); }
isEmpty
288,203
int () { return myCallbacks.size(); }
getSize
288,204
ActionCallback () { if (myCallbacks.isEmpty()) { return DONE; } ActionCallback result = new ActionCallback(myCallbacks.size()); Runnable setDoneRunnable = result.createSetDoneRunnable(); for (ActionCallback each : myCallbacks) { each.doWhenProcessed(setDoneRunnable); } return result; }
getWhenProcessed
288,205
void () { }
dispose
288,206
Runnable () { return () -> setDone(); }
createSetDoneRunnable
288,207
boolean (long msTimeout) { if (isProcessed()) { return true; } Semaphore semaphore = new Semaphore(); semaphore.down(); doWhenProcessed(() -> semaphore.up()); try { if (msTimeout == -1) { semaphore.waitForUnsafe(); } else if (!semaphore.waitForUnsafe(msTimeout)) { reject("Time limit exceeded"); return false; } } catch (InterruptedException e) { reject(e.getMessage()); return false; } return true; }
waitFor
288,208
void () { for (Runnable runnable : this) { runnable.run(); } }
run
288,209
long () { return 0; }
getModificationCount
288,210
ProjectRootModificationTracker (Project project) { ProjectRootModificationTracker instance = project.getService(ProjectRootModificationTracker.class); if (instance == null) return NEVER_CHANGED; return instance; }
getInstance
288,211
FileIndexFacade (Project project) { return project.getService(FileIndexFacade.class); }
getInstance
288,212
boolean (@NotNull VirtualFile file) { if (isInLibraryClasses(file) && !isInSourceContent(file)) return false; return isInContent(file); }
isInProjectScope
288,213
PushedFilePropertiesRetriever () { return ApplicationManager.getApplication().getService(PushedFilePropertiesRetriever.class); }
getInstance
288,214
Builder (@Command String name) { myCommandName = name; return this; }
withName
288,215
Builder () { myGlobalUndoAction = true; return this; }
withGlobalUndo
288,216
Builder (boolean value) { myShouldRecordActionForActiveDocument = value; return this; }
shouldRecordActionForActiveDocument
288,217
Builder (@NotNull UndoConfirmationPolicy policy) { if (myUndoConfirmationPolicy != null) throw new IllegalStateException("do not call withUndoConfirmationPolicy() several times"); myUndoConfirmationPolicy = policy; return this; }
withUndoConfirmationPolicy
288,218
Builder (String groupId) { myGroupId = groupId; return this; }
withGroupId
288,219
Builder (Project project) { return new BuilderImpl(project); }
writeCommandAction
288,220
Builder (@NotNull PsiFile first, PsiFile @NotNull ... others) { return new BuilderImpl(first.getProject(), ArrayUtil.prepend(first, others)); }
writeCommandAction
288,221
Builder (Project project, PsiFile @NotNull ... files) { return new BuilderImpl(project, files); }
writeCommandAction
288,222
Builder (Project project, Collection<? extends PsiElement> elementsToMakeWritable) { return new BuilderImpl(project, elementsToMakeWritable); }
writeCommandAction
288,223
Project () { return myProject; }
getProject
288,224
String () { return myGroupID; }
getGroupID
288,225
RunResult<T> () { Application application = ApplicationManager.getApplication(); boolean dispatchThread = application.isDispatchThread(); if (!dispatchThread && application.isReadAccessAllowed()) { throw new IllegalStateException("Must not start write action from within read action in the other thread - deadlock is coming"); } final RunResult<T> result = new RunResult<>(this); if (dispatchThread) { performWriteCommandAction(result); } else { try { ApplicationManager.getApplication().invokeAndWait(() -> performWriteCommandAction(result)); } catch (ProcessCanceledException ignored) { } } return result; }
execute
288,226
void (@NotNull RunResult<T> result) { if (myPsiFiles.length > 0 && !FileModificationService.getInstance().preparePsiElementsForWrite(Arrays.asList(myPsiFiles))) { return; } // this is needed to prevent memory leak, since the command is put into undo queue Ref<RunResult<?>> resultRef = new Ref<>(result); doExecuteCommand(() -> ApplicationManager.getApplication().runWriteAction(() -> { resultRef.get().run(); resultRef.set(null); })); }
performWriteCommandAction
288,227
boolean () { return false; }
isGlobalUndoAction
288,228
void (@NotNull Runnable runnable) { Runnable wrappedRunnable = () -> { if (isGlobalUndoAction()) CommandProcessor.getInstance().markCurrentCommandAsGlobal(getProject()); runnable.run(); }; CommandProcessor.getInstance().executeCommand(getProject(), wrappedRunnable, getCommandName(), getGroupID(), UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION, true); }
doExecuteCommand
288,229
void (Project project, @NotNull Runnable runnable) { runWriteCommandAction(project, getDefaultCommandName(), DEFAULT_GROUP_ID, runnable); }
runWriteCommandAction
288,230
void (Project project, final @Nullable @Command String commandName, final @Nullable String groupID, final @NotNull Runnable runnable, PsiFile @NotNull ... files) { writeCommandAction(project, files).withName(commandName).withGroupId(groupID).run(() -> runnable.run()); }
runWriteCommandAction
288,231
CommandProcessor () { return ApplicationManager.getApplication().getService(CommandProcessor.class); }
getInstance
288,232
CommandProcessor () { return (CommandProcessor)getSource(); }
getCommandProcessor
288,233
Runnable () { return myCommand; }
getCommand
288,234
Project () { return myProject; }
getProject
288,235
Object () { return myCommandGroupId; }
getCommandGroupId
288,236
UndoConfirmationPolicy () { return myUndoConfirmationPolicy; }
getUndoConfirmationPolicy
288,237
boolean () { return myShouldRecordActionForActiveDocument; }
shouldRecordActionForOriginalDocument
288,238
void (final @NotNull PsiFile file) { Project project = file.getProject(); final Document document = PsiDocumentManager.getInstance(project).getDocument(file); if (document == null) return; CommandProcessor.getInstance().addAffectedDocuments(project, document); }
markPsiFileForUndo
288,239
void (@NotNull Document document) { document.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE); }
disableUndoFor
288,240
void (@NotNull Document document, @NotNull Runnable runnable) { document.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE); try { runnable.run(); } finally { document.putUserData(UndoConstants.DONT_RECORD_UNDO, null); } }
disableUndoIn
288,241
void (@NotNull VirtualFile file) { file.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE); }
disableUndoFor
288,242
void (@NotNull Document document) { document.putUserData(UndoConstants.DONT_RECORD_UNDO, null); }
enableUndoFor
288,243
boolean (@NotNull Document document) { return Boolean.TRUE.equals(document.getUserData(UndoConstants.DONT_RECORD_UNDO)); }
isUndoDisabledFor
288,244
boolean (@NotNull VirtualFile file) { return Boolean.TRUE.equals(file.getUserData(UndoConstants.DONT_RECORD_UNDO)); }
isUndoDisabledFor
288,245
void (@NotNull VirtualFile file, @NotNull Runnable runnable) { file.putUserData(UndoConstants.FORCE_RECORD_UNDO, Boolean.TRUE); try { runnable.run(); } finally { file.putUserData(UndoConstants.FORCE_RECORD_UNDO, null); } }
forceUndoIn
288,246
void (@NotNull VirtualFile file, boolean flag) { file.putUserData(UndoConstants.FORCE_RECORD_UNDO, flag ? Boolean.TRUE : null); }
setForceUndoFlag
288,247
boolean (@NotNull VirtualFile file) { return file.getUserData(UndoConstants.FORCE_RECORD_UNDO) == Boolean.TRUE; }
isForceUndoFlagSet
288,248
ProgressManager () { ProgressManager instance = ourInstance; if (instance == null) { instance = ApplicationManager.getApplication().getService(ProgressManager.class); ourInstance = instance; } return instance; }
getInstance
288,249
void (@NotNull ProgressIndicator indicator) { }
indicatorCanceled
288,250
void (@NotNull ProgressIndicator indicator) { getInstance().indicatorCanceled(indicator); }
canceled
288,251
void (@NotNull ProgressIndicator original) { Set<ProgressIndicator> wrappedParents = null; for (ProgressIndicator i = original; i instanceof WrappedProgressIndicator; i = ((WrappedProgressIndicator)i).getOriginalProgressIndicator()) { if (wrappedParents == null) { wrappedParents = new HashSet<>(); } if (!wrappedParents.add(i)) { throw new IllegalArgumentException(i + " wraps itself"); } } }
assertNotCircular
288,252
void () { if (myRunState == RunState.STARTED) { throw new IllegalStateException("Indicator already started"); } myRunState = RunState.STARTED; }
start
288,253
void () { switch (myRunState) { case VIRGIN: throw new IllegalStateException("Indicator can't be stopped because it wasn't started"); case STARTED: myRunState = RunState.STOPPED; break; case STOPPED: throw new IllegalStateException("Indicator already stopped"); } }
stop
288,254
boolean () { return myRunState == RunState.STARTED; }
isRunning
288,255
void () { if (isCanceled() && myNonCancelableSectionCount == 0 && !Cancellation.isInNonCancelableSection()) { throw new ProcessCanceledException(); } }
checkCanceled
288,256
void (String text) { }
setText
288,257
String () { return ""; }
getText
288,258
void (String text) { }
setText2
288,259
String () { return ""; }
getText2
288,260
double () { return 1; }
getFraction
288,261
void (double fraction) { }
setFraction
288,262
void () { }
pushState
288,263
void () { }
popState
288,264
void () { PluginException.reportDeprecatedUsage("ProgressIndicator#startNonCancelableSection", "Use `ProgressManager.executeNonCancelableSection()` instead"); myNonCancelableSectionCount++; }
startNonCancelableSection
288,265
void () { myNonCancelableSectionCount--; }
finishNonCancelableSection
288,266
boolean () { return false; }
isModal
288,267
ModalityState () { return myModalityState; }
getModalityState
288,268
void (ProgressIndicator modalityProgress) { if (isRunning()) { throw new IllegalStateException("Can't change modality progress for already running indicator"); } }
setModalityProgress
288,269
boolean () { return false; }
isIndeterminate
288,270
void (boolean indeterminate) { }
setIndeterminate
288,271
boolean () { return false; }
isPopupWasShown
288,272
boolean () { return false; }
isShowing
288,273
void () { }
start
288,274
void () { }
stop
288,275
boolean () { return true; }
isRunning
288,276
void () { }
cancel
288,277
boolean () { return false; }
isCanceled
288,278
void () { }
checkCanceled
288,279
void (String text) { }
setText
288,280
String () { return null; }
getText
288,281
void (String text) { }
setText2
288,282
String () { return null; }
getText2
288,283
double () { return 0; }
getFraction
288,284
void (double fraction) { }
setFraction
288,285
void () { }
pushState
288,286
void () { }
popState
288,287
boolean () { return false; }
isModal
288,288
ModalityState () { return ModalityState.nonModal(); }
getModalityState
288,289
void (ProgressIndicator modalityProgress) { }
setModalityProgress
288,290
boolean () { return false; }
isIndeterminate
288,291
void (boolean indeterminate) { }
setIndeterminate
288,292
boolean () { return false; }
isPopupWasShown
288,293
boolean () { return false; }
isShowing
288,294
void () { super.start(); myIsCanceled = false; }
start
288,295
void () { myIsCanceled = true; ProgressManager.canceled(this); }
cancel
288,296
boolean () { return myIsCanceled; }
isCanceled
288,297
ProgressIndicator (@Nullable ProgressIndicator indicator) { return indicator != null ? indicator : new EmptyProgressIndicator(); }
notNullize
288,298
ProgressIndicatorProvider () { return ProgressManager.getInstance(); }
getInstance
288,299
ProgressIndicator () { ProgressManager instance = ProgressManager.getInstanceOrNull(); return instance == null ? null : instance.getProgressIndicator(); }
getGlobalProgressIndicator