Java Code Examples for com.intellij.openapi.util.text.StringUtil#compareVersionNumbers()
The following examples show how to use
com.intellij.openapi.util.text.StringUtil#compareVersionNumbers() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstalledPluginsState.java From consulo with Apache License 2.0 | 6 votes |
public void updateExistingPluginInfo(PluginDescriptor descr, PluginDescriptor existing) { int state = StringUtil.compareVersionNumbers(descr.getVersion(), existing.getVersion()); final PluginId pluginId = existing.getPluginId(); final Set<PluginId> installedPlugins = InstalledPluginsState.getInstance().getInstalledPlugins(); if (!installedPlugins.contains(pluginId) && !existing.isDeleted()) { installedPlugins.add(pluginId); } if (state > 0 && !PluginManager.isIncompatible(descr) && !myUpdatedPlugins.contains(descr.getPluginId())) { myNewVersions.add(pluginId); myOutdatedPlugins.add(pluginId); } else { myOutdatedPlugins.remove(pluginId); if (myNewVersions.remove(pluginId)) { myUpdatedPlugins.add(pluginId); } } }
Example 2
Source File: PluginsAdvertiserHolder.java From consulo with Apache License 2.0 | 6 votes |
public static void update(@Nullable List<PluginDescriptor> list) { ourLoadedPluginDescriptors = ContainerUtil.isEmpty(list) ? null : list; if (list != null) { InstalledPluginsState pluginsState = InstalledPluginsState.getInstance(); for (PluginDescriptor newPluginDescriptor : list) { final PluginDescriptor installed = PluginManager.getPlugin(newPluginDescriptor.getPluginId()); if (installed != null) { int state = StringUtil.compareVersionNumbers(newPluginDescriptor.getVersion(), installed.getVersion()); if (state > 0 && !PluginManager.isIncompatible(newPluginDescriptor) && !pluginsState.getUpdatedPlugins().contains(newPluginDescriptor.getPluginId())) { pluginsState.getOutdatedPlugins().add(newPluginDescriptor.getPluginId()); } } } } }
Example 3
Source File: PluginManagerCore.java From consulo with Apache License 2.0 | 5 votes |
@Deprecated @DeprecationInfo("Must be never used from plugin or platform") public static void loadDescriptors(@Nonnull File pluginsHome, List<PluginDescriptorImpl> result, @Nullable StartupProgress progress, int pluginsCount, boolean isHeadlessMode, boolean isPreInstalledPath) { final File[] files = pluginsHome.listFiles(); if (files != null) { int i = result.size(); for (File file : files) { final PluginDescriptorImpl descriptor = PluginDescriptorLoader.loadDescriptor(file, isHeadlessMode, isPreInstalledPath, PluginsLoader.C_LOG); if (descriptor == null) continue; if (progress != null) { progress.showProgress(descriptor.getName(), PLUGINS_PROGRESS_MAX_VALUE * ((float)++i / pluginsCount)); } int oldIndex = result.indexOf(descriptor); if (oldIndex >= 0) { final PluginDescriptorImpl oldDescriptor = result.get(oldIndex); if (StringUtil.compareVersionNumbers(oldDescriptor.getVersion(), descriptor.getVersion()) < 0) { result.set(oldIndex, descriptor); } } else { result.add(descriptor); } } } }
Example 4
Source File: SystemInfo.java From consulo with Apache License 2.0 | 4 votes |
public static boolean isOsVersionAtLeast(@Nonnull String version) { return StringUtil.compareVersionNumbers(OS_VERSION, version) >= 0; }
Example 5
Source File: SystemInfo.java From consulo with Apache License 2.0 | 4 votes |
/** @deprecated use {@link #isJavaVersionAtLeast(int, int, int)} (to be removed in IDEA 2020) */ public static boolean isJavaVersionAtLeast(String v) { return StringUtil.compareVersionNumbers(JAVA_RUNTIME_VERSION, v) >= 0; }
Example 6
Source File: PlatformBase.java From consulo with Apache License 2.0 | 4 votes |
public static boolean isOsVersionAtLeast(@Nonnull String version) { return StringUtil.compareVersionNumbers(OS_VERSION, version) >= 0; }