use of com.intellij.openapi.progress.EmptyProgressIndicator in project kotlin by JetBrains.
the class KtParsingTestCase method ensureCorrectReparse.
public static void ensureCorrectReparse(@NotNull PsiFile file) {
String psiToStringDefault = DebugUtil.psiToString(file, false, false);
String fileText = file.getText();
DiffLog diffLog = (new BlockSupportImpl(file.getProject())).reparseRange(file, file.getNode(), TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
diffLog.performActualPsiChange(file);
TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false));
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project intellij-community by JetBrains.
the class SvnNativeClientAuthTest method updateExpectAuthCanceled.
private void updateExpectAuthCanceled(File wc1, String expectedText) {
Assert.assertTrue(wc1.isDirectory());
final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
final UpdatedFiles files = UpdatedFiles.create();
final UpdateSession session = myVcs.getUpdateEnvironment().updateDirectories(new FilePath[] { VcsUtil.getFilePath(vf) }, files, new EmptyProgressIndicator(), new Ref<>());
Assert.assertTrue(session.getExceptions() != null && !session.getExceptions().isEmpty());
Assert.assertTrue(!session.isCanceled());
Assert.assertTrue(session.getExceptions().get(0).getMessage().contains(expectedText));
if (myIsSecure) {
++myExpectedCreds;
++myExpectedCert;
}
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project intellij-community by JetBrains.
the class RepositoryLoader method startLoadTask.
private void startLoadTask(@NotNull final Pair<RepositoryTreeNode, Expander> data) {
final ModalityState state = ModalityState.current();
ApplicationManager.getApplication().executeOnPooledThread(() -> ProgressManager.getInstance().runProcess(new LoadTask(data), new EmptyProgressIndicator(state)));
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project smali by JesusFreke.
the class ErrorReporter method submit.
@Override
public boolean submit(IdeaLoggingEvent[] events, String additionalInfo, Component parentComponent, final Consumer<SubmittedReportInfo> consumer) {
IdeaLoggingEvent event = events[0];
ErrorBean bean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);
final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent);
bean.setDescription(additionalInfo);
bean.setMessage(event.getMessage());
Throwable throwable = event.getThrowable();
if (throwable != null) {
final PluginId pluginId = IdeErrorsDialog.findPluginId(throwable);
if (pluginId != null) {
final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
bean.setPluginName(ideaPluginDescriptor.getName());
bean.setPluginVersion(ideaPluginDescriptor.getVersion());
}
}
}
Object data = event.getData();
if (data instanceof LogMessageEx) {
bean.setAttachments(((LogMessageEx) data).getAttachments());
}
Map<String, String> reportValues = ITNProxy.createParameters(bean);
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
Consumer<String> successCallback = new Consumer<String>() {
@Override
public void consume(String token) {
final SubmittedReportInfo reportInfo = new SubmittedReportInfo(null, "Issue " + token, SubmittedReportInfo.SubmissionStatus.NEW_ISSUE);
consumer.consume(reportInfo);
ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, "Submitted", NotificationType.INFORMATION, null).setImportant(false).notify(project);
}
};
Consumer<Exception> errorCallback = new Consumer<Exception>() {
@Override
public void consume(Exception e) {
String message = String.format("<html>There was an error while creating a GitHub issue: %s<br>" + "Please consider manually creating an issue on the " + "<a href=\"https://github.com/JesusFreke/smali/issues\">Smali Issue Tracker</a></html>", e.getMessage());
ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, message, NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(project);
}
};
GithubFeedbackTask task = new GithubFeedbackTask(project, "Submitting error report", true, reportValues, successCallback, errorCallback);
if (project == null) {
task.run(new EmptyProgressIndicator());
} else {
ProgressManager.getInstance().run(task);
}
return true;
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project intellij-community by JetBrains.
the class PluginManagerMain method loadPluginsFromHostInBackground.
/**
* Start a new thread which downloads new list of plugins from the site in
* the background and updates a list of plugins in the table.
*/
protected void loadPluginsFromHostInBackground() {
setDownloadStatus(true);
ApplicationManager.getApplication().executeOnPooledThread(() -> {
final List<IdeaPluginDescriptor> list = ContainerUtil.newArrayList();
final Map<String, String> errors = ContainerUtil.newLinkedHashMap();
ProgressIndicator indicator = new EmptyProgressIndicator();
List<String> hosts = RepositoryHelper.getPluginHosts();
Set<PluginId> unique = ContainerUtil.newHashSet();
for (String host : hosts) {
try {
if (host == null || acceptHost(host)) {
List<IdeaPluginDescriptor> plugins = RepositoryHelper.loadPlugins(host, indicator);
for (IdeaPluginDescriptor plugin : plugins) {
if (unique.add(plugin.getPluginId())) {
list.add(plugin);
}
}
}
} catch (FileNotFoundException e) {
LOG.info(host, e);
} catch (IOException e) {
LOG.info(host, e);
if (host != ApplicationInfoEx.getInstanceEx().getBuiltinPluginsUrl()) {
errors.put(host, String.format("'%s' for '%s'", e.getMessage(), host));
}
}
}
UIUtil.invokeLaterIfNeeded(() -> {
setDownloadStatus(false);
if (!list.isEmpty()) {
InstalledPluginsState state = InstalledPluginsState.getInstance();
for (IdeaPluginDescriptor descriptor : list) {
state.onDescriptorDownload(descriptor);
}
modifyPluginsList(list);
propagateUpdates(list);
}
if (!errors.isEmpty()) {
String message = IdeBundle.message("error.list.of.plugins.was.not.loaded", StringUtil.join(errors.keySet(), ", "), StringUtil.join(errors.values(), ",\n"));
String title = IdeBundle.message("title.plugins");
String ok = CommonBundle.message("button.retry"), cancel = CommonBundle.getCancelButtonText();
if (Messages.showOkCancelDialog(message, title, ok, cancel, Messages.getErrorIcon()) == Messages.OK) {
loadPluginsFromHostInBackground();
}
}
});
});
}
Aggregations