本文整理汇总了Java中com.intellij.openapi.util.BuildNumber类的典型用法代码示例。如果您正苦于以下问题:Java BuildNumber类的具体用法?Java BuildNumber怎么用?Java BuildNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildNumber类属于com.intellij.openapi.util包,在下文中一共展示了BuildNumber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDownloader
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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);
}
}
示例2: getUrl
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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();
}
}
示例3: testNewChannelAppears
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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());
}
示例4: testNewChannelAndNewBuildAppear
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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());
}
示例5: testChannelWithCurrentStatusPreferred
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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));
}
示例6: testValidXmlParsing
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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));
}
示例7: testOneProductOnly
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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());
}
示例8: readPluginIdFromJar
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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();
}
示例9: doCheckForUpdates
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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();
}
示例10: testValidXmlParsing
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
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));
}
示例11: testNewChannelAppears
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
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());
}
示例12: testNewChannelAndNewBuildAppear
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
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());
}
示例13: initComponent
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
@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();
}
}
示例14: getStackTraceAsString
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
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();
}
示例15: main
import com.intellij.openapi.util.BuildNumber; //导入依赖的package包/类
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());
}