Java 类com.intellij.util.text.VersionComparatorUtil 实例源码

项目:intellij-ce-playground    文件:IpnbParser.java   
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;
}
项目:intellij-ce-playground    文件:MavenProjectModelModifier.java   
@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);
}
项目:consulo-google-guice    文件:GoogleGuiceMavenImporter.java   
@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);
        }
    }
}
项目:educational-plugin    文件:EduKotlinLibConfigurator.java   
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;
    }
项目:intellij-ce-playground    文件:JavaParameters.java   
@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;
}
项目:intellij-ce-playground    文件:YouTrackRepository.java   
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();
  }
}
项目:intellij-ce-playground    文件:MantisRepository.java   
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);
  }
}
项目:MvnRunner    文件:MvnTestConfigurationProducer.java   
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;
}
项目:r2m-plugin-android    文件:CheckUpdatesAction.java   
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);

    }
项目:tools-idea    文件:YouTrackRepository.java   
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");
  }
}
项目:intellij-xquery    文件:XQueryRunProfileState.java   
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;
}
项目:consulo-tasks    文件:YouTrackRepository.java   
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");
  }
}
项目:consulo-java    文件:OwnJavaParameters.java   
@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;
}
项目:idea-php-typo3-plugin    文件:TYPO3Utility.java   
/**
 * 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);
}
项目:idea-php-typo3-plugin    文件:TYPO3Utility.java   
/**
 * 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);
}
项目:intellij-ce-playground    文件:PluginDownloader.java   
public static int comparePluginVersions(String newPluginVersion, String oldPluginVersion) {
  return VersionComparatorUtil.compare(newPluginVersion, oldPluginVersion);
}
项目:intellij-ce-playground    文件:JiraVersion.java   
@Override
public int compareTo(@NotNull JiraVersion o) {
  return VersionComparatorUtil.compare(toString(), o.toString());
}
项目:tools-idea    文件:MantisRepository.java   
private static boolean allProjectsAvailable(final MantisConnectPortType soap) throws RemoteException {
  String version = soap.mc_version();
  return VersionComparatorUtil.compare(version, "1.2.9") >= 0;
}
项目:idea-php-symfony2-plugin    文件:SymfonyUtil.java   
public static boolean isVersionGreaterThenEquals(@NotNull Project project, @NotNull String version) {
    return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) >= 0);
}
项目:idea-php-symfony2-plugin    文件:SymfonyUtil.java   
public static boolean isVersionGreaterThen(@NotNull Project project, @NotNull String version) {
    return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) > 0);
}
项目:idea-php-symfony2-plugin    文件:SymfonyUtil.java   
public static boolean isVersionLessThenEquals(@NotNull Project project, @NotNull String version) {
    return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) <= 0);
}
项目:idea-php-symfony2-plugin    文件:SymfonyUtil.java   
public static boolean isVersionLessThen(@NotNull Project project, @NotNull String version) {
    return compare(project, version, contents -> VersionComparatorUtil.compare(contents, version) < 0);
}
项目:consulo-tasks    文件:JiraVersion.java   
@Override
public int compareTo(@NotNull JiraVersion o) {
  return VersionComparatorUtil.compare(toString(), o.toString());
}
项目:consulo-tasks    文件:MantisRepository.java   
private static boolean allProjectsAvailable(final MantisConnectPortType soap) throws RemoteException {
  String version = soap.mc_version();
  return VersionComparatorUtil.compare(version, "1.2.9") >= 0;
}