public static boolean isIpythonNewFormat(@NotNull final VirtualFile virtualFile) { final Project project = ProjectUtil.guessProjectForFile(virtualFile); if (project != null) { final Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile); if (module != null) { final Sdk sdk = PythonSdkType.findPythonSdk(module); if (sdk != null) { try { final PyPackage ipython = PyPackageManager.getInstance(sdk).findPackage("ipython", true); if (ipython != null && VersionComparatorUtil.compare(ipython.getVersion(), "3.0") <= 0) { return false; } } catch (ExecutionException ignored) { } } } } return true; }
@Nullable private String selectVersion(@NotNull ExternalLibraryDescriptor descriptor) { Set<String> versions = myIndicesManager.getVersions(descriptor.getLibraryGroupId(), descriptor.getLibraryArtifactId()); List<String> suitableVersions = new ArrayList<String>(); String minVersion = descriptor.getMinVersion(); String maxVersion = descriptor.getMaxVersion(); for (String version : versions) { if ((minVersion == null || VersionComparatorUtil.compare(minVersion, version) <= 0) && (maxVersion == null || VersionComparatorUtil.compare(version, maxVersion) < 0)) { suitableVersions.add(version); } } if (suitableVersions.isEmpty()) { return null; } return Collections.max(suitableVersions, VersionComparatorUtil.COMPARATOR); }
@Override public void process(MavenModifiableModelsProvider mavenModifiableModelsProvider, Module module, MavenRootModelAdapter mavenRootModelAdapter, MavenProjectsTree mavenProjectsTree, MavenProject mavenProject, MavenProjectChanges mavenProjectChanges, Map<MavenProject, String> map, List<MavenProjectsProcessorTask> list) { GoogleGuiceMutableModuleExtension extension = (GoogleGuiceMutableModuleExtension) enableModuleExtension(module, mavenModifiableModelsProvider, GoogleGuiceModuleExtension.class); List<MavenArtifact> artifactList = mavenProject.findDependencies("com.google.inject", "guice"); for(MavenArtifact mavenArtifact : artifactList) { String version = mavenArtifact.getVersion(); if(VersionComparatorUtil.compare(version, "3.0") >= 0) { extension.setUseJSR330(true); } } }
private static boolean tryOldAPI(Project project) { String settingName = "Configure Kotlin: info notification"; NotificationsConfiguration.getNotificationsConfiguration().changeSettings(settingName, NotificationDisplayType.NONE, true, false); KotlinProjectConfigurator configuratorByName = ConfigureKotlinInProjectUtilsKt.getConfiguratorByName("java"); if (configuratorByName == null) { LOG.info("Failed to find configurator"); return false; } Class<?> confClass = configuratorByName.getClass(); while (confClass != KotlinWithLibraryConfigurator.class) { confClass = confClass.getSuperclass(); } String lib = FileUIUtils.createRelativePath(project, project.getBaseDir(), "lib"); //collector arg was added in Kotlin plugin 1.0.1 IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin")); if (plugin == null) { return false; } if (VersionComparatorUtil.compare(plugin.getVersion(), "1.0.1") > 0) { if (configureWithCollector(project, confClass, configuratorByName, lib)) { return true; } } else { if (!configureWithoutCollector(project, confClass, configuratorByName, lib)) { configuratorByName.configure(project, Collections.emptyList()); } } NotificationsConfiguration.getNotificationsConfiguration().changeSettings(settingName, NotificationDisplayType.STICKY_BALLOON, true, false); return true; }
@NotNull private static Sdk findLatestVersion(@NotNull Sdk mainSdk, @NotNull Set<Sdk> sdks) { Sdk result = mainSdk; for (Sdk sdk : sdks) { if (VersionComparatorUtil.compare(result.getVersionString(), sdk.getVersionString()) < 0) { result = sdk; } } return result; }
private void checkVersion() throws Exception { HttpMethod method = doREST("/rest/workflow/version", false); try { InputStream stream = method.getResponseBodyAsStream(); Element element = new SAXBuilder(false).build(stream).getRootElement(); final boolean timeTrackingAvailable = element.getName().equals("version") && VersionComparatorUtil.compare(element.getChildText("version"), "4.1") >= 0; if (!timeTrackingAvailable) { throw new Exception("This version of Youtrack the time tracking is not supported"); } } finally { method.releaseConnection(); } }
private boolean checkAllProjectsAvailable(MantisConnectPortType soap) throws Exception { // Check whether All Projects is available supported by server try { String version = soap.mc_version(); boolean available = !DEBUG_ALL_PROJECTS && VersionComparatorUtil.compare(version, "1.2.9") >= 0; if (!available) { LOG.info("Using Mantis version without 'All Projects' support: " + version); } return available; } catch (Exception e) { throw handleException(e); } }
private boolean isForking() { for (org.jetbrains.idea.maven.model.MavenPlugin plugin : mavenProject.getPlugins()) { if (plugin.getMavenId().equals("org.apache.maven.plugins", "maven-surefire-plugin")) { return "2.14".equals(VersionComparatorUtil.min(plugin.getVersion(), "2.14")); } } return false; }
public void actionPerformed(AnActionEvent e) { Properties updatesInfo = new Properties(); InputStream infoStream = null; String url = R2MConstants.PUBLIC_VERSION_URL; try { infoStream = URLHelper.loadUrl(url); updatesInfo.load(infoStream); } catch (Exception ex) { UIHelper.showErrorMessage("Couldn't access version URL: " + R2MConstants.PUBLIC_VERSION_URL); Logger.error(CheckUpdatesAction.class, ex.getMessage()); return; } finally { if (infoStream != null) { try { infoStream.close(); } catch (IOException e1) { // ignore } } } String latestVersion = updatesInfo.getProperty(R2MConstants.LATEST_VERSION_KEY); String installedVersion = getInstalledVersion(); Project project = e.getData(CommonDataKeys.PROJECT); if (VersionComparatorUtil.compare(installedVersion, latestVersion) >= 0) { showNoUpdateDialog(project, installedVersion, updatesInfo); return; } showUpdatesAvailableDialog(project, installedVersion, updatesInfo); }
private void checkVersion() throws Exception { HttpMethod method = doREST("/rest/workflow/version", false); InputStream stream = method.getResponseBodyAsStream(); Element element = new SAXBuilder(false).build(stream).getRootElement(); final boolean timeTrackingAvailable = element.getName().equals("version") && VersionComparatorUtil.compare(element.getChildText("version"), "4.1") >= 0; if (!timeTrackingAvailable) { throw new Exception("This version of Youtrack the time tracking is not supported"); } }
private Sdk findLatestVersion(@NotNull Sdk mainSdk, @NotNull Set<Sdk> sdks) { Sdk result = mainSdk; for (Sdk sdk : sdks) { if (VersionComparatorUtil.compare(result.getVersionString(), sdk.getVersionString()) < 0) { result = sdk; } } return result; }
@NotNull private static Sdk findLatestVersion(@NotNull Sdk mainSdk, @NotNull Set<Sdk> sdks) { Sdk result = mainSdk; for(Sdk sdk : sdks) { if(VersionComparatorUtil.compare(result.getVersionString(), sdk.getVersionString()) < 0) { result = sdk; } } return result; }
/** * Examples: 1.0rc1 < 1.0release, 1.0 < 1.0.1, 1.1 > 1.02 * * @return 0 if cms version equals given version, positive value if cms version > given version, negative value if cms version < given version */ public static Integer compareVersion(@NotNull Project project, String version) { String typo3Version = getTYPO3Version(project); return VersionComparatorUtil.compare(typo3Version, version); }
/** * Examples: 1.0rc1 < 1.0release, 1.0 < 1.0.1, 1.1 > 1.02 * * @return 0 if cms version equals given version, positive value if cms version > given version, negative value if cms version < given version */ public static Integer compareMajorMinorVersion(@NotNull Project project, String version) { String typo3Version = getTYPO3Branch(project); return VersionComparatorUtil.compare(typo3Version, version); }
public static int comparePluginVersions(String newPluginVersion, String oldPluginVersion) { return VersionComparatorUtil.compare(newPluginVersion, oldPluginVersion); }
@Override public int compareTo(@NotNull JiraVersion o) { return VersionComparatorUtil.compare(toString(), o.toString()); }
private static boolean allProjectsAvailable(final MantisConnectPortType soap) throws RemoteException { String version = soap.mc_version(); return VersionComparatorUtil.compare(version, "1.2.9") >= 0; }
public static boolean isVersionGreaterThenEquals(@NotNull Project project, @NotNull String version) { return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) >= 0); }
public static boolean isVersionGreaterThen(@NotNull Project project, @NotNull String version) { return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) > 0); }
public static boolean isVersionLessThenEquals(@NotNull Project project, @NotNull String version) { return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) <= 0); }
public static boolean isVersionLessThen(@NotNull Project project, @NotNull String version) { return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) < 0); }