Java 类com.intellij.openapi.util.BuildNumber 实例源码

项目:intellij-ce-playground    文件:PluginDownloader.java   
@NotNull
public static PluginDownloader createDownloader(@NotNull IdeaPluginDescriptor descriptor,
                                                @Nullable String host,
                                                @Nullable BuildNumber buildNumber) throws IOException {
  try {
    String url = getUrl(descriptor, host, buildNumber);
    String id = descriptor.getPluginId().getIdString();
    PluginDownloader downloader = new PluginDownloader(id, url, descriptor.getName(), descriptor.getVersion(), buildNumber);
    downloader.setDescriptor(descriptor);
    downloader.setDescription(descriptor.getDescription());
    List<PluginId> depends;
    if (descriptor instanceof PluginNode) {
      depends = ((PluginNode)descriptor).getDepends();
    }
    else {
      depends = new ArrayList<PluginId>(Arrays.asList(descriptor.getDependentPluginIds()));
    }
    downloader.setDepends(depends);
    return downloader;
  }
  catch (URISyntaxException e) {
    throw new IOException(e);
  }
}
项目:intellij-ce-playground    文件:PluginDownloader.java   
@NotNull
private static String getUrl(@NotNull IdeaPluginDescriptor descriptor,
                             @Nullable String host,
                             @Nullable BuildNumber buildNumber) throws URISyntaxException, MalformedURLException {
  if (host != null && descriptor instanceof PluginNode) {
    String url = ((PluginNode)descriptor).getDownloadUrl();
    return new URI(url).isAbsolute() ? url : new URL(new URL(host), url).toExternalForm();
  }
  else {
    Application app = ApplicationManager.getApplication();
    ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();

    String buildNumberAsString = buildNumber != null ? buildNumber.asString() :
                                 app != null ? ApplicationInfo.getInstance().getApiVersion() :
                                 appInfo.getBuild().asString();

    String uuid = app != null ? UpdateChecker.getInstallationUID(PropertiesComponent.getInstance()) : UUID.randomUUID().toString();

    URIBuilder uriBuilder = new URIBuilder(appInfo.getPluginsDownloadUrl());
    uriBuilder.addParameter("action", "download");
    uriBuilder.addParameter("id", descriptor.getPluginId().getIdString());
    uriBuilder.addParameter("build", buildNumberAsString);
    uriBuilder.addParameter("uuid", uuid);
    return uriBuilder.build().toString();
  }
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testNewChannelAppears() {
  // assume user has version 9 eap subscription (default or selected)
  // and new channel appears - eap of version 10 is there
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.RELEASE);
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.627"), InfoReader.read("idea-newChannel-release.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());
  BuildInfo update = result.getNewBuildInSelectedChannel();
  assertNull(update);

  UpdateChannel newChannel = result.getChannelToPropose();
  assertNotNull(newChannel);
  assertEquals("IDEA10EAP", newChannel.getId());
  assertEquals("IntelliJ IDEA X EAP", newChannel.getName());
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testNewChannelAndNewBuildAppear() {
  // assume user has version 9 eap subscription (default or selected)
  // and new channels appears - eap of version 10 is there
  // and new build withing old channel appears also
  // we need to show only one dialog
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.429"), InfoReader.read("idea-newChannel.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());
  BuildInfo update = result.getNewBuildInSelectedChannel();
  assertNotNull(update);
  assertEquals("95.627", update.getNumber().toString());

  UpdateChannel newChannel = result.getChannelToPropose();
  assertNotNull(newChannel);
  assertEquals("IDEA10EAP", newChannel.getId());
  assertEquals("IntelliJ IDEA X EAP", newChannel.getName());
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testChannelWithCurrentStatusPreferred() {
  BuildNumber currentBuild = BuildNumber.fromString("IU-139.658");
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(14, currentBuild, InfoReader.read("idea-patchAvailable.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());

  UpdateChannel channel = result.getUpdatedChannel();
  assertNotNull(channel);
  assertEquals(ChannelStatus.EAP, channel.getStatus());

  BuildInfo selectedChannel = result.getNewBuildInSelectedChannel();
  assertNotNull(selectedChannel);
  assertNotNull(selectedChannel.findPatchForBuild(currentBuild));
}
项目:intellij-ce-playground    文件:UpdatesInfoParserTest.java   
@Test
public void testValidXmlParsing() {
  UpdatesInfo info = InfoReader.read("current.xml");
  assertEquals(5, info.getProductsCount());

  Product product = info.getProduct("IU");
  assertNotNull(product);
  checkProduct(product, "IntelliJ IDEA", "maiaEAP", "IDEA10EAP", "idea90");

  UpdateChannel channel = product.findUpdateChannelById("IDEA10EAP");
  assertNotNull(channel);

  BuildInfo build = channel.getLatestBuild();
  assertNotNull(build);
  assertEquals(BuildNumber.fromString("98.520"), build.getNumber());
  Date date = build.getReleaseDate();
  assertNotNull(date);
  assertEquals("2011-04-03", new SimpleDateFormat("yyyy-MM-dd").format(date));
}
项目:intellij-ce-playground    文件:UpdatesInfoParserTest.java   
@Test
public void testOneProductOnly() {
  UpdatesInfo info = InfoReader.read("oneProductOnly.xml");
  assertNotNull(info);

  Product product = info.getProduct("IU");
  assertNotNull(product);
  checkProduct(product, "IntelliJ IDEA", "maiaEAP", "IDEA10EAP", "idea90");

  UpdateChannel channel = product.findUpdateChannelById("IDEA10EAP");
  assertNotNull(channel);

  BuildInfo build = channel.getLatestBuild();
  assertNotNull(build);
  assertEquals(BuildNumber.fromString("98.520"), build.getNumber());
}
项目:intellij    文件:BlazeIntellijPluginDeployer.java   
@Nullable
private static String readPluginIdFromJar(String buildNumber, File jar)
    throws ExecutionException {
  IdeaPluginDescriptor pluginDescriptor = PluginManagerCore.loadDescriptor(jar, "plugin.xml");
  if (pluginDescriptor == null) {
    return null;
  }
  if (PluginManagerCore.isIncompatible(pluginDescriptor, BuildNumber.fromString(buildNumber))) {
    throw new ExecutionException(
        String.format(
            "Plugin SDK version '%s' is incompatible with this plugin "
                + "(since: '%s', until: '%s')",
            buildNumber, pluginDescriptor.getSinceBuild(), pluginDescriptor.getUntilBuild()));
  }
  return pluginDescriptor.getPluginId().getIdString();
}
项目:tools-idea    文件:UpdateChecker.java   
@NotNull
public static CheckForUpdateResult doCheckForUpdates(final UpdateSettings settings) {
  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  BuildNumber currentBuild = appInfo.getBuild();
  int majorVersion = Integer.parseInt(appInfo.getMajorVersion());
  final UpdatesXmlLoader loader = new UpdatesXmlLoader(getUpdateUrl());
  final UpdatesInfo info;
  try {
    info = loader.loadUpdatesInfo();
    if (info == null) {
      return new CheckForUpdateResult(UpdateStrategy.State.NOTHING_LOADED);
    }
  }
  catch (ConnectionException e) {
    return new CheckForUpdateResult(UpdateStrategy.State.CONNECTION_ERROR, e);
  }

  UpdateStrategy strategy = new UpdateStrategy(majorVersion, currentBuild, info, settings);
  return strategy.checkForUpdates();
}
项目:tools-idea    文件:UpdatesInfoXppParserTest.java   
public void testValidXmlParsing() throws Exception {
  final UpdatesInfo info = InfoReader.read("current.xml");
  Assert.assertNotNull(info);
  Assert.assertEquals(5, info.getProductsCount());

  final Product iu = info.getProduct("IU");

  checkProduct(iu, "IntelliJ IDEA", new String[]{"maiaEAP", "IDEA10EAP", "idea90"});

  final UpdateChannel channel = iu.findUpdateChannelById("IDEA10EAP");
  final BuildInfo build = channel.getLatestBuild();

  Assert.assertEquals(BuildNumber.fromString("98.520"), build.getNumber());
  Calendar releaseDate = Calendar.getInstance();
  releaseDate.setTime(build.getReleaseDate());
  Assert.assertEquals(3, releaseDate.get(Calendar.DAY_OF_MONTH));
  Assert.assertEquals(Calendar.APRIL, releaseDate.get(Calendar.MONTH));
  Assert.assertEquals(2011, releaseDate.get(Calendar.YEAR));

}
项目:tools-idea    文件:UpdateStrategyTest.java   
public void testNewChannelAppears() {
  // assume user has version 9 eap subscription (default or selected)
  // and new channel appears - eap of version 10 is there
  final TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.RELEASE);
  //first time load
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.627"), UpdatesInfoXppParserTest.InfoReader.read("idea-newChannel-release.xml"), settings);


  final CheckForUpdateResult result = strategy.checkForUpdates();
  Assert.assertEquals(UpdateStrategy.State.LOADED, result.getState());
  final BuildInfo update = result.getNewBuildInSelectedChannel();
  Assert.assertNull(update);

  final UpdateChannel newChannel = result.getChannelToPropose();
  Assert.assertNotNull(newChannel);
  Assert.assertEquals("IDEA10EAP", newChannel.getId());
  Assert.assertEquals("IntelliJ IDEA X EAP", newChannel.getName());
}
项目:tools-idea    文件:UpdateStrategyTest.java   
public void testNewChannelAndNewBuildAppear() {
  //assume user has version 9 eap subscription (default or selected)
  //and new channels appears - eap of version 10 is there
  //and new build withing old channel appears also
  //we need to show only one dialog
  final TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  //first time load
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.429"), UpdatesInfoXppParserTest.InfoReader.read("idea-newChannel.xml"), settings);

  final CheckForUpdateResult result = strategy.checkForUpdates();
  Assert.assertEquals(UpdateStrategy.State.LOADED, result.getState());
  final BuildInfo update = result.getNewBuildInSelectedChannel();
  Assert.assertNotNull(update);
  Assert.assertEquals("95.627", update.getNumber().toString());

  final UpdateChannel newChannel = result.getChannelToPropose();
  Assert.assertNotNull(newChannel);
  Assert.assertEquals("IDEA10EAP", newChannel.getId());
  Assert.assertEquals("IntelliJ IDEA X EAP", newChannel.getName());
}
项目:lombok-intellij-plugin    文件:LombokPluginApplicationComponent.java   
@Override
  public void initComponent() {
    LOG.info("Lombok plugin initialized for IntelliJ");

    final LombokSettings settings = LombokSettings.getInstance();
    updated = !Version.PLUGIN_VERSION.equals(settings.getVersion());
    if (updated) {
      settings.setVersion(Version.PLUGIN_VERSION);
    }

    final boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode();
    if (unitTestMode || settings.isEnableRuntimePatch()) {
      LOG.info("Runtime path support is enabled");
      injectAgent();
    } else {
      LOG.info("Runtime path support is disabled");
    }

    final BuildNumber currentBuild = ApplicationInfo.getInstance().getBuild();
    if (currentBuild.getBaselineVersion() < 173) {
//    Overwrite IntelliJ Diamond inspection, to filter out val declarations only for IntelliJ < 2017.3
      addCustomDiamondInspectionExtension();
    }
  }
项目:CodeGen    文件:StringUtils.java   
public static String getStackTraceAsString(Throwable throwable) {
    StringWriter stringWriter = new StringWriter();
    throwable.printStackTrace(new PrintWriter(stringWriter));
    BuildNumber number = ApplicationInfo.getInstance().getBuild();
    stringWriter.append("\n").append("BuildNumber:").append(number.asString());
    return stringWriter.toString();
}
项目:CodeGen    文件:BuildNumberTest.java   
public static void main(String[] args) {
    BuildNumber number = ApplicationInfo.getInstance().getBuild();
    // IU-171.4249.39
    System.out.println(number.asString());
    // IU
    System.out.println(number.getProductCode());
    // 171
    System.out.println(number.getBaselineVersion());
    // 171.4249.39
    System.out.println(number.asStringWithoutProductCode());
    System.out.println(number.asStringWithoutProductCodeAndSnapshot());
    // false
    System.out.println(number.isSnapshot());
}
项目:intellij-ce-playground    文件:BuildInfo.java   
public BuildInfo(Element node) {
  myNumber = BuildNumber.fromString(node.getAttributeValue("number"));

  String apiVersion = node.getAttributeValue("apiVersion");
  if (apiVersion != null) {
    myApiVersion = BuildNumber.fromString(apiVersion, myNumber.getProductCode());
  }
  else {
    myApiVersion = myNumber;
  }

  myVersion = node.getAttributeValue("version");

  Element messageTag = node.getChild("message");
  myMessage = messageTag != null ? messageTag.getValue() : "";

  Date releaseDate = null;
  final String date = node.getAttributeValue("releaseDate");
  if (date != null) {
    try {
      releaseDate = new SimpleDateFormat("yyyyMMdd", Locale.US).parse(date);
    }
    catch (ParseException e) {
      Logger.getInstance(BuildInfo.class).info("Failed to parse build release date " + date);
    }
  }
  myReleaseDate = releaseDate;

  myPatches = new ArrayList<PatchInfo>();
  for (Object patchNode : node.getChildren("patch")) {
    myPatches.add(new PatchInfo((Element)patchNode));
  }

  myButtons = new ArrayList<ButtonInfo>();
  for (Object buttonNode : node.getChildren("button")) {
    myButtons.add(new ButtonInfo((Element) buttonNode));
  }
}
项目:intellij-ce-playground    文件:BuildInfo.java   
@Nullable
public PatchInfo findPatchForBuild(BuildNumber currentBuild) {
  for (PatchInfo each : myPatches) {
    if (each.isAvailable() && each.getFromBuild().asStringWithoutProductCode().equals(currentBuild.asStringWithoutProductCode())) {
      return each;
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:PatchInfo.java   
public PatchInfo(Element node) {
  myFromBuild = BuildNumber.fromString(node.getAttributeValue("from"));
  mySize = node.getAttributeValue("size");

  String excluded = node.getAttributeValue("exclusions");
  if (excluded != null) {
    myExcludedOSes.addAll(ContainerUtil.map(StringUtil.split(excluded, ","), new Function<String, String>() {
      @Override
      public String fun(String s) {
        return s.trim();
      }
    }));
  }
}
项目:intellij-ce-playground    文件:UpdateStrategy.java   
/** @deprecated use {@link #UpdateStrategy(int, BuildNumber, UpdatesInfo, UserUpdateSettings, UpdateStrategyCustomization)} */
@SuppressWarnings("unused")
public UpdateStrategy(int majorVersion,
                      @NotNull BuildNumber currentBuild,
                      @NotNull UpdatesInfo updatesInfo,
                      @NotNull UserUpdateSettings updateSettings) {
  this(majorVersion, currentBuild, updatesInfo, updateSettings, UpdateStrategyCustomization.getInstance());
}
项目:intellij-ce-playground    文件:UpdateStrategy.java   
public UpdateStrategy(int majorVersion,
                      @NotNull BuildNumber currentBuild,
                      @NotNull UpdatesInfo updatesInfo,
                      @NotNull UserUpdateSettings updateSettings,
                      @NotNull UpdateStrategyCustomization customization) {
  myMajorVersion = majorVersion;
  myCurrentBuild = currentBuild;
  myUpdatesInfo = updatesInfo;
  myUpdateSettings = updateSettings;
  myChannelStatus = updateSettings.getSelectedChannelStatus();
  myStrategyCustomization = customization;
}
项目:intellij-ce-playground    文件:PluginDownloader.java   
private PluginDownloader(@NotNull String pluginId,
                         @NotNull String pluginUrl,
                         @Nullable String pluginName,
                         @Nullable String pluginVersion,
                         @Nullable BuildNumber buildNumber) {
  myPluginId = pluginId;
  myPluginUrl = pluginUrl;
  myPluginVersion = pluginVersion;
  myPluginName = pluginName;
  myBuildNumber = buildNumber;
}
项目:intellij-ce-playground    文件:RepositoryHelper.java   
/**
 * Loads list of plugins, compatible with a given build, from a given plugin repository (main repository if null).
 */
@NotNull
public static List<IdeaPluginDescriptor> loadPlugins(@Nullable String repositoryUrl,
                                                     @Nullable BuildNumber buildnumber,
                                                     @Nullable ProgressIndicator indicator) throws IOException {
  boolean forceHttps = repositoryUrl == null && IdeaApplication.isLoaded() && UpdateSettings.getInstance().canUseSecureConnection();
  return loadPlugins(repositoryUrl, buildnumber, forceHttps, indicator);
}
项目:intellij-ce-playground    文件:RepositoryHelper.java   
@NotNull
public static List<IdeaPluginDescriptor> loadPlugins(@Nullable String repositoryUrl,
                                                     @Nullable BuildNumber buildnumber,
                                                     boolean forceHttps,
                                                     @Nullable ProgressIndicator indicator) throws IOException {
  return loadPlugins(repositoryUrl, buildnumber, null, forceHttps, indicator);
}
项目:intellij-ce-playground    文件:UpdatePluginsFromCustomRepositoryTest.java   
public void testOnlyCompatiblePluginsAreChecked() throws Exception {
  final LinkedHashMap<PluginId, PluginDownloader> toUpdate = new LinkedHashMap<PluginId, PluginDownloader>();
  final IdeaPluginDescriptor[] descriptors = new IdeaPluginDescriptor[] {loadDescriptor("plugin1.xml"), loadDescriptor("plugin2.xml")};

  final BuildNumber currentBuildNumber = BuildNumber.fromString("IU-142.100");
  for (IdeaPluginDescriptor descriptor : descriptors) {
    UpdateChecker.checkAndPrepareToInstall(PluginDownloader.createDownloader(descriptor, null, currentBuildNumber), new InstalledPluginsState(),
                                           toUpdate, new ArrayList<IdeaPluginDescriptor>(), null);
  }
  Assert.assertEquals("Found: " + toUpdate.size(), 1, toUpdate.size());
  final PluginDownloader downloader = toUpdate.values().iterator().next();
  Assert.assertNotNull(downloader);
  Assert.assertEquals("0.1", downloader.getPluginVersion());
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testWithUndefinedSelection() {
  // could be if somebody used before previous version of IDEA
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-98.520"), InfoReader.read("idea-same.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());
  assertNull(result.getNewBuildInSelectedChannel());
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testWithUserSelection() {
  // assume user has version 9 eap - and used eap channel - we want to introduce new eap
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.429"), InfoReader.read("idea-new9eap.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());
  BuildInfo update = result.getNewBuildInSelectedChannel();
  assertNotNull(update);
  assertEquals("95.627", update.getNumber().toString());
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testIgnore() {
  // assume user has version 9 eap - and used eap channel - we want to introduce new eap
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP, "95.627", "98.620");
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.429"), InfoReader.read("idea-new9eap.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());
  BuildInfo update = result.getNewBuildInSelectedChannel();
  assertNull(update);
}
项目:intellij-ce-playground    文件:UpdateStrategyTest.java   
@Test
public void testNewChannelWithOlderBuild() {
  TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
  UpdateStrategy strategy = new UpdateStrategy(10, BuildNumber.fromString("IU-107.80"), InfoReader.read("idea-newChannel.xml"), settings, customization);

  CheckForUpdateResult result = strategy.checkForUpdates();
  assertEquals(UpdateStrategy.State.LOADED, result.getState());
  BuildInfo update = result.getNewBuildInSelectedChannel();
  assertNull(update);

  UpdateChannel newChannel = result.getChannelToPropose();
  assertNull(newChannel);
}
项目:intellij-ce-playground    文件:ApplicationInfoImpl.java   
@Override
public String getApiVersion() {
  if (myApiVersion != null) {
    return BuildNumber.fromString(myApiVersion, getBuild().getProductCode()).asString();
  }
  return getBuild().asString();
}
项目:intellij-ce-playground    文件:ResourceVersions.java   
@NotNull
private static String getVersion(@NotNull IdeaPluginDescriptor plugin) {
  if (!plugin.isBundled()) return ObjectUtils.assertNotNull(plugin.getVersion());

  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  BuildNumber build = appInfo.getBuild();
  if (!build.isSnapshot()) return build.asStringWithAllDetails();

  // There is no good way to decide whether to update resources or not when switching to a different development build.
  return build.getProductCode() + "-" + build.getBaselineVersion() + "-" + appInfo.getBuildDate().getTimeInMillis();
}
项目:intellij    文件:PluginCompatibilityEnforcer.java   
public void checkPluginCompatibility() {
  String pluginProductBuildString = readProductBuildTxt();
  if (Strings.isNullOrEmpty(pluginProductBuildString)) {
    return;
  }
  // Dev mode?
  if (pluginProductBuildString.equals("PRODUCT_BUILD")) {
    return;
  }
  BuildNumber pluginProductBuild = BuildNumber.fromString(pluginProductBuildString);
  if (pluginProductBuild == null) {
    LOG.warn("Invalid META-INF/product-build.txt");
    return;
  }

  if (!isCompatible(pluginProductBuild)) {
    String message =
        Joiner.on(' ')
            .join(
                "Invalid Android Studio version for the ASwB plugin.",
                "Android Studio version: " + ApplicationInfo.getInstance().getBuild(),
                "Compatible version: " + pluginProductBuild,
                "Please update the ASwB plugin from the plugin manager.");
    NOTIFICATION_GROUP.createNotification(message, MessageType.ERROR).notify(null);
    LOG.warn(message);
  }
}
项目:intellij    文件:PluginCompatibilityEnforcer.java   
private boolean isCompatible(BuildNumber pluginProductBuild) {
  if (pluginProductBuild.isSnapshot()) {
    return true;
  }
  BuildNumber buildNumber = ApplicationInfo.getInstance().getBuild();
  if (buildNumber == null || buildNumber.isSnapshot()) {
    return true;
  }
  return buildNumber.equals(pluginProductBuild);
}
项目:tools-idea    文件:BuildInfo.java   
public BuildInfo(Element node) {
  myNumber = BuildNumber.fromString(node.getAttributeValue("number"));
  myVersion = node.getAttributeValue("version");

  Date releaseDate = null;
  String date = node.getAttributeValue("date");
  if (date != null) {
    try {
      releaseDate = new SimpleDateFormat("dd.MM.yyyy").parse(date);
    }
    catch (ParseException e) {
      LOG.info("Failed to parse build release date " + date);
    }
  }
  myReleaseDate = releaseDate;

  myPatches = new ArrayList<PatchInfo>();
  for (Object patchNode : node.getChildren("patch")) {
    myPatches.add(new PatchInfo((Element)patchNode));
  }

  myButtons = new ArrayList<ButtonInfo>();
  for (Object buttonNode : node.getChildren("button")) {
    myButtons.add(new ButtonInfo((Element) buttonNode));
  }

  Element messageTag = node.getChild("message");
  myMessage = messageTag != null ? messageTag.getValue() : "";
}
项目:tools-idea    文件:BuildInfo.java   
@Nullable
public PatchInfo findPatchForCurrentBuild() {
  BuildNumber currentBuild = ApplicationInfo.getInstance().getBuild();
  for (PatchInfo each : myPatches) {
    if (each.isAvailable() && each.getFromBuild().asStringWithoutProductCode().equals(currentBuild.asStringWithoutProductCode())) 
      return each;
  }
  return null;
}
项目:tools-idea    文件:PatchInfo.java   
public PatchInfo(Element node) {
  myFromBuild = BuildNumber.fromString(node.getAttributeValue("from"));
  mySize = node.getAttributeValue("size");

  String excluded = node.getAttributeValue("exclusions");
  if (excluded != null) {
    myExcludedOSes.addAll(ContainerUtil.map(StringUtil.split(excluded, ","), new Function<String, String>() {
      @Override
      public String fun(String s) {
        return s.trim();
      }
    }));
  }
}
项目:tools-idea    文件:UpdateStrategy.java   
public UpdateStrategy(int majorVersion, @NotNull BuildNumber currentBuild, @NotNull UpdatesInfo updatesInfo,
                      @NotNull UserUpdateSettings updateSettings) {
  myMajorVersion = majorVersion;
  myUpdatesInfo = updatesInfo;
  myUpdateSettings = updateSettings;
  myCurrentBuild = currentBuild;
  myChannelStatus = updateSettings.getSelectedChannelStatus();
}
项目:tools-idea    文件:UpdatesInfoXppParserTest.java   
public void testOneProductOnly() throws Exception {
  final UpdatesInfo info = InfoReader.read("oneProductOnly.xml");
  Assert.assertNotNull(info);
  final Product iu = info.getProduct("IU");

  checkProduct(iu, "IntelliJ IDEA", new String[]{"maiaEAP", "IDEA10EAP", "idea90"});

  final UpdateChannel channel = iu.findUpdateChannelById("IDEA10EAP");
  final BuildInfo build = channel.getLatestBuild();

  Assert.assertEquals(BuildNumber.fromString("98.520"), build.getNumber());
}
项目:tools-idea    文件:UpdateStrategyTest.java   
public void testWithUndefinedSelection() {
  final TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  //first time load
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-98.520"), UpdatesInfoXppParserTest.InfoReader.read("idea-same.xml"), settings);

  final CheckForUpdateResult result1 = strategy.checkForUpdates();
  Assert.assertEquals(UpdateStrategy.State.LOADED, result1.getState());
  Assert.assertNull(result1.getNewBuildInSelectedChannel());
}
项目:tools-idea    文件:UpdateStrategyTest.java   
public void testWithUserSelection() {
  //assume user has version 9 eap - and used eap channel - we want to introduce new eap
  final TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  //first time load
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.429"), UpdatesInfoXppParserTest.InfoReader.read("idea-new9eap.xml"), settings);

  final CheckForUpdateResult result = strategy.checkForUpdates();
  Assert.assertEquals(UpdateStrategy.State.LOADED, result.getState());
  final BuildInfo update = result.getNewBuildInSelectedChannel();
  Assert.assertNotNull(update);
  Assert.assertEquals("95.627", update.getNumber().toString());
}
项目:tools-idea    文件:UpdateStrategyTest.java   
public void testIgnore() {
  //assume user has version 9 eap - and used eap channel - we want to introduce new eap
  final TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
  settings.addIgnoredBuildNumber("95.627");
  settings.addIgnoredBuildNumber("98.620");
  //first time load
  UpdateStrategy strategy = new UpdateStrategy(9, BuildNumber.fromString("IU-95.429"), UpdatesInfoXppParserTest.InfoReader.read("idea-new9eap.xml"), settings);

  final CheckForUpdateResult result = strategy.checkForUpdates();
  Assert.assertEquals(UpdateStrategy.State.LOADED, result.getState());
  final BuildInfo update = result.getNewBuildInSelectedChannel();
  Assert.assertNull(update);
}