当前位置: 首页>>代码示例>>Java>>正文


Java VersionComparatorUtil类代码示例

本文整理汇总了Java中com.intellij.util.text.VersionComparatorUtil的典型用法代码示例。如果您正苦于以下问题:Java VersionComparatorUtil类的具体用法?Java VersionComparatorUtil怎么用?Java VersionComparatorUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VersionComparatorUtil类属于com.intellij.util.text包,在下文中一共展示了VersionComparatorUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isIpythonNewFormat

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:IpnbParser.java

示例2: selectVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
@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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenProjectModelModifier.java

示例3: process

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-google-guice,代码行数:23,代码来源:GoogleGuiceMavenImporter.java

示例4: tryOldAPI

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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;
    }
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:36,代码来源:EduKotlinLibConfigurator.java

示例5: findLatestVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaParameters.java

示例6: checkVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:YouTrackRepository.java

示例7: checkAllProjectsAvailable

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MantisRepository.java

示例8: isForking

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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;
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:9,代码来源:MvnTestConfigurationProducer.java

示例9: actionPerformed

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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);

    }
 
开发者ID:magnetsystems,项目名称:r2m-plugin-android,代码行数:36,代码来源:CheckUpdatesAction.java

示例10: checkVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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");
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:YouTrackRepository.java

示例11: findLatestVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
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;
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:10,代码来源:XQueryRunProfileState.java

示例12: findLatestVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
@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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:OwnJavaParameters.java

示例13: compareVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:11,代码来源:TYPO3Utility.java

示例14: compareMajorMinorVersion

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:11,代码来源:TYPO3Utility.java

示例15: comparePluginVersions

import com.intellij.util.text.VersionComparatorUtil; //导入依赖的package包/类
public static int comparePluginVersions(String newPluginVersion, String oldPluginVersion) {
  return VersionComparatorUtil.compare(newPluginVersion, oldPluginVersion);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PluginDownloader.java


注:本文中的com.intellij.util.text.VersionComparatorUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。