Search in sources :

Example 1 with EmptyProgressIndicator

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));
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) BlockSupportImpl(com.intellij.psi.impl.source.text.BlockSupportImpl) DiffLog(com.intellij.psi.impl.source.text.DiffLog)

Example 2 with EmptyProgressIndicator

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;
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) UpdateSession(com.intellij.openapi.vcs.update.UpdateSession) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Example 3 with EmptyProgressIndicator

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)));
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) ModalityState(com.intellij.openapi.application.ModalityState)

Example 4 with EmptyProgressIndicator

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;
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) LogMessageEx(com.intellij.diagnostic.LogMessageEx) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) IdeaLoggingEvent(com.intellij.openapi.diagnostic.IdeaLoggingEvent) Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) Consumer(com.intellij.util.Consumer) ErrorBean(com.intellij.errorreport.bean.ErrorBean) SubmittedReportInfo(com.intellij.openapi.diagnostic.SubmittedReportInfo)

Example 5 with EmptyProgressIndicator

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();
                }
            }
        });
    });
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) PluginId(com.intellij.openapi.extensions.PluginId)

Aggregations

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)49 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)17 NotNull (org.jetbrains.annotations.NotNull)13 IOException (java.io.IOException)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 DataContext (com.intellij.openapi.actionSystem.DataContext)5 ProgressManager (com.intellij.openapi.progress.ProgressManager)5 Test (org.junit.Test)5 StudioProgressIndicatorAdapter (com.android.tools.idea.sdk.progress.StudioProgressIndicatorAdapter)4 Processor (com.intellij.util.Processor)4 File (java.io.File)4 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)3 DiffLog (com.intellij.psi.impl.source.text.DiffLog)3 ArrayList (java.util.ArrayList)3 Future (java.util.concurrent.Future)3 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)2 ProcessEvent (com.intellij.execution.process.ProcessEvent)2 Disposable (com.intellij.openapi.Disposable)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)2