use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.
the class ApplyPatchDefaultExecutor method apply.
@CalledInAwt
@Override
public void apply(@NotNull List<FilePatch> remaining, @NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress> patchGroupsToApply, @Nullable LocalChangeList localList, @Nullable String fileName, @Nullable ThrowableComputable<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) {
final CommitContext commitContext = new CommitContext();
applyAdditionalInfoBefore(myProject, additionalInfo, commitContext);
final Collection<PatchApplier> appliers = getPatchAppliers(patchGroupsToApply, localList, commitContext);
executeAndApplyAdditionalInfo(localList, additionalInfo, commitContext, appliers);
}
use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.
the class BackgroundTaskUtil method executeAndTryWait.
@NotNull
@CalledInAwt
public static ProgressIndicator executeAndTryWait(@NotNull Function<ProgressIndicator, /*@NotNull*/
Runnable> backgroundTask, @Nullable Runnable onSlowAction, long waitMillis, boolean forceEDT) {
ModalityState modality = ModalityState.current();
if (forceEDT) {
ProgressIndicator indicator = new EmptyProgressIndicator(modality);
try {
Runnable callback = backgroundTask.fun(indicator);
finish(callback, indicator);
} catch (ProcessCanceledException ignore) {
} catch (Throwable t) {
LOG.error(t);
}
return indicator;
} else {
Pair<Runnable, ProgressIndicator> pair = computeInBackgroundAndTryWait(backgroundTask, (callback, indicator) -> {
ApplicationManager.getApplication().invokeLater(() -> {
finish(callback, indicator);
}, modality);
}, modality, waitMillis);
Runnable callback = pair.first;
ProgressIndicator indicator = pair.second;
if (callback != null) {
finish(callback, indicator);
} else {
if (onSlowAction != null)
onSlowAction.run();
}
return indicator;
}
}
use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.
the class BackgroundTaskUtil method tryComputeFast.
/**
* Try to compute value in background and abort computation if it takes too long.
* <ul>
* <li> If the computation is fast, return computed value.
* <li> If the computation is slow, abort computation (cancel ProgressIndicator).
* </ul>
*/
@Nullable
@CalledInAwt
public static <T> T tryComputeFast(@NotNull Function<ProgressIndicator, T> backgroundTask, long waitMillis) {
Pair<T, ProgressIndicator> pair = computeInBackgroundAndTryWait(backgroundTask, (result, indicator) -> {
}, ModalityState.defaultModalityState(), waitMillis);
T result = pair.first;
ProgressIndicator indicator = pair.second;
indicator.cancel();
return result;
}
use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.
the class VcsDiffUtil method showDiffFor.
@CalledInAwt
public static void showDiffFor(@NotNull Project project, @NotNull final Collection<Change> changes, @NotNull final String revNumTitle1, @NotNull final String revNumTitle2, @NotNull final FilePath filePath) {
if (filePath.isDirectory()) {
showChangesDialog(project, getDialogTitle(filePath, revNumTitle1, revNumTitle2), ContainerUtil.newArrayList(changes));
} else {
if (changes.isEmpty()) {
DiffManager.getInstance().showDiff(project, new MessageDiffRequest("No Changes Found"));
} else {
final HashMap<Key, Object> revTitlesMap = new HashMap<>(2);
revTitlesMap.put(VCS_DIFF_LEFT_CONTENT_TITLE, revNumTitle1);
revTitlesMap.put(VCS_DIFF_RIGHT_CONTENT_TITLE, revNumTitle2);
ShowDiffContext showDiffContext = new ShowDiffContext() {
@NotNull
@Override
public Map<Key, Object> getChangeContext(@NotNull Change change) {
return revTitlesMap;
}
};
ShowDiffAction.showDiffForChange(project, changes, 0, showDiffContext);
}
}
}
use of org.jetbrains.annotations.CalledInAwt in project intellij-community by JetBrains.
the class HgIncomingOutgoingWidget method deactivate.
@CalledInAwt
public void deactivate() {
if (!isAlreadyShown)
return;
StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
if (null != statusBar) {
statusBar.removeWidget(ID());
isAlreadyShown = false;
}
}
Aggregations