Search in sources :

Example 6 with UpdateSettings

use of com.intellij.openapi.updateSettings.impl.UpdateSettings in project android by JetBrains.

the class SdkComponentSourceTest method testUpdates.

public void testUpdates() throws Exception {
    ExternalComponentManager.getInstance().registerComponentSource(myTestComponentSource);
    ProgressIndicator progress = new StudioProgressIndicatorAdapter(new FakeProgressIndicator(), null);
    UpdateSettings settings = new UpdateSettings() {

        @Override
        public List<String> getEnabledExternalUpdateSources() {
            return ImmutableList.of(myTestComponentSource.getName());
        }
    };
    Collection<ExternalUpdate> updates = UpdateChecker.updateExternal(true, settings, progress);
    assertEquals(1, updates.size());
    ExternalUpdate update = updates.iterator().next();
    Iterator<UpdatableExternalComponent> iter = update.getComponents().iterator();
    UpdatableExternalComponent component = iter.next();
    assertEquals("package newerPreview", component.getName());
    assertEquals(new Revision(1, 0, 0, 2), ((RepoPackage) component.getKey()).getVersion());
    component = iter.next();
    assertEquals("package newerRemote", component.getName());
    assertEquals(new Revision(1, 1, 0), ((RepoPackage) component.getKey()).getVersion());
    assertFalse(iter.hasNext());
}
Also used : ExternalUpdate(com.intellij.openapi.updateSettings.impl.ExternalUpdate) Revision(com.android.repository.Revision) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) UpdatableExternalComponent(com.intellij.ide.externalComponents.UpdatableExternalComponent) StudioProgressIndicatorAdapter(com.android.tools.idea.sdk.progress.StudioProgressIndicatorAdapter) UpdateSettings(com.intellij.openapi.updateSettings.impl.UpdateSettings)

Example 7 with UpdateSettings

use of com.intellij.openapi.updateSettings.impl.UpdateSettings in project intellij-community by JetBrains.

the class ITNProxy method createParameters.

@NotNull
private static Multimap<String, String> createParameters(String login, String password, @NotNull ErrorBean error) {
    Multimap<String, String> params = ArrayListMultimap.create(40, 1);
    params.put("protocol.version", "1");
    params.put("user.login", login);
    params.put("user.password", password);
    params.put("os.name", SystemProperties.getOsName());
    params.put("java.version", SystemProperties.getJavaVersion());
    params.put("java.vm.vendor", SystemProperties.getJavaVmVendor());
    ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
    ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
    Application application = ApplicationManager.getApplication();
    params.put("app.name", namesInfo.getProductName());
    params.put("app.name.full", namesInfo.getFullProductName());
    params.put("app.name.version", appInfo.getVersionName());
    params.put("app.eap", Boolean.toString(appInfo.isEAP()));
    params.put("app.internal", Boolean.toString(application.isInternal()));
    params.put("app.build", appInfo.getApiVersion());
    params.put("app.version.major", appInfo.getMajorVersion());
    params.put("app.version.minor", appInfo.getMinorVersion());
    params.put("app.build.date", format(appInfo.getBuildDate()));
    params.put("app.build.date.release", format(appInfo.getMajorReleaseBuildDate()));
    params.put("app.compilation.timestamp", IdeaLogger.getOurCompilationTimestamp());
    BuildNumber build = appInfo.getBuild();
    String buildNumberWithAllDetails = build.asString();
    params.put("app.product.code", build.getProductCode());
    if (StringUtil.startsWith(buildNumberWithAllDetails, build.getProductCode() + "-")) {
        buildNumberWithAllDetails = buildNumberWithAllDetails.substring(build.getProductCode().length() + 1);
    }
    params.put("app.build.number", buildNumberWithAllDetails);
    UpdateSettings updateSettings = UpdateSettings.getInstance();
    params.put("update.channel.status", updateSettings.getSelectedChannelStatus().getCode());
    params.put("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ","));
    params.put("plugin.name", error.getPluginName());
    params.put("plugin.version", error.getPluginVersion());
    params.put("last.action", error.getLastAction());
    params.put("previous.exception", error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException()));
    params.put("error.message", error.getMessage());
    params.put("error.stacktrace", error.getStackTrace());
    params.put("error.description", error.getDescription());
    params.put("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId()));
    for (Attachment attachment : error.getAttachments()) {
        params.put("attachment.name", attachment.getName());
        params.put("attachment.value", attachment.getEncodedBytes());
    }
    return params;
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) BuildNumber(com.intellij.openapi.util.BuildNumber) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo) Attachment(com.intellij.openapi.diagnostic.Attachment) UpdateSettings(com.intellij.openapi.updateSettings.impl.UpdateSettings) Application(com.intellij.openapi.application.Application) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

UpdateSettings (com.intellij.openapi.updateSettings.impl.UpdateSettings)7 Revision (com.android.repository.Revision)3 StudioProgressIndicatorAdapter (com.android.tools.idea.sdk.progress.StudioProgressIndicatorAdapter)3 UpdatableExternalComponent (com.intellij.ide.externalComponents.UpdatableExternalComponent)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 ExternalUpdate (com.intellij.openapi.updateSettings.impl.ExternalUpdate)3 Application (com.intellij.openapi.application.Application)2 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)2 ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)2 Attachment (com.intellij.openapi.diagnostic.Attachment)2 BuildNumber (com.intellij.openapi.util.BuildNumber)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 NotNull (org.jetbrains.annotations.NotNull)1